Update CMakePresets and CMakeLists.txt

These changes ensure Visual Studio allows both Debug and Release builds,
while also supporting direct debugging of the examples.

If `CMAKE_BUILD_TYPE` is set in any way, Visual Studio will disable all
targets in the UI (and in generally have a really good tendency to bug
out).
This commit is contained in:
Mario Liebisch 2024-06-07 13:22:55 +02:00
parent 24dc6b5ea9
commit 291e6248d6
No known key found for this signature in database
GPG Key ID: 32B56AC1F87EFBF9
2 changed files with 109 additions and 15 deletions

View File

@ -25,7 +25,9 @@ if(POLICY CMP0141)
endif()
# determine whether to create a debug or release build
sfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
if(NOT MSVC)
sfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
endif()
sfml_set_option(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" STRING "The minimal iOS version that will be able to run the built binaries. Cannot be lower than 13.0")
# project name

View File

@ -1,17 +1,109 @@
{
"version": 3,
"configurePresets":[
{
"name": "dev",
"binaryDir": "build",
"installDir": "${sourceDir}/build/install",
"cacheVariables": {
"CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"SFML_BUILD_EXAMPLES": "ON",
"SFML_BUILD_TEST_SUITE": "ON",
"SFML_WARNINGS_AS_ERRORS": "ON"
}
}
]
"configurePresets": [
{
"name": "generic",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"SFML_BUILD_EXAMPLES": "ON",
"SFML_BUILD_TEST_SUITE": "ON",
"SFML_WARNINGS_AS_ERRORS": "ON",
"SFML_GENERATE_PDB": "ON"
}
},
{
"name": "dev",
"displayName": "Development (used by CI/CD)",
"hidden": true,
"binaryDir": "build",
"installDir": "${sourceDir}/build/install",
"inherits": "generic"
},
{
"name": "x64-debug",
"displayName": "x64: Debug",
"inherits": "generic",
"architecture": {
"value": "x64",
"strategy": "external"
},
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-release",
"displayName": "x64: Release",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x64-relwithdebinfo",
"displayName": "x64: RelWithDebInfo",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "x86-debug",
"displayName": "x86: Debug",
"inherits": "x64-debug",
"architecture": {
"value": "x86",
"strategy": "external"
}
},
{
"name": "x86-release",
"displayName": "x86: Release",
"inherits": "x64-release",
"architecture": {
"value": "x86",
"strategy": "external"
}
},
{
"name": "x86-relwithdebinfo",
"displayName": "x86: RelWithDebInfo",
"inherits": "x64-relwithdebinfo",
"architecture": {
"value": "x86",
"strategy": "external"
}
}/*,
{
"name": "arm-debug",
"displayName": "ARM: Debug",
"inherits": "x64-debug",
"architecture": {
"value": "arm",
"strategy": "external"
}
},
{
"name": "arm-release",
"displayName": "ARM: Release",
"inherits": "x64-release",
"architecture": {
"value": "arm",
"strategy": "external"
}
},
{
"name": "arm-relwithdebinfo",
"displayName": "ARM: RelWithDebInfo",
"inherits": "x64-relwithdebinfo",
"architecture": {
"value": "arm",
"strategy": "external"
}
}*/
]
}