Skip to content

Commit 29d42c0

Browse files
committed
Update CMake presets and CI script
1 parent 55f1763 commit 29d42c0

File tree

5 files changed

+156
-47
lines changed

5 files changed

+156
-47
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
- name: init
3131
run: uname -m; sudo apt install -yqq ninja-build
3232
- name: configure
33-
run: export CXX=g++-14; cmake -S . --preset=default -B build
33+
run: cmake -S . --preset=ninja-gcc -B build -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14
3434
- name: build debug
35-
run: cmake --build build --config=Debug
35+
run: cmake --build build --config=Debug -- -v
3636
- name: build release
37-
run: cmake --build build --config=Release
37+
run: cmake --build build --config=Release -- -v
3838
- name: test debug
3939
run: cd build && ctest -V -C Debug
4040
- name: test release
@@ -52,9 +52,9 @@ jobs:
5252
- name: configure
5353
run: cmake -S . --preset=ninja-clang -B build
5454
- name: build debug
55-
run: cmake --build build --config=Debug
55+
run: cmake --build build --config=Debug -- -v
5656
- name: build release
57-
run: cmake --build build --config=Release
57+
run: cmake --build build --config=Release -- -v
5858
- name: test debug
5959
run: cd build && ctest -V -C Debug
6060
- name: test release
@@ -66,11 +66,11 @@ jobs:
6666
- name: init
6767
run: uname -m
6868
- name: configure
69-
run: export CXX=g++-14; cmake -S . --preset=default -B build
69+
run: cmake -S . --preset=ninja-gcc -B build -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14
7070
- name: build debug
71-
run: cmake --build build --config=Debug
71+
run: cmake --build build --config=Debug -- -v
7272
- name: build release
73-
run: cmake --build build --config=Release
73+
run: cmake --build build --config=Release -- -v
7474
- name: test debug
7575
run: cd build && ctest -V -C Debug
7676
- name: test release
@@ -88,9 +88,9 @@ jobs:
8888
- name: configure
8989
run: cmake -S . --preset=ninja-clang -B build
9090
- name: build debug
91-
run: cmake --build build --config=Debug
91+
run: cmake --build build --config=Debug -- -v
9292
- name: build release
93-
run: cmake --build build --config=Release
93+
run: cmake --build build --config=Release -- -v
9494
- name: test debug
9595
run: cd build && ctest -V -C Debug
9696
- name: test release
@@ -118,9 +118,9 @@ jobs:
118118
- name: configure
119119
run: cmake -S . --preset=ninja-clang -B clang
120120
- name: build debug
121-
run: cmake --build clang --config=Debug
121+
run: cmake --build clang --config=Debug -- -v
122122
- name: build release
123-
run: cmake --build clang --config=Release
123+
run: cmake --build clang --config=Release -- -v
124124
- name: test debug
125125
run: cd clang && ctest -V -C Debug
126126
- name: test release

CMakeLists.txt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,6 @@ option(CAPO_MA_DEBUG_OUTPUT "Enable miniaudio debug output" ${capo_is_top_level}
1616

1717
add_subdirectory(ext)
1818

19-
add_library(capo-warnings INTERFACE)
20-
add_library(capo::warnings ALIAS capo-warnings)
21-
22-
if(capo_is_top_level)
23-
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
24-
target_compile_options(capo-warnings INTERFACE
25-
-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type
26-
)
27-
endif()
28-
29-
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
30-
target_compile_options(capo-warnings INTERFACE
31-
$<$<NOT:$<CONFIG:Debug>>:-Werror>
32-
)
33-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
34-
target_compile_options(capo-warnings
35-
$<$<NOT:$<CONFIG:Debug>>:/WX>
36-
)
37-
endif()
38-
endif()
39-
4019
if(capo_is_top_level)
4120
configure_file(Doxyfile.in "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile" @ONLY)
4221
endif()

CMakePresets.json

Lines changed: 144 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,131 @@
11
{
2-
"version": 2,
2+
"version": 5,
33
"cmakeMinimumRequired": {
44
"major": 3,
5-
"minor": 20,
5+
"minor": 24,
66
"patch": 0
77
},
88
"configurePresets": [
99
{
1010
"name": "default",
11-
"description": "Build configuration using Ninja Multi-config",
11+
"displayName": "Default Config",
12+
"description": "Base configuration using Ninja Multi-config",
1213
"generator": "Ninja Multi-Config",
1314
"binaryDir": "${sourceDir}/out/default",
1415
"cacheVariables": {
1516
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
1617
}
1718
},
1819
{
19-
"name": "ninja-clang",
20-
"description": "Build configuration using Ninja Multi-config / clang",
20+
"name": "base-gcc",
21+
"hidden": true,
22+
"inherits": "default",
23+
"cacheVariables": {
24+
"CMAKE_C_COMPILER": "gcc",
25+
"CMAKE_CXX_COMPILER": "g++"
26+
}
27+
},
28+
{
29+
"name": "base-clang",
30+
"hidden": true,
2131
"inherits": "default",
22-
"binaryDir": "${sourceDir}/out/clang",
2332
"cacheVariables": {
2433
"CMAKE_C_COMPILER": "clang",
2534
"CMAKE_CXX_COMPILER": "clang++"
2635
}
2736
},
37+
{
38+
"name": "base-msvc",
39+
"hidden": true,
40+
"inherits": "default",
41+
"cacheVariables": {
42+
"CMAKE_C_COMPILER": "cl",
43+
"CMAKE_CXX_COMPILER": "cl"
44+
}
45+
},
46+
{
47+
"name": "ninja-gcc",
48+
"displayName": "Ninja GCC",
49+
"description": "Build configuration using Ninja Multi-config / GCC",
50+
"inherits": "base-gcc",
51+
"binaryDir": "${sourceDir}/out/gcc",
52+
"cacheVariables": {
53+
"CMAKE_CXX_FLAGS_DEBUG_INIT": "-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type",
54+
"CMAKE_CXX_FLAGS_INIT": "-Wall -Wextra -Wpedantic -Wconversion -Werror"
55+
}
56+
},
57+
{
58+
"name": "ninja-clang",
59+
"displayName": "Ninja Clang",
60+
"description": "Build configuration using Ninja Multi-config / Clang",
61+
"inherits": "base-clang",
62+
"binaryDir": "${sourceDir}/out/clang",
63+
"cacheVariables": {
64+
"CMAKE_CXX_FLAGS_DEBUG_INIT": "-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type",
65+
"CMAKE_CXX_FLAGS_INIT": "-Wall -Wextra -Wpedantic -Wconversion -Werror"
66+
}
67+
},
68+
{
69+
"name": "ninja-msvc",
70+
"displayName": "Ninja MSVC",
71+
"description": "Build configuration using Ninja Multi-config / MSVC",
72+
"inherits": "base-msvc",
73+
"binaryDir": "${sourceDir}/out/msvc",
74+
"cacheVariables": {
75+
"CMAKE_CXX_FLAGS_INIT": "/WX"
76+
}
77+
},
2878
{
2979
"name": "ninja-ubsan",
80+
"displayName": "Ninja UBSan",
3081
"description": "UBSan build configuration using Ninja Multi-config",
3182
"inherits": "default",
3283
"binaryDir": "${sourceDir}/out/ubsan",
3384
"cacheVariables": {
34-
"CMAKE_C_FLAGS": "-fsanitize=undefined",
35-
"CMAKE_CXX_FLAGS": "-fsanitize=undefined"
85+
"CMAKE_CXX_FLAGS_DEBUG_INIT": "-fsanitize=undefined -Wall -Wextra -Wpedantic -Wconversion -Werror=return-type",
86+
"CMAKE_CXX_FLAGS_INIT": "-fsanitize=undefined -Wall -Wextra -Wpedantic -Wconversion -Werror"
3687
}
3788
},
3889
{
3990
"name": "ninja-asan",
91+
"displayName": "Ninja ASan",
4092
"description": "ASan build configuration using Ninja Multi-config",
4193
"inherits": "default",
4294
"binaryDir": "${sourceDir}/out/asan",
4395
"cacheVariables": {
44-
"CMAKE_C_FLAGS": "-fsanitize=address",
45-
"CMAKE_CXX_FLAGS": "-fsanitize=address"
96+
"CMAKE_CXX_FLAGS_DEBUG_INIT": "-fsanitize=address -Wall -Wextra -Wpedantic -Wconversion -Werror=return-type",
97+
"CMAKE_CXX_FLAGS_INIT": "-fsanitize=address -Wall -Wextra -Wpedantic -Wconversion -Werror"
98+
}
99+
},
100+
{
101+
"name": "ninja-msvc-asan",
102+
"displayName": "Ninja MSVC ASan",
103+
"description": "ASan build configuration using Ninja Multi-config",
104+
"inherits": "base-msvc",
105+
"binaryDir": "${sourceDir}/out/asan",
106+
"cacheVariables": {
107+
"CMAKE_CXX_FLAGS_INIT": "-fsanitize=address"
46108
}
47109
},
48110
{
49111
"name": "ninja-tsan",
112+
"displayName": "Ninja TSan",
50113
"description": "TSan build configuration using Ninja Multi-config",
51114
"inherits": "default",
52115
"binaryDir": "${sourceDir}/out/tsan",
53116
"cacheVariables": {
54-
"CMAKE_C_FLAGS": "-fsanitize=thread",
55-
"CMAKE_CXX_FLAGS": "-fsanitize=thread"
117+
"CMAKE_CXX_FLAGS_INIT": "-fsanitize=thread -Wall -Wextra -Wpedantic -Wconversion -Werror=return-type"
56118
}
57119
},
58120
{
59121
"name": "vs22",
122+
"displayName": "Visual Studio 2022",
60123
"description": "Build configuration using Visual Studio 17 (2022)",
61124
"generator": "Visual Studio 17 2022",
62125
"binaryDir": "${sourceDir}/out/vs",
126+
"cacheVariables": {
127+
"CMAKE_CXX_FLAGS_INIT": "/WX"
128+
},
63129
"architecture": {
64130
"value": "x64",
65131
"strategy": "external"
@@ -82,6 +148,36 @@
82148
"configurePreset": "default",
83149
"configuration": "RelWithDebInfo"
84150
},
151+
{
152+
"name": "GCC Debug",
153+
"configurePreset": "ninja-gcc",
154+
"configuration": "Debug"
155+
},
156+
{
157+
"name": "GCC RelWithDebInfo",
158+
"configurePreset": "ninja-gcc",
159+
"configuration": "RelWithDebInfo"
160+
},
161+
{
162+
"name": "Clang Debug",
163+
"configurePreset": "ninja-clang",
164+
"configuration": "Debug"
165+
},
166+
{
167+
"name": "Clang RelWithDebInfo",
168+
"configurePreset": "ninja-clang",
169+
"configuration": "RelWithDebInfo"
170+
},
171+
{
172+
"name": "MSVC Debug",
173+
"configurePreset": "ninja-msvc",
174+
"configuration": "Debug"
175+
},
176+
{
177+
"name": "MSVC Release",
178+
"configurePreset": "ninja-msvc",
179+
"configuration": "Release"
180+
},
85181
{
86182
"name": "UBSan Debug",
87183
"configurePreset": "ninja-ubsan",
@@ -107,6 +203,42 @@
107203
"configuration": "RelWithDebInfo",
108204
"inheritConfigureEnvironment": true
109205
},
206+
{
207+
"name": "GCC Debug",
208+
"configurePreset": "ninja-gcc",
209+
"configuration": "Debug",
210+
"inheritConfigureEnvironment": true
211+
},
212+
{
213+
"name": "GCC RelWithDebInfo",
214+
"configurePreset": "ninja-gcc",
215+
"configuration": "RelWithDebInfo",
216+
"inheritConfigureEnvironment": true
217+
},
218+
{
219+
"name": "Clang Debug",
220+
"configurePreset": "ninja-clang",
221+
"configuration": "Debug",
222+
"inheritConfigureEnvironment": true
223+
},
224+
{
225+
"name": "Clang RelWithDebInfo",
226+
"configurePreset": "ninja-clang",
227+
"configuration": "RelWithDebInfo",
228+
"inheritConfigureEnvironment": true
229+
},
230+
{
231+
"name": "MSVC Debug",
232+
"configurePreset": "ninja-msvc",
233+
"configuration": "Debug",
234+
"inheritConfigureEnvironment": true
235+
},
236+
{
237+
"name": "MSVC Release",
238+
"configurePreset": "ninja-msvc",
239+
"configuration": "Release",
240+
"inheritConfigureEnvironment": true
241+
},
110242
{
111243
"name": "UBSan Debug",
112244
"configurePreset": "ninja-ubsan",

examples/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ function(add_example ID)
77

88
target_link_libraries(capo-${ID} PRIVATE
99
capo::capo
10-
capo::warnings
1110
)
1211

1312
target_sources(capo-${ID} PRIVATE

lib/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ add_library(capo::capo ALIAS ${PROJECT_NAME})
99

1010
target_link_libraries(${PROJECT_NAME} PRIVATE
1111
miniaudio::miniaudio
12-
capo::warnings
1312
)
1413

1514
file(GLOB_RECURSE headers LIST_DIRECTORIES false "include/capo/*.hpp")

0 commit comments

Comments
 (0)