Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restructure cmake workflow presets #62

Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7c45940
CMake-format cmake modules too
ClausKlein Nov 2, 2024
78dc1c2
Update how to build this project
ClausKlein Nov 2, 2024
fb2500b
Fix typos with codespell
ClausKlein Nov 2, 2024
fbe7604
Format python files witch black
ClausKlein Nov 2, 2024
80ce062
In-source builds are not allowed now
ClausKlein Nov 2, 2024
74161e0
Add apple clang compiler to CI test
ClausKlein Nov 2, 2024
a3fab15
Quickfix
ClausKlein Nov 2, 2024
270d10d
Restructure CMake Presets
ClausKlein Nov 2, 2024
fc8d510
Add codespell target to Makefile
ClausKlein Nov 2, 2024
37e9818
Add codespell ignore list and rc file
ClausKlein Nov 2, 2024
056d687
Add Windows preset too
ClausKlein Nov 3, 2024
b9c8984
Test clang++-18 on linux CI too
ClausKlein Nov 3, 2024
2ed4c45
Fix Windows preset
ClausKlein Nov 4, 2024
ed03fd7
Add missing configuration setting for VS generator
ClausKlein Nov 4, 2024
303cca6
Set CMAKE_SKIP_TEST_ALL_DEPENDENCY too
ClausKlein Nov 4, 2024
904749c
Try to use clang-19 on CI
ClausKlein Nov 4, 2024
7815a35
Use workarounds to install llvm-19
ClausKlein Nov 4, 2024
24f66ec
Fix typos
ClausKlein Nov 4, 2024
009d01e
Merge branch 'main' into feature/prepare-cmake-workflow-presets
ClausKlein Nov 4, 2024
a82f7af
Add cmake workflow preset for windows CI
ClausKlein Nov 4, 2024
be46000
Use githup action to call vcvarsall.bat
ClausKlein Nov 4, 2024
3e4669f
change common.hpp to avoid warnings
dietmarkuehl Nov 5, 2024
abce05e
also disable forward_like from the compiler
dietmarkuehl Nov 5, 2024
64ea7c4
Cleanup Windows CI workflow file
ClausKlein Nov 5, 2024
e405584
Add clang-tidy rules
ClausKlein Nov 5, 2024
a1ebfba
Prepare using run-clang-tidy on all tests
ClausKlein Nov 5, 2024
0058009
Fix make format and codespell
ClausKlein Nov 6, 2024
d8fb010
Changes after review
ClausKlein Nov 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Checks:
'-*,
boost-*,
bugprone-*,
cert-*,
-cert-dcl58-cpp,
clang-analyzer-*,
concurrency-*,
-cppcoreguidelines-*,
-google-*,
hicpp-*,
misc-*,
-misc-const-correctness,
-misc-include-cleaner,
-misc-non-private-member-variables-in-classes,
-modernize-*,
-modernize-use-nodiscard,
performance-*,
portability-*,
-readability-*,
-readability-identifier-*,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-*-named-parameter,
-*-uppercase-literal-suffix,
-*-use-equals-default,
-*-braces-around-statements
'
HeaderFilterRegex: '.*/execution26/(include|src|example|tests)/.*\.(hpp)$'
WarningsAsErrors: 'clang*'
FormatStyle: file

CheckOptions:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read that correctly, the readability options are somewhat at odd with C++ standard library naming. However, the previous section seems to have disabled all of these for now.

Having a clang-tidy config is good - it will likely require some clean-up, probably discover bugs.

- { key: readability-identifier-naming.NamespaceCase, value: CamelCase }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.MemberCase, value: camelBack }
- { key: readability-identifier-naming.MemberPrefix, value: m_ }
- { key: readability-identifier-naming.StructCase, value: lower_case }
- { key: readability-identifier-naming.UnionCase, value: lower_case }
- { key: readability-identifier-naming.TypedefCase, value: lower_case }
- { key: readability-identifier-naming.TypedefSuffix, value: _type }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.ParameterCase, value: camelBack }
- { key: readability-identifier-naming.LocalVariableCase, value: camelBack }
- { key: readability-identifier-naming.ConstexprFunctionCase, value: camelBack }
- { key: readability-identifier-naming.ConstexprMethodCase, value: camelBack }
- { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE }
- { key: readability-identifier-naming.ClassConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.GlobalConstantPointerCase, value: UPPER_CASE }
- { key: readability-identifier-naming.LocalConstantPointerCase, value: UPPER_CASE }
- { key: readability-identifier-naming.ScopedEnumConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE }
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
builtin = clear,rare,en-GB_to_en-US,names,informal,code
check-hidden =
skip = ./.git,./build/*,./stagedir/*,./docs/html/*,./docs/latex/*,*.log,.*.swp,*~,*.bak,Makefile
quiet-level = 2
# ignore-words = .ignore-words
20 changes: 9 additions & 11 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -5,15 +5,15 @@ name: Linux Build

on:
push:
# branches: [ "main" ]
branches: ["main"]
paths:
- "include/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- ".github/workflows/linux.yml"
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- "include/**"
- "src/**"
@@ -30,19 +30,17 @@ jobs:
matrix:
# TODO: sanitizer: [debug, release, asan, usan, tsan]
sanitizer: [debug, release]
# TODO: compiler: [g++-14, clang++-18]
compiler: [g++-14]
compiler: [g++-14, clang++-19]

steps:
- uses: actions/checkout@v4

- name: Install static analyzers
run: >-
sudo apt-get install clang-tidy-18 ninja-build -y -q
sudo update-alternatives --install
/usr/bin/clang-tidy clang-tidy
/usr/bin/clang-tidy-18 140
- name: Install build tools
run: |
sudo apt-get install ninja-build -y -q
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19 all
- name: Linux ${{ matrix.compiler }} ${{ matrix.sanitizer }}
run: CXX=${{ matrix.compiler }} make ${{ matrix.sanitizer }}
21 changes: 15 additions & 6 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -5,15 +5,15 @@ name: Macos Build

on:
push:
# branches: [ "main" ]
branches: ["main"]
paths:
- "include/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- ".github/workflows/macos.yml"
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- "include/**"
- "src/**"
@@ -29,8 +29,8 @@ jobs:

matrix:
sanitizer: [debug, release]
# TODO: compiler: [g++-14, clang++-19]
compiler: [clang++-18]
# TODO: compiler: [g++, clang++-19]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TODO mentions clang++-19 instead of clang++-18 - otherwise it could go . Maybe it can still go.

compiler: [g++, clang++-18]

steps:
- uses: actions/checkout@v4
@@ -39,11 +39,20 @@ jobs:
# if: startsWith(matrix.compiler, 'clang')
uses: aminya/setup-cpp@v1
with:
# compiler: llvm-19
# TODO: compiler: llvm-19
# clangtidy: true
# cmake: true
ninja: true

- name: macos ${{ matrix.compiler }} ${{ matrix.sanitizer }}
- name: Install llvm-19
if: startsWith(matrix.compiler, 'clang')
run: |
brew install llvm@19 || echo ignored
- name: macos clang++-18 ${{ matrix.sanitizer }}
if: startsWith(matrix.compiler, 'clang')
run: CXX=$(brew --prefix llvm@18)/bin/clang++ make ${{ matrix.sanitizer }}

- name: macos g++ ${{ matrix.sanitizer }}
if: startsWith(matrix.compiler, 'g++')
run: CXX=${{ matrix.compiler }} make ${{ matrix.sanitizer }}
44 changes: 31 additions & 13 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -5,15 +5,15 @@ name: Windows Build

on:
push:
# branches: [ "main" ]
branches: ["main"]
paths:
- "include/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- ".github/workflows/windows.yml"
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- "include/**"
- "src/**"
@@ -24,20 +24,38 @@ on:
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false

matrix:
# TODO: sanitizer: [debug, release]
sanitizer: [release]
# TODO: compiler: [cl, clang-cl]
compiler: [cl]

steps:
- uses: actions/checkout@v4

- name: environment
run: cmake -E make_directory ${{github.workspace}}/build
# see https://github.com/marketplace/actions/enable-developer-command-prompt
- uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: 2022

# - name: build environment
# run: pip install -r requirements.txt

- name: cmake workflow ${{ matrix.sanitizer }}
shell: bash
run: |
cmake --version
ninja --version
CXX=${{ matrix.compiler }} cmake --workflow --preset ${{ matrix.sanitizer }}
- name: configure
working-directory: ${{github.workspace}}/build
run: cmake ${{github.workspace}}
# - name: configure
# run: CXX=${{ matrix.compiler }} cmake --preset ${{ matrix.sanitizer }}

- name: build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config Release --target all_verify_interface_header_sets install
# - name: build
# run: cmake --build --preset ${{ matrix.sanitizer }}

- name: ctest
working-directory: ${{github.workspace}}/build
run: ctest --build-config Release --output-on-failure
# - name: ctest
# run: ctest --preset ${{ matrix.sanitizer }}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -36,5 +36,10 @@ build
.vs
.vscode
stagedir

# In-source builds are not allowed
CMakeCache.txt
CMakeFiles/

docs/html
docs/latex
docs/latex
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -15,16 +15,12 @@ set(TARGET_ALIAS ${TARGET_LIBRARY}::${TARGET_LIBRARY})
set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)

include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 23)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed!")
endif()

if(NOT DEFINED CMAKE_PREFIX_PATH)
set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
endif()
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

add_subdirectory(src/beman/execution26)

@@ -53,3 +49,5 @@ install(
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake
DESTINATION ${INSTALL_CONFIGDIR}
)

include(CPack)
91 changes: 28 additions & 63 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,27 @@
{
"version": 6,
"configurePresets": [
{
"name": "root-config",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/stagedir",
"cacheVariables": {
"CMAKE_PREFIX_PATH": {
"type": "path",
"value": "${sourceDir}/stagedir"
},
"CMAKE_CXX_EXTENSIONS": false,
"CMAKE_CXX_STANDARD": "23",
"CMAKE_CXX_STANDARD_REQUIRED": true,
"CMAKE_EXPORT_COMPILE_COMMANDS": true
}
},
{
"name": "debug-base-unix",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined"
},
"condition": {
"type": "notEquals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "release-base-unix",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wno-shadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual -Woverloaded-virtual -Wformat=2 -Wno-error"
},
"condition": {
"type": "notEquals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "debug",
"displayName": "Debug Build",
"inherits": [
"root-config",
"debug-base-unix"
]
},
{
"name": "release",
"displayName": "Release Build",
"inherits": [
"root-config",
"release-base-unix"
]
}
"version": 9,
"cmakeMinimumRequired": {
"major": 3,
"minor": 30,
"patch": 0
},
Comment on lines +2 to +7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These recent versions prevent me from building on Debian 12 which installs cmake version 3.25.1. I'd think others would have the same problem.

"include": [
"cmake/CMake${hostSystemName}Presets.json"
],
"buildPresets": [
{
"name": "debug",
"configurePreset": "debug",
"configuration": "Debug",
"targets": [
"all",
"install"
]
},
{
"name": "release",
"configurePreset": "release",
"configuration": "Release",
"targets": [
"all",
"all_verify_interface_header_sets",
"install"
]
@@ -95,14 +42,28 @@
{
"name": "debug",
"inherits": "test_base",
"configuration": "Debug",
"configurePreset": "debug"
},
{
"name": "release",
"inherits": "test_base",
"configuration": "Release",
"configurePreset": "release"
}
],
"packagePresets": [
{
"name": "release",
"configurePreset": "release",
"configurations": [
"Release"
],
"generators": [
"TGZ"
]
}
],
"workflowPresets": [
{
"name": "debug",
@@ -135,6 +96,10 @@
{
"type": "test",
"name": "release"
},
{
"type": "package",
"name": "release"
}
]
}
Loading