Skip to content

Commit c3d7043

Browse files
committed
Restucture cmake presets
1 parent 7bf4c3e commit c3d7043

File tree

6 files changed

+222
-52
lines changed

6 files changed

+222
-52
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
build*/
33
_build*/
44
cmake-build*/
5+
/stagedir/
56

67
# CMake
78
CMakeUserPresets.json

CMakeDarwinPresets.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 4,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 23,
6+
"patch": 0
7+
},
8+
"include": [
9+
"CMakeLinuxPresets.json"
10+
]
11+
}

CMakeGenericPresets.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"version": 9,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 30,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "default",
11+
"description": "Base preset for library developers",
12+
"binaryDir": "${sourceDir}/build",
13+
"hidden": true,
14+
"cacheVariables": {
15+
"CMAKE_BUILD_TYPE": "Debug",
16+
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
17+
"MYLIB_SHARED_LIBS": true,
18+
"MYLIB_BUILD_TESTS": true,
19+
"MYLIB_BUILD_EXAMPLES": true
20+
}
21+
},
22+
{
23+
"name": "cmake-pedantic",
24+
"hidden": true,
25+
"inherits": "default",
26+
"warnings": {
27+
"dev": true,
28+
"deprecated": true,
29+
"uninitialized": true,
30+
"unusedCli": true,
31+
"systemVars": false
32+
},
33+
"errors": {
34+
"dev": true,
35+
"deprecated": true
36+
}
37+
},
38+
{
39+
"name": "dev-mode",
40+
"hidden": true,
41+
"inherits": "cmake-pedantic",
42+
"installDir": "${sourceDir}/stagedir",
43+
"cacheVariables": {
44+
"CMAKE_PREFIX_PATH": {
45+
"type": "path",
46+
"value": "${sourceDir}/stagedir"
47+
},
48+
"BUILD_SHARED_LIBS": false,
49+
"BUILD_TESTING": true
50+
}
51+
},
52+
{
53+
"name": "cppcheck",
54+
"hidden": true,
55+
"cacheVariables": {
56+
"CMAKE_CXX_CPPCHECK": "cppcheck;--inline-suppr"
57+
}
58+
},
59+
{
60+
"name": "clang-tidy",
61+
"hidden": true,
62+
"cacheVariables": {
63+
"CMAKE_CXX_CLANG_TIDY": "clang-tidy;--header-filter=^${sourceDir}/"
64+
}
65+
},
66+
{
67+
"name": "ci-std",
68+
"description": "This preset makes sure the project actually builds with at least the specified standard",
69+
"hidden": true,
70+
"cacheVariables": {
71+
"CMAKE_CXX_EXTENSIONS": false,
72+
"CMAKE_CXX_STANDARD": "20",
73+
"CMAKE_CXX_STANDARD_REQUIRED": true
74+
}
75+
},
76+
{
77+
"name": "ci-build",
78+
"binaryDir": "${sourceDir}/build",
79+
"generator": "Ninja",
80+
"hidden": true,
81+
"cacheVariables": {
82+
"CMAKE_BUILD_TYPE": "Release"
83+
}
84+
}
85+
]
86+
}

CMakeLinuxPresets.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"version": 9,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 30,
6+
"patch": 0
7+
},
8+
"include": [
9+
"CMakeGenericPresets.json"
10+
],
11+
"configurePresets": [
12+
{
13+
"name": "Release",
14+
"description": "Possix preset for library developers",
15+
"inherits": [
16+
"ci-build",
17+
"ci-std"
18+
],
19+
"cacheVariables": {
20+
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual -Wnull-dereference -Woverloaded-virtual -Wformat=2 -Werror"
21+
},
22+
"condition": {
23+
"type": "notEquals",
24+
"lhs": "${hostSystemName}",
25+
"rhs": "Windows"
26+
}
27+
},
28+
{
29+
"name": "Debug",
30+
"description": "Possix preset for library developers",
31+
"inherits": [
32+
"ci-std",
33+
"dev-mode",
34+
"clang-tidy"
35+
]
36+
}
37+
]
38+
}

CMakePresets.json

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,42 @@
11
{
2-
"version": 6,
2+
"version": 9,
33
"cmakeMinimumRequired": {
44
"major": 3,
5-
"minor": 25,
5+
"minor": 30,
66
"patch": 0
77
},
8-
"configurePresets": [
9-
{
10-
"name": "dev",
11-
"description": "Base preset for library developers",
12-
"binaryDir": "${sourceDir}/build",
13-
"hidden": true,
14-
"generator": "Ninja",
15-
"cacheVariables": {
16-
"CMAKE_BUILD_TYPE": "Release",
17-
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
18-
"MYLIB_SHARED_LIBS": true,
19-
"MYLIB_BUILD_TESTS": true,
20-
"MYLIB_BUILD_EXAMPLES": true
21-
}
22-
},
23-
{
24-
"name": "dev-win",
25-
"description": "Windows preset for library developers",
26-
"hidden": false,
27-
"inherits": [
28-
"dev"
29-
],
30-
"cacheVariables": {
31-
"CMAKE_CXX_FLAGS": "/W4 /EHsc /w14242 /w14254 /w14263 /w14265 /w14287 /w14289 /w14296 /w14311 /w14545 /w14546 /w14547 /w14549 /w14555 /w14640 /w14826 /w14928 /WX"
32-
},
33-
"condition": {
34-
"type": "equals",
35-
"lhs": "${hostSystemName}",
36-
"rhs": "Windows"
37-
}
38-
},
39-
{
40-
"name": "Release",
41-
"description": "Linux preset for library developers",
42-
"hidden": false,
43-
"inherits": [
44-
"dev"
45-
],
46-
"cacheVariables": {
47-
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual -Wnull-dereference -Woverloaded-virtual -Wformat=2 -Werror"
48-
},
49-
"condition": {
50-
"type": "notEquals",
51-
"lhs": "${hostSystemName}",
52-
"rhs": "Windows"
53-
}
54-
}
8+
"include": [
9+
"CMake${hostSystemName}Presets.json"
5510
],
5611
"buildPresets": [
12+
{
13+
"name": "Debug",
14+
"configurePreset": "Debug"
15+
},
5716
{
5817
"name": "Release",
5918
"configurePreset": "Release"
6019
},
6120
{
62-
"name": "install",
63-
"configurePreset": "Release",
21+
"name": "install-Debug",
22+
"configurePreset": "Debug",
6423
"targets": [
6524
"install"
6625
]
6726
}
6827
],
6928
"testPresets": [
29+
{
30+
"name": "Debug",
31+
"configurePreset": "Debug",
32+
"output": {
33+
"outputOnFailure": true
34+
},
35+
"execution": {
36+
"noTestsAction": "ignore",
37+
"stopOnFailure": true
38+
}
39+
},
7040
{
7141
"name": "Release",
7242
"configurePreset": "Release",
@@ -75,11 +45,18 @@
7545
},
7646
"execution": {
7747
"noTestsAction": "error",
78-
"stopOnFailure": true
48+
"stopOnFailure": false
7949
}
8050
}
8151
],
8252
"packagePresets": [
53+
{
54+
"name": "Debug",
55+
"configurePreset": "Debug",
56+
"generators": [
57+
"TGZ"
58+
]
59+
},
8360
{
8461
"name": "Release",
8562
"configurePreset": "Release",
@@ -89,6 +66,27 @@
8966
}
9067
],
9168
"workflowPresets": [
69+
{
70+
"name": "Debug",
71+
"steps": [
72+
{
73+
"type": "configure",
74+
"name": "Debug"
75+
},
76+
{
77+
"type": "build",
78+
"name": "Debug"
79+
},
80+
{
81+
"type": "test",
82+
"name": "Debug"
83+
},
84+
{
85+
"type": "build",
86+
"name": "install-Debug"
87+
}
88+
]
89+
},
9290
{
9391
"name": "Release",
9492
"steps": [

CMakeWindowsPresets.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"version": 9,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 30,
6+
"patch": 0
7+
},
8+
"include": [
9+
"CMakeGenericPresets.json"
10+
],
11+
"configurePresets": [
12+
{
13+
"name": "Release",
14+
"description": "Windows preset for library developers",
15+
"inherits": [
16+
"ci-build",
17+
"ci-std"
18+
],
19+
"cacheVariables": {
20+
"CMAKE_CXX_FLAGS": "/W4 /EHsc /w14242 /w14254 /w14263 /w14265 /w14287 /w14289 /w14296 /w14311 /w14545 /w14546 /w14547 /w14549 /w14555 /w14640 /w14826 /w14928 /WX"
21+
},
22+
"condition": {
23+
"type": "equals",
24+
"lhs": "${hostSystemName}",
25+
"rhs": "Windows"
26+
}
27+
},
28+
{
29+
"name": "Debug",
30+
"description": "Windows preset for library developers",
31+
"inherits": [
32+
"ci-std",
33+
"dev-mode"
34+
}
35+
]
36+
}

0 commit comments

Comments
 (0)