Skip to content

Commit b5f6ac3

Browse files
committedJan 3, 2025
chore: refactore cmake presets
1 parent 02d1373 commit b5f6ac3

File tree

5 files changed

+158
-70
lines changed

5 files changed

+158
-70
lines changed
 

‎.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vcpkg"]
2+
path = vcpkg
3+
url = https://github.com/microsoft/vcpkg

‎CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_policy(SET CMP0167 NEW)
55
set(CMAKE_CXX_STANDARD 23)
66

77
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8-
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
8+
# set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
99

1010
# set include directories from this CMake file
1111
include_directories(${CMAKE_SOURCE_DIR})

‎CMakePresets.json

+153-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,155 @@
11
{
2-
"version": 2,
3-
"configurePresets": [
4-
{
5-
"name": "vcpkg",
6-
"generator": "Ninja",
7-
"binaryDir": "${sourceDir}/build",
8-
"cacheVariables": {
9-
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
10-
}
2+
"version": 6,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 23,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "vcpkg",
11+
"hidden": true,
12+
"generator": "Ninja",
13+
"binaryDir": "${sourceDir}/build",
14+
"description": "Configure the toolchain for vcpkg",
15+
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
16+
},
17+
{
18+
"name": "default",
19+
"hidden": false,
20+
"displayName": "Configure with default settings",
21+
"inherits": [
22+
"vcpkg"
23+
],
24+
"cacheVariables": {
25+
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/build/default/bin",
26+
"CMAKE_LIBRARY_OUTPUT_DIRECTORY": "${sourceDir}/build/default/lib",
27+
"CMAKE_ARCHIVE_OUTPUT_DIRECTORY": "${sourceDir}/build/default/lib"
28+
}
29+
},
30+
{
31+
"name": "debug",
32+
"displayName": "Configure Debug",
33+
"inherits": "default",
34+
"cacheVariables": {
35+
"CMAKE_BUILD_TYPE": "Debug",
36+
"CMAKE_CXX_FLAGS_DEBUG": "-fsanitize=address,undefined -fno-omit-frame-pointer -g",
37+
"CMAKE_EXE_LINKER_FLAGS_DEBUG": "-fsanitize=address,undefined",
38+
"CMAKE_SHARED_LINKER_FLAGS_DEBUG": "-fsanitize=address,undefined",
39+
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/build/debug/bin",
40+
"CMAKE_LIBRARY_OUTPUT_DIRECTORY": "${sourceDir}/build/debug/lib",
41+
"CMAKE_ARCHIVE_OUTPUT_DIRECTORY": "${sourceDir}/build/debug/lib"
42+
}
43+
},
44+
{
45+
"name": "release",
46+
"displayName": "Configure Release",
47+
"inherits": "default",
48+
"cacheVariables": {
49+
"CMAKE_BUILD_TYPE": "Release",
50+
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/build/release/bin",
51+
"CMAKE_LIBRARY_OUTPUT_DIRECTORY": "${sourceDir}/build/release/lib",
52+
"CMAKE_ARCHIVE_OUTPUT_DIRECTORY": "${sourceDir}/build/release/lib"
53+
}
54+
}
55+
],
56+
"buildPresets": [
57+
{
58+
"name": "default",
59+
"displayName": "Build Default",
60+
"configurePreset": "default"
61+
},
62+
{
63+
"name": "debug",
64+
"displayName": "Build Debug",
65+
"configurePreset": "debug"
66+
},
67+
{
68+
"name": "release",
69+
"displayName": "Build Release",
70+
"configurePreset": "release"
71+
}
72+
],
73+
"testPresets": [
74+
{
75+
"name": "default",
76+
"displayName": "Test with default settings",
77+
"configurePreset": "default",
78+
"output": {
79+
"outputOnFailure": true
80+
}
81+
},
82+
{
83+
"name": "debug",
84+
"displayName": "Test Debug",
85+
"configurePreset": "debug",
86+
"output": {
87+
"outputOnFailure": true
1188
}
12-
]
13-
}
89+
},
90+
{
91+
"name": "release",
92+
"displayName": "Test Release",
93+
"configurePreset": "release",
94+
"output": {
95+
"outputOnFailure": true
96+
}
97+
}
98+
],
99+
"workflowPresets": [
100+
{
101+
"name": "default",
102+
"displayName": "Workflow with default settings: configure, build and test",
103+
"steps": [
104+
{
105+
"type": "configure",
106+
"name": "default"
107+
},
108+
{
109+
"type": "build",
110+
"name": "default"
111+
},
112+
{
113+
"type": "test",
114+
"name": "default"
115+
}
116+
]
117+
},
118+
{
119+
"name": "debug",
120+
"displayName": "Workflow with debug settings: configure, build and test",
121+
"steps": [
122+
{
123+
"type": "configure",
124+
"name": "debug"
125+
},
126+
{
127+
"type": "build",
128+
"name": "debug"
129+
},
130+
{
131+
"type": "test",
132+
"name": "debug"
133+
}
134+
]
135+
},
136+
{
137+
"name": "release",
138+
"displayName": "Workflow with release settings: configure, build and test",
139+
"steps": [
140+
{
141+
"type": "configure",
142+
"name": "release"
143+
},
144+
{
145+
"type": "build",
146+
"name": "release"
147+
},
148+
{
149+
"type": "test",
150+
"name": "release"
151+
}
152+
]
153+
}
154+
]
155+
}

‎CMakeUserPresets.json

-58
This file was deleted.

‎vcpkg

Submodule vcpkg added at 1a66c32

0 commit comments

Comments
 (0)
Please sign in to comment.