|
@@ -9,6 +9,9 @@ option(TARGET_PERFORMANCE_TEST "Build Performance Test" ON)
|
|
|
option(TARGET_SAMPLES "Build Samples" ON)
|
|
|
option(TARGET_VIEWER "Build JoltViewer" ON)
|
|
|
|
|
|
+# When turning this option on, the library will be compiled with debug symbols
|
|
|
+option(GENERATE_DEBUG_SYMBOLS "Generate debug symbols" ON)
|
|
|
+
|
|
|
# When turning this option on, the library will be compiled in such a way to attempt to keep the simulation deterministic across platforms
|
|
|
option(CROSS_PLATFORM_DETERMINISTIC "Cross platform deterministic" OFF)
|
|
|
|
|
@@ -53,7 +56,12 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA
|
|
|
endif()
|
|
|
|
|
|
# Set general compiler flags
|
|
|
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Zc:__cplusplus /Gm- /Wall /WX /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline /Zi")
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Zc:__cplusplus /Gm- /Wall /WX /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline")
|
|
|
+
|
|
|
+ # Optionally generate debug symbols
|
|
|
+ if (GENERATE_DEBUG_SYMBOLS)
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
|
|
|
+ endif()
|
|
|
|
|
|
# Remove any existing compiler flag that enables RTTI
|
|
|
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
@@ -153,7 +161,12 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA
|
|
|
endif()
|
|
|
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR MINGW OR EMSCRIPTEN)
|
|
|
# Set general compiler flags
|
|
|
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++17 -I. -Wall -Werror")
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -I. -Wall -Werror")
|
|
|
+
|
|
|
+ # Optionally generate debug symbols
|
|
|
+ if (GENERATE_DEBUG_SYMBOLS)
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
|
|
+ endif()
|
|
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
# Somehow -Wcomment doesn't want to be turned off from code and we need this because Doxygen MathJax uses it
|
|
@@ -200,6 +213,7 @@ elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR "${CMAKE_SYSTEM_NAME}" STREQU
|
|
|
endif()
|
|
|
|
|
|
# Set compiler flags for various configurations
|
|
|
+ set(CMAKE_CXX_FLAGS_DEBUG "")
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
|
|
set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3")
|
|
|
set(CMAKE_CXX_FLAGS_RELEASEASAN "-fsanitize=address")
|