Add Cmake debug configurations and presets
Some checks failed
Build and Test / build-and-test (push) Has been cancelled
Some checks failed
Build and Test / build-and-test (push) Has been cancelled
This commit is contained in:
parent
68992c77f5
commit
9825c0d14d
2 changed files with 50 additions and 0 deletions
|
@ -14,6 +14,25 @@ add_compile_options($<$<COMPILE_LANGUAGE:CUDA>:-Wno-pedantic>)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
# Add debug configuration
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(CMAKE_CUDA_FLAGS_DEBUG "-g -G -O0 --generate-line-info")
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
|
set(CMAKE_CUDA_FLAGS_RELEASE "-O3 --use_fast_math")
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
|
set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO "-g -lineinfo -O2")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set C++ debug/release flags globally
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wextra")
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Cuda Settings
|
# Cuda Settings
|
||||||
set(CMAKE_CUDA_ARCHITECTURES 61)
|
set(CMAKE_CUDA_ARCHITECTURES 61)
|
||||||
set(CUDA_SEPARABLE_COMPILATION ON)
|
set(CUDA_SEPARABLE_COMPILATION ON)
|
||||||
|
|
31
CMakePresets.json
Normal file
31
CMakePresets.json
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "debug",
|
||||||
|
"displayName": "Debug Build",
|
||||||
|
"binaryDir": "${sourceDir}/Debug",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "release",
|
||||||
|
"displayName": "Release Build",
|
||||||
|
"binaryDir": "${sourceDir}/Release",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"buildPresets": [
|
||||||
|
{
|
||||||
|
"name": "debug",
|
||||||
|
"configurePreset": "debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "release",
|
||||||
|
"configurePreset": "release"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue