1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-24 05:31:03 +00:00

CMake: Minor debug refactoring

- LAIKA_DEBUG_BUILD is set to true if lower(CMAKE_BUILD_TYPE) matches 'debug'
This commit is contained in:
CPunch 2022-06-05 15:51:18 -05:00
parent a410a9ac15
commit 87f5eaa694
2 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,7 @@ endif ()
string(TOLOWER ${CMAKE_BUILD_TYPE} RAWCMAKEBUILDTYPE)
message(STATUS "CMAKE_BUILD_TYPE: " ${RAWCMAKEBUILDTYPE})
if(RAWCMAKEBUILDTYPE STREQUAL "debug")
set(LAIKA_DEBUG_BUILD on)
if(WIN32)
# statically link debug libs for windows
message(STATUS "Adding MSVC Debug libs...")
@ -44,6 +45,7 @@ if(RAWCMAKEBUILDTYPE STREQUAL "debug")
add_link_options(-fsanitize=address)
endif ()
else()
set(LAIKA_DEBUG_BUILD off)
# statically link non-debug libs
if(WIN32)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")

View File

@ -14,7 +14,7 @@ file(GLOB_RECURSE BOTHEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/**.h)
# include platform specific backends
if(WIN32)
file(GLOB_RECURSE BOTPLATFORMSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/win/**.c)
if (NOT RAWCMAKEBUILDTYPE STREQUAL "debug")
if (NOT LAIKA_DEBUG_BUILD)
set(BOTFLAGS WIN32)
endif ()
elseif(UNIX AND NOT APPLE)
@ -37,7 +37,7 @@ target_compile_definitions(LaikaBot PUBLIC "$<$<CONFIG:Debug>:DEBUG>")
target_include_directories(LaikaBot PUBLIC ${BOT_INCLUDEDIR})
# strip symbols for UNIX binaries
if((UNIX AND NOT APPLE) AND NOT RAWCMAKEBUILDTYPE STREQUAL "debug")
if((UNIX AND NOT APPLE) AND NOT LAIKA_DEBUG_BUILD)
message(STATUS "Stripping LaikaBot symbols...")
target_link_options(LaikaBot PRIVATE -s)
endif ()