Browse Source

Introduce the DEBUG_RENDERER setting (#894)

Introduces the possibility to enable the debug renderer even when compiling Jolt in distribution.
Andrea Catania 1 year ago
parent
commit
7d8dea5196
2 changed files with 10 additions and 0 deletions
  1. 4 0
      Build/CMakeLists.txt
  2. 6 0
      Jolt/Jolt.cmake

+ 4 - 0
Build/CMakeLists.txt

@@ -53,6 +53,10 @@ option(TRACK_BROADPHASE_STATS "Track Broadphase Stats" OFF)
 # Setting to periodically trace narrowphase stats to help determine which collision queries could be optimized
 option(TRACK_NARROWPHASE_STATS "Track Narrowphase Stats" OFF)
 
+# Setting to enable the debug renderer. The debug renderer is enabled by default with Debug and Release builds.
+# Note that enabling this reduces the performance of the library even if you're not drawing anything.
+option(DEBUG_RENDERER_IN_DISTRIBUTION "Enable debug renderer in Distribution builds" OFF)
+
 include(CMakeDependentOption)
 
 # Ability to toggle between the static and DLL versions of the MSVC runtime library

+ 6 - 0
Jolt/Jolt.cmake

@@ -523,6 +523,12 @@ if (TRACK_NARROWPHASE_STATS)
 	target_compile_definitions(Jolt PUBLIC JPH_TRACK_NARROWPHASE_STATS)
 endif()
 
+# Setting to enable the debug renderer. The debug renderer is enabled by default with Debug and Release builds.
+# Note that enabling this reduces the performance of the library even if you're not drawing anything.
+if (DEBUG_RENDERER_IN_DISTRIBUTION)
+	target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Distribution>:JPH_DEBUG_RENDERER>")
+endif()
+
 # Emit the instruction set definitions to ensure that child projects use the same settings even if they override the used instruction sets (a mismatch causes link errors)
 function(EMIT_X86_INSTRUCTION_SET_DEFINITIONS)
 	if (USE_AVX512)