CMAKE: allow to easily disable stacktraces

Mingw64 doesn't like this out of the box atm.
master
Martin Gerhardy 2021-05-09 21:08:03 +02:00
parent 209e86b358
commit 7145e07c6e
3 changed files with 11 additions and 3 deletions

View File

@ -70,6 +70,7 @@ set(DB_PW "engine" CACHE STRING "The database password")
set(SERVER_PORT "11337" CACHE STRING "Port where the server is listening on")
set(HTTP_SERVER_PORT "8080" CACHE STRING "Port where the http server is listening on")
set(DOCKER_REGISTRY "" CACHE STRING "Docker registry")
option(USE_STACKTRACES "Enable stacktraces" ON)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(WINDOWS 1)

View File

@ -6,8 +6,6 @@
#include <SDL_stdinc.h>
#include <SDL_log.h>
#define HAVE_BACKWARD
#ifdef HAVE_BACKWARD
#include <backward.h>
#endif

View File

@ -76,12 +76,21 @@ if (WINDOWS)
set_property(GLOBAL PROPERTY ${LIB}_NOUNITY TRUE)
endif()
set(LIBS sdl2 glm backward ${CMAKE_DL_LIBS})
set(LIBS sdl2 glm ${CMAKE_DL_LIBS})
if (USE_STACKTRACES)
list(APPEND LIBS backward)
endif()
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES ${LIBS})
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tracy/TracyClient.cpp)
target_compile_definitions(${LIB} PUBLIC TRACY_ENABLE TRACY_ON_DEMAND)
endif()
if (USE_STACKTRACES)
target_compile_definitions(${LIB} PRIVATE HAVE_BACKWARD)
endif()
set(TEST_SRCS
tests/TestHelper.h
tests/AlgorithmTest.cpp