Add CMake presets
This commit is contained in:
parent
e50aefc7d1
commit
6a038d2150
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,6 +23,8 @@
|
|||||||
/tests/parse_*_fuzzer
|
/tests/parse_*_fuzzer
|
||||||
/tests/corpus_*
|
/tests/corpus_*
|
||||||
|
|
||||||
|
CMakeUserPresets.json
|
||||||
|
|
||||||
/docs/mkdocs/docs/examples/
|
/docs/mkdocs/docs/examples/
|
||||||
/docs/mkdocs/docs/__pycache__/
|
/docs/mkdocs/docs/__pycache__/
|
||||||
/docs/mkdocs/site/
|
/docs/mkdocs/site/
|
||||||
|
|||||||
114
CMakePresets.json
Normal file
114
CMakePresets.json
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
{
|
||||||
|
"version": 4,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "common",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_PROJECT_nlohmann_json_INCLUDE": "${sourceDir}/cmake/preset-wflags.cmake",
|
||||||
|
"JSON_TestDataDirectory": "$env{JSON_TEST_DATA_DIR}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"displayName": "Default config",
|
||||||
|
"binaryDir": "${sourceDir}/build",
|
||||||
|
"inherits": "common"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gcc",
|
||||||
|
"displayName": "GCC config",
|
||||||
|
"binaryDir": "${sourceDir}/build-gcc",
|
||||||
|
"inherits": "common",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_COMPILER": "g++"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clang",
|
||||||
|
"displayName": "Clang config",
|
||||||
|
"binaryDir": "${sourceDir}/build-clang",
|
||||||
|
"inherits": "common",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_COMPILER": "clang++"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gcc-tidy",
|
||||||
|
"displayName": "GCC config (with clang-tidy)",
|
||||||
|
"inherits": "gcc",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_CLANG_TIDY": "clang-tidy"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clang-tidy",
|
||||||
|
"displayName": "Clang config (with clang-tidy)",
|
||||||
|
"inherits": "clang",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_CLANG_TIDY": "clang-tidy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"buildPresets": [
|
||||||
|
{
|
||||||
|
"name": "common",
|
||||||
|
"hidden": true,
|
||||||
|
"jobs": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"inherits": "common",
|
||||||
|
"configurePreset": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gcc",
|
||||||
|
"inherits": "common",
|
||||||
|
"configurePreset": "gcc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clang",
|
||||||
|
"inherits": "common",
|
||||||
|
"configurePreset": "clang"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gcc-tidy",
|
||||||
|
"inherits": "common",
|
||||||
|
"configurePreset": "gcc-tidy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clang-tidy",
|
||||||
|
"inherits": "common",
|
||||||
|
"configurePreset": "clang-tidy"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testPresets": [
|
||||||
|
{
|
||||||
|
"name": "common",
|
||||||
|
"hidden": true,
|
||||||
|
"output": {
|
||||||
|
"outputOnFailure": true
|
||||||
|
},
|
||||||
|
"execution": {
|
||||||
|
"jobs": 8,
|
||||||
|
"noTestsAction": "error",
|
||||||
|
"stopOnFailure": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"inherits": "common",
|
||||||
|
"configurePreset": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gcc",
|
||||||
|
"inherits": "common",
|
||||||
|
"configurePreset": "gcc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clang",
|
||||||
|
"inherits": "common",
|
||||||
|
"configurePreset": "clang"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
7
cmake/preset-wflags.cmake
Normal file
7
cmake/preset-wflags.cmake
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/wflags.cmake")
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||||
|
add_compile_options(${CLANG_CXXFLAGS})
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
||||||
|
add_compile_options(${GCC_CXXFLAGS})
|
||||||
|
endif()
|
||||||
Loading…
Reference in New Issue
Block a user