Skip to content

Commit

Permalink
perf: simplify cmake presets (#15)
Browse files Browse the repository at this point in the history
Signed-off-by: l.feng <[email protected]>
  • Loading branch information
msclock authored Dec 18, 2024
1 parent 2dcc4b5 commit eb6f43c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 75 deletions.
80 changes: 43 additions & 37 deletions template/cmake/presets/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,68 @@
"toolchains/vcpkg.json"
],
"configurePresets": [
{
"name": "base-common",
"hidden":true,
"binaryDir":"${sourceDir}/out/build/${presetName}",
"installDir":"${sourceDir}/out/install/${presetName}",
"cacheVariables":{
"CMAKE_COMPILE_WARNING_AS_ERROR":false,
"CMAKE_EXPORT_COMPILE_COMMANDS":true,
"CMAKE_VERBOSE_MAKEFILE":"FALSE"
}
},
{
"name": "base",
"hidden": true,
"inherits": [
"base-common",
"ninja",
"vcpkg"
],
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CMAKE_COMPILE_WARNING_AS_ERROR": false,
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_VERBOSE_MAKEFILE": "FALSE"
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "base-config",
"hidden": true,
"inherits": [
"base-common",
"ninja-config",
"vcpkg"
],
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CMAKE_COMPILE_WARNING_AS_ERROR": false,
"CMAKE_VERBOSE_MAKEFILE": "FALSE"
}
]
}
],
"buildPresets": [
{
"name": "base",
"hidden": true,
"inherits": "ninja",
"configurePreset": "base"
},
{
"name": "base-config-debug",
"hidden": true,
"configurePreset": "base-config",
"configuration": "Debug"
},
{
"name": "base-config-relwithdebinfo",
"hidden": true,
"inherits": "ninja-config-relwithdebinfo",
"configurePreset": "base-config"
"configurePreset": "base-config",
"configuration": "RelWithDebInfo"
},
{
"name": "base-config-debug",
"name": "base-config-release",
"hidden": true,
"inherits": "ninja-config-debug",
"configurePreset": "base-config"
"configurePreset": "base-config",
"configuration": "Release"
}
],
"testPresets": [
{
"name": "base",
"hidden": true,
"inherits": "ninja",
"configurePreset": "base",
"output": {
"outputOnFailure": true
Expand All @@ -74,28 +79,29 @@
{
"name": "base-config-relwithdebinfo",
"hidden": true,
"inherits": "ninja-config-relwithdebinfo",
"inherits": [
"base"
],
"configurePreset": "base-config",
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
"configuration": "RelWithDebInfo"
},
{
"name": "base-config-debug",
"hidden": true,
"inherits": "ninja-config-debug",
"inherits": [
"base"
],
"configurePreset": "base-config",
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
"configuration": "Debug"
},
{
"name": "base-config-release",
"hidden": true,
"inherits": [
"base"
],
"configurePreset": "base-config",
"configuration": "Release"
}
]
}
10 changes: 10 additions & 0 deletions template/cmake/presets/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"name": "default-config-debug",
"inherits": "base-config-debug",
"configurePreset": "default-config"
},
{
"name": "default-config-release",
"inherits": "base-config-release",
"configurePreset": "default-config"
}
],
"testPresets": [
Expand All @@ -49,6 +54,11 @@
"name": "default-config-debug",
"inherits": "base-config-debug",
"configurePreset": "default-config"
},
{
"name": "default-config-release",
"inherits": "base-config-release",
"configurePreset": "default-config"
}
]
}
38 changes: 0 additions & 38 deletions template/cmake/presets/generators/ninja.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,5 @@
"hidden": true,
"generator": "Ninja Multi-Config"
}
],
"buildPresets": [
{
"name": "ninja",
"hidden": true,
"configurePreset": "ninja"
},
{
"name": "ninja-config-relwithdebinfo",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "RelWithDebInfo"
},
{
"name": "ninja-config-debug",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "Debug"
}
],
"testPresets": [
{
"name": "ninja",
"hidden": true,
"configurePreset": "ninja"
},
{
"name": "ninja-config-relwithdebinfo",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "RelWithDebInfo"
},
{
"name": "ninja-config-debug",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "Debug"
}
]
}

0 comments on commit eb6f43c

Please sign in to comment.