Skip to content

Commit

Permalink
build: support CMake presets
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Aug 15, 2023
1 parent 2584328 commit ba63ed0
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.idea
/.vs
/.vscode
/CMakePresets.json
/CMakeUserPresets.json
/CMakeSettings.json
/build
/local
Expand Down
62 changes: 62 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"version": 5,
"cmakeMinimumRequired": {
"major": 3,
"minor": 10,
"patch": 0
},
"configurePresets": [
{
"name": "Debug",
"displayName": "Debug-Base",
"description": "Debug Config including tests.",
"binaryDir": "${sourceDir}/build/debug",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_STANDARD": "20",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"LLVM_ROOT": "$env{LLVM_ROOT}",
"Clang_ROOT": "$env{LLVM_ROOT}",
"DUKTAPE_SOURCE_ROOT": "$env{DUKTAPE_SOURCE_ROOT}",
"MRDOX_BUILD_TESTS": "ON"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "Linux", "macOS" ],
"intelliSenseMode": "windows-msvc-x64"
}
}
},
{
"name": "Release",
"inherits": "Debug",
"displayName": "Release-Base",
"description": "Release Config including tests.",
"binaryDir": "${sourceDir}/build/release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "RelWithDebInfo",
"inherits": "Release",
"displayName": "RelWithDebInfo-Base",
"description": "RelWithDebInfo Config including tests.",
"binaryDir": "${sourceDir}/build/relwithdebinfo",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "Dist",
"inherits": "Release",
"displayName": "Distribution-Base",
"description": "Release Config without Tests.",
"binaryDir": "${sourceDir}/build/dist",
"cacheVariables": {
"MRDOX_BUILD_TESTS": "OFF"
}
}
]
}
36 changes: 0 additions & 36 deletions CMakeSettings.json.example

This file was deleted.

96 changes: 96 additions & 0 deletions CMakeUserPresets.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"version": 5,
"cmakeMinimumRequired": {
"major": 3,
"minor": 10,
"patch": 0
},
"configurePresets": [
{
"name": "Debug-MSVC",
"inherits": "Debug",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"binaryDir": "${sourceDir}/build/debug-msvc",
"toolchainFile": "C:\\source\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"cacheVariables": {
"LLVM_ROOT": "C:\\source\\llvm+clang\\Debug",
"Clang_ROOT": "C:\\source\\llvm+clang\\Debug",
"DUKTAPE_SOURCE_ROOT": "C:\\source\\duktape-2.7.0"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "Windows" ],
"intelliSenseMode": "windows-msvc-x64"
}
}
},
{
"name": "DebWithOpt-MSVC",
"inherits": "Debug-MSVC",
"binaryDir": "${sourceDir}/build/debwithopt-msvc",
"cacheVariables": {
"LLVM_ROOT": "C:\\source\\llvm+clang\\DebWithOpt",
"Clang_ROOT": "C:\\source\\llvm+clang\\DebWithOpt"
}
},
{
"name": "Release-MSVC",
"inherits": "Debug-MSVC",
"binaryDir": "${sourceDir}/build/release-msvc",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"LLVM_ROOT": "C:\\source\\llvm+clang\\Release",
"Clang_ROOT": "C:\\source\\llvm+clang\\Release"
}
},
{
"name": "RelWithDebInfo-MSVC",
"inherits": "Debug-MSVC",
"binaryDir": "${sourceDir}/build/relwithdebinfo-msvc",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"LLVM_ROOT": "C:\\source\\llvm+clang\\RelWithDebInfo",
"Clang_ROOT": "C:\\source\\llvm+clang\\RelWithDebInfo"
}
},
{
"name": "Debug-GCC",
"inherits": "Debug",
"binaryDir": "${sourceDir}/build/debug-gcc",
"toolchainFile": "/home/$env{USER}/vcpkg/scripts/buildsystems/vcpkg.cmake",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_C_COMPILER": "gcc",
"LLVM_ROOT": "/usr/local/llvm+clang",
"Clang_ROOT": "/usr/local/llvm+clang",
"DUKTAPE_SOURCE_ROOT": "/home/$env{USER}/source/duktape/duktape-2.7.0"
},
"condition": {
"type": "notEquals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": ["Linux"],
"intelliSenseMode": "windows-msvc-x64"
}
}
},
{
"name": "Debug-Clang",
"inherits": "Debug-GCC",
"binaryDir": "${sourceDir}/build/debug-clang",
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_C_COMPILER": "clang"
}
}
]
}

0 comments on commit ba63ed0

Please sign in to comment.