Skip to content

Commit

Permalink
Apply the latest Beman Standard (#15)
Browse files Browse the repository at this point in the history
* Apply the latest Beman Standard

* cleanup in .gitignore

* Remove file prologue as it will not be mentioned in the Beman Standard

* Tweaks in .gitignore

* README.md: add build instructions ready to copy-paste

* Tweaks in CMakeLists.txt

* Tweaks in CI tests configuration file

* Apply naming convention from the Beman Standard

* Tweaks for LICENSE

* Change root README structure

* Fix CI tests

* Update .github/CODEOWNERS

* Remove whitespace

* Add more relevant example

* Latest examples depends on range support: C++20 or later required for this project

* Rename from CamelScase to snake_case

* Apply tree tweaks
  • Loading branch information
neatudarius authored Sep 10, 2024
1 parent 3742e50 commit c18c28a
Show file tree
Hide file tree
Showing 21 changed files with 772 additions and 305 deletions.
22 changes: 14 additions & 8 deletions .ci/docker/rockylinux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

FROM rockylinux:9

# Enable EPEL
# Enable EPEL.
RUN dnf update -y
RUN dnf install -y 'dnf-command(config-manager)'
RUN dnf config-manager --set-enabled crb -y
RUN dnf install epel-release -y

# Install dependencies
# Install dependencies.
RUN dnf install -y \
clang \
g++ \
ninja-build \
cmake
cmake \
git
RUN dnf clean all

# Copy code
# Copy code.
WORKDIR /workarea
COPY ./ ./

# Set build arguments.
ARG cc=gcc
ARG cxx=g++
ARG cmake_args=

# Build.
ENV CC="$cc" CXX="$cxx" CMAKE_GENERATOR="Ninja" CMAKE_EXPORT_COMPILE_COMMANDS=on
RUN cmake -B build -S . "$cmake_args" && \
cmake --build build --verbose && \
DESTDIR=build/staging cmake --install build --prefix /opt/example --component libexample-dev && \
find build/staging -type f
RUN cmake -B build -S . "$cmake_args"
RUN cmake --build build --verbose
RUN cmake --install build --prefix /opt/beman.example
RUN find /opt/beman.example -type f

20 changes: 13 additions & 7 deletions .ci/docker/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# Using a non-LTS Ubuntu, just until CMake 3.23 is available on Ubuntu 24.04
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Using a non-LTS Ubuntu, just until CMake 3.23 is available on Ubuntu 24.04.
FROM ubuntu:23.10

# Install dependencies
# Install dependencies,
RUN apt-get update
RUN apt-get install -y \
clang \
clang-tidy \
g++ \
ninja-build \
cmake
cmake \
git
RUN apt-get clean

WORKDIR /workarea
COPY ./ ./

# Set build arguments.
ARG cc=gcc
ARG cxx=g++
ARG cmake_args=

# Workaround Ubuntu broken ASan
RUN sysctl vm.mmap_rnd_bits=28

# Build.
ENV CC="$cc" CXX="$cxx" CMAKE_GENERATOR="Ninja" CMAKE_EXPORT_COMPILE_COMMANDS=on
RUN cmake -B build -S . "$cmake_args" && \
cmake --build build --verbose && \
DESTDIR=build/staging cmake --install build --prefix /opt/example --component libexample-dev && \
find build/staging -type f
RUN ls -lR src
RUN cmake -B build -S . "$cmake_args"
RUN cmake --build build --verbose
RUN cmake --install build --prefix /opt/beman.example
RUN find /opt/beman.example -type f
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Codeowners for reviews on PRs

* @bretbrownjr @camio @dietmarkuehl @neatudarius @steve-downey
16 changes: 8 additions & 8 deletions .github/workflows/cxx.yml → .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright © 2024 Bret Brown
# SPDX-License-Identifier: MIT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: Test
name: Continuous Integration Tests

on:
push:
Expand Down Expand Up @@ -30,14 +29,15 @@ jobs:
- { id: ubuntu-gcc-aubsan, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=address -fsanitize=undefined"}
- { id: ubuntu-gcc-tsan, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread"}
- { id: ubuntu-gcc-static, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: ""}
- { id: ubuntu-gcc-static-cxx98, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-static-cxx11, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-static-cxx14, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-static-cxx17, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-static-cxx20, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-dynamic, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DBUILD_SHARED_LIBS=on"}
- { id: ubuntu-clang-static, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: ""}
- { id: ubuntu-clang-dynamic, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DBUILD_SHARED_LIBS=on"}
- { id: ubuntu-gcc-static-cxx20, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-static-cxx23, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-static-cxx26, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=26 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-clang-static-cxx20, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-clang-static-cxx23, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-clang-static-cxx26, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DCMAKE_CXX_STANDARD=26 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
# Disabling Rocky until it catches up on CMake versions or a way to sideload newer version of CMake
# is identified.
# - { id: rockylinux-gcc-static, platform: rockylinux, cc: gcc, cpp: g++, cmake_args: ""}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/compile_commands.json
/build
35 changes: 24 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
# Copyright © 2024 Bret Brown
# SPDX-License-Identifier: MIT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# TODO Darius: Find CMake minimum required version.
cmake_minimum_required(VERSION 3.23)
project(example
VERSION 1.0.0
DESCRIPTION "An example Beman library"
LANGUAGES CXX
)

project(
beman.example # CMake Project Name, which is also the name of the top-level
# targets (e.g., library, executable, etc.).
DESCRIPTION "A Beman Library Example"
LANGUAGES CXX)

include(CTest)
include(FetchContent)

if(BUILD_TESTING)
enable_testing()

# Fetch GoogleTest
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0
EXCLUDE_FROM_ALL CMAKE_ARGS -DBUILD_TESTING=OFF)
FetchContent_MakeAvailable(googletest)
endif()

add_subdirectory(src/example)
add_subdirectory(src/beman/example)

if (BUILD_TESTING)
add_subdirectory(test/example)
endif ()
add_subdirectory(examples)
Loading

0 comments on commit c18c28a

Please sign in to comment.