chore: add CMake presets (#1181)

Add two presets (default and tidy).

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Henry Schreiner
2025-07-25 10:05:37 -04:00
committed by GitHub
parent 2a59b281f0
commit e351ddd522
2 changed files with 82 additions and 7 deletions

View File

@@ -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
@@ -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
@@ -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
@@ -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:

65
CMakePresets.json Normal file
View File

@@ -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" }
]
}
]
}