Skip to content

Commit

Permalink
add CMakePresets.json and composable presets
Browse files Browse the repository at this point in the history
  • Loading branch information
jakoch committed Jul 26, 2024
1 parent 589714d commit 996a349
Show file tree
Hide file tree
Showing 7 changed files with 1,126 additions and 1 deletion.
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"cmake.buildDirectory": "${workspaceFolder}/out/${buildKitTriple}-${buildType}",
"files.associations": {
"utility": "cpp",
"algorithm": "cpp",
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- added containerization for development by using devcontainer
- added continuous integration on Github Actions
- added automatic dependency updates on the Github Action workflows using dependabot
- added CMakePresets using composable config presets
- with base presets in base.json
- buildDirectory is ${sourceDir}/out/build/${presetName}
- installDir is ${sourceDir}/out/install/${presetName}
- platform specific presets in linux.json and windows.json
- CI specific presets in ci.json
- added .clang-format and applied formatting
- added .clang-tidy and applied basic rule set
- added CPPLINT.cfg files to the source tree for configuration and exlusion of files from cpplint runs
Expand Down
285 changes: 285 additions & 0 deletions CMake/presets/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 0
},
"configurePresets": [
{
"name": "cmake-default-config",
"hidden": true,
"description": "CMake Configuration",
"cacheVariables": {
"CMAKE_COMPILE_WARNING_AS_ERROR": {
"type": "BOOL",
"value": "OFF"
},
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "ON"
},
"CMAKE_COLOR_DIAGNOSTICS": {
"type": "BOOL",
"value": "ON"
},
"CMAKE_VERBOSE_MAKEFILE": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "cmake-enable-warnings",
"hidden": true,
"description": "Enables CMake developer warnings for deprecated, uninitalized, unsed variables.",
"warnings": {
"deprecated": true,
"dev": true,
"uninitialized": true,
"unusedCli": true
}
},
{
"name": "build-folders-default",
"hidden": true,
"description": "Set the build and install directory.",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": {
"type": "FILEPATH",
"value": "${sourceDir}/out/install/${presetName}"
}
}
},
{
"name": "build-folders-ci",
"hidden": true,
"description": "Set the build and install directory for CI system.",
"binaryDir": "build",
"installDir": "install",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": {
"type": "FILEPATH",
"value": "install"
}
}
},
{
"name": "condition-is-windows",
"hidden": true,
"displayName": "Windows-only configuration",
"description": "This build is only available on Windows.",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "condition-is-linux",
"hidden": true,
"displayName": "Linux-only configuration",
"description": "This build is only available on Linux.",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "condition-is-ci",
"hidden": true,
"displayName": "CI-only configuration",
"description": "This build is only available on a Continuous Integration system.",
"condition": {
"type": "equals",
"lhs": "$env{CI}",
"rhs": "true"
}
},
{
"name": "generator-ninja-multi",
"hidden": true,
"description": "Set ninja multi-config as makefile generator.",
"generator": "Ninja Multi-Config",
"environment": {
"NINJA_STATUS": "%e [%f/%t] "
},
"cacheVariables": {
"CMAKE_MAKE_PROGRAM": {
"type": "FILEPATH",
"value": "ninja"
}
}
},
{
"name": "generator-ninja",
"hidden": true,
"description": "Set ninja as makefile generator.",
"generator": "Ninja",
"environment": {
"NINJA_STATUS": "%e [%f/%t] "
},
"cacheVariables": {
"CMAKE_MAKE_PROGRAM": {
"type": "FILEPATH",
"value": "ninja"
}
}
},
{
"name": "vcpkg-default-config",
"hidden": true,
"description": "Setup vcpkg on windows: toolchain, package install dir, verbosity.",
"cacheVariables": {
"VCPKG_VERBOSE": {
"type": "BOOL",
"value": "ON"
},
"CMAKE_TOOLCHAIN_FILE": {
"type": "FILEPATH",
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
"VCPKG_INSTALLED_DIR": {
"type": "FILEPATH",
"value": "${sourceDir}/vcpkg_installed/"
},
"X_VCPKG_APPLOCAL_DEPS_INSTALL": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "sanitizer-address",
"hidden": true,
"description": "Enable address sanitizer. Requires clang or recent gcc.",
"cacheVariables": {
"SANITIZE_ADDRESS": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "sanitizer-thread",
"hidden": true,
"description": "Enable thread sanitizer. Requires clang.",
"cacheVariables": {
"SANITIZE_THREAD": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "sanitizer-memory",
"hidden": true,
"description": "Enable memory sanitizer. Requires clang.",
"cacheVariables": {
"SANITIZE_MEMORY": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "sanitizer-undefined-behavior",
"hidden": true,
"description": "Enable undefined behavior sanitizer. Requires clang.",
"cacheVariables": {
"SANITIZE_UB": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "static-analysis",
"hidden": true,
"description": "Enable static analysis.",
"cacheVariables": {
"STATIC_ANALYSIS": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "trace-time",
"hidden": true,
"description": "Trace time spent in each compiler pass (only Clang) (aras-p/ClangBuildAnalyzer).",
"cacheVariables": {
"CMAKE_CXX_FLAGS": "-ftime-trace"
}
},
{
"name": "use-sccache",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "use-ccache",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "build-type-release",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "build-type-rdi",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "build-type-debug",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "use-linker-lld",
"hidden": true,
"cacheVariables": {
"CMAKE_LINKER_TYPE": "LLD"
}
},
{
"name": "use-linker-mold",
"hidden": true,
"cacheVariables": {
"CMAKE_LINKER_TYPE": "MOLD"
}
},
{
"name": "use-linker-ld",
"hidden": true,
"cacheVariables": {
"CMAKE_LINKER_TYPE": "LD"
}
}
]
}
Loading

0 comments on commit 996a349

Please sign in to comment.