Skip to content

Commit

Permalink
build, gh ci: use CMake presets
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Jun 18, 2024
1 parent 8f38c62 commit bf31d36
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 34 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
type: [Debug, RelWithDebInfo]
preset: [debug, release]
steps:
- name: Clone
uses: actions/checkout@v4
Expand All @@ -19,16 +19,16 @@ jobs:
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Configure ASAN
run: cmake . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DSAN_ADDR=1
run: cmake --preset=${{ matrix.preset }}-asan -B asan
- name: Build ASAN
run: cmake --build .
run: cmake --build asan
- name: Test ASAN
run: ctest --output-on-failure
run: ctest --test-dir asan --output-on-failure
env:
UBSAN_OPTIONS: halt_on_error=1
- name: Configure TSAN
run: cmake . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DSAN_ADDR=0 -DSAN_THREAD=1
run: cmake --preset=${{ matrix.preset }}-tsan -B tsan
- name: Build TSAN
run: cmake --build .
run: cmake --build tsan
- name: Test TSAN
run: ctest -L tsan --output-on-failure
run: ctest --test-dir tsan -L tsan --output-on-failure
92 changes: 92 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"version": 3,
"configurePresets": [
{
"name": "base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true
}
},
{
"name": "base-debug",
"hidden": true,
"inherits": "base",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }
},
{
"name": "base-release",
"hidden": true,
"inherits": "base",
"cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" }
},
{
"name": "static",
"hidden": true,
"cacheVariables": { "BUILD_SHARED_LIBS": "OFF" }
},
{
"name": "asan",
"hidden": true,
"cacheVariables": { "SAN_ADDR": true }
},
{
"name": "ubsan",
"hidden": true,
"cacheVariables": { "SAN_UB": true }
},
{
"name": "lsan",
"hidden": true,
"cacheVariables": { "SAN_LEAK": true }
},
{
"name": "tsan",
"hidden": true,
"cacheVariables": { "SAN_THREAD": true }
},

{
"name": "debug",
"inherits": "base-debug"
},
{
"name": "release",
"inherits": "base-release"
},

{
"name": "debug-static",
"inherits": ["base-debug", "static"]
},
{
"name": "release-static",
"inherits": ["base-release", "static"]
},

{
"name": "debug-asan",
"inherits": ["base-debug", "asan"]
},
{
"name": "release-asan",
"inherits": ["base-release", "asan"]
},
{
"name": "debug-tsan",
"inherits": ["base-debug", "tsan"]
},
{
"name": "release-tsan",
"inherits": ["base-release", "tsan"]
},
{
"name": "debug-aublsan",
"description": "combining addr, ub and leak sanitizers is widely supported on many platforms",
"inherits": ["base-debug", "asan", "ubsan", "lsan"]
}
]
}
27 changes: 0 additions & 27 deletions CMakeSettings.json

This file was deleted.

0 comments on commit bf31d36

Please sign in to comment.