Skip to content

chore: add CMake presets #1181

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

Merged
merged 3 commits into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 17 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
std: ["14", "17", "20","23"]
std: ["14", "17", "20", "23"]
precompile: ["ON", "OFF"]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -61,6 +61,16 @@ jobs:
files: build/coverage.info
functionalities: fixes

preset:
name: Preset
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run CMake Workflow
run: cmake --workflow default


catch2-3:
name: Catch 2 3.x
runs-on: macos-latest
Expand Down Expand Up @@ -92,14 +102,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install requirements
run: apt-get update && apt-get install -y ninja-build

- name: Configure
run: >
cmake -S . -B build -DCMAKE_CXX_STANDARD=20
-DCMAKE_CXX_CLANG_TIDY="$(which
clang-tidy);--use-color;--warnings-as-errors=*"
run: cmake --preset tidy

- name: Build
run: cmake --build build -j4 -- --keep-going
run: cmake --build --preset tidy

cuda11-build:
name: CUDA 11 build only
Expand Down Expand Up @@ -396,7 +406,7 @@ jobs:
cmake-version: "3.31"
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
if: success() || failure()

- name: Check CMake 4.0
uses: ./.github/actions/quick_cmake
with:
Expand Down
65 changes: 65 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"version": 6,
"configurePresets": [
{
"name": "default",
"displayName": "Default",
"binaryDir": "build",
"generator": "Ninja",
"errors": {
"dev": true,
"deprecated": true
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CLI11_WARNINGS_AS_ERRORS": true,
"CMAKE_COLOR_DIAGNOSTICS": true
}
},
{
"name": "tidy",
"displayName": "Clang-tidy",
"inherits": "default",
"binaryDir": "build-tidy",
"cacheVariables": {
"CMAKE_CXX_CLANG_TIDY": "clang-tidy;--use-color;--warnings-as-errors=*",
"CMAKE_CXX_STANDARD": "17"
}
}
],
"buildPresets": [
{
"name": "default",
"displayName": "Default Build",
"configurePreset": "default"
},
{
"name": "tidy",
"displayName": "Clang-tidy Build",
"configurePreset": "tidy",
"nativeToolOptions": ["-k0"]
}
],
"testPresets": [
{
"name": "default",
"displayName": "Default",
"configurePreset": "default",
"output": {
"outputOnFailure": true
}
}
],
"workflowPresets": [
{
"name": "default",
"displayName": "Default Workflow",
"steps": [
{ "type": "configure", "name": "default" },
{ "type": "build", "name": "default" },
{ "type": "test", "name": "default" }
]
}
]
}
Loading