|
@@ -33,6 +33,14 @@ option(INTERPROCEDURAL_OPTIMIZATION "Enable interprocedural optimizations" ON)
|
|
|
# Note that this currently only works using MSVC. Clang turns Float2 into a SIMD vector sometimes causing floating point exceptions (the option is ignored).
|
|
# Note that this currently only works using MSVC. Clang turns Float2 into a SIMD vector sometimes causing floating point exceptions (the option is ignored).
|
|
|
option(FLOATING_POINT_EXCEPTIONS_ENABLED "Enable floating point exceptions" ON)
|
|
option(FLOATING_POINT_EXCEPTIONS_ENABLED "Enable floating point exceptions" ON)
|
|
|
|
|
|
|
|
|
|
+# When turning this on, the library will be compiled with C++ exceptions enabled.
|
|
|
|
|
+# This adds some overhead and Jolt doesn't use exceptions so by default it is off.
|
|
|
|
|
+option(CPP_EXCEPTIONS_ENABLED "Enable C++ exceptions" OFF)
|
|
|
|
|
+
|
|
|
|
|
+# When turning this on, the library will be compiled with C++ RTTI enabled.
|
|
|
|
|
+# This adds some overhead and Jolt doesn't use RTTI so by default it is off.
|
|
|
|
|
+option(CPP_RTTI_ENABLED "Enable C++ RTTI" OFF)
|
|
|
|
|
+
|
|
|
# Number of bits to use in ObjectLayer. Can be 16 or 32.
|
|
# Number of bits to use in ObjectLayer. Can be 16 or 32.
|
|
|
option(OBJECT_LAYER_BITS "Number of bits in ObjectLayer" 16)
|
|
option(OBJECT_LAYER_BITS "Number of bits in ObjectLayer" 16)
|
|
|
|
|
|
|
@@ -127,10 +135,18 @@ if (MSVC)
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
# Set compiler flag for disabling RTTI
|
|
# Set compiler flag for disabling RTTI
|
|
|
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
|
|
|
|
|
|
+ if (NOT CPP_RTTI_ENABLED)
|
|
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
|
|
|
|
+ endif()
|
|
|
|
|
|
|
|
- if ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM")
|
|
|
|
|
- # On ARM the exception handling flag is missing which causes warnings
|
|
|
|
|
|
|
+ if (NOT CPP_EXCEPTIONS_ENABLED)
|
|
|
|
|
+ # Remove any existing compiler flag that enables exceptions
|
|
|
|
|
+ string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
|
|
|
+
|
|
|
|
|
+ # Disable warning about STL and compiler-generated types using noexcept when exceptions are disabled
|
|
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4577")
|
|
|
|
|
+ else()
|
|
|
|
|
+ # Enable exceptions
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
@@ -173,6 +189,16 @@ else()
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
|
|
+ # Set compiler flag for disabling RTTI
|
|
|
|
|
+ if (NOT CPP_RTTI_ENABLED)
|
|
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
|
|
|
|
+ endif()
|
|
|
|
|
+
|
|
|
|
|
+ # Disable exception-handling
|
|
|
|
|
+ if (NOT CPP_EXCEPTIONS_ENABLED)
|
|
|
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
|
|
|
|
+ endif()
|
|
|
|
|
+
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
# Also disable -Wstringop-overflow or it will generate false positives that can't be disabled from code when link-time optimizations are enabled
|
|
# Also disable -Wstringop-overflow or it will generate false positives that can't be disabled from code when link-time optimizations are enabled
|
|
|
# Also turn off automatic fused multiply add contractions, there doesn't seem to be a way to do this selectively through the macro JPH_PRECISE_MATH_OFF
|
|
# Also turn off automatic fused multiply add contractions, there doesn't seem to be a way to do this selectively through the macro JPH_PRECISE_MATH_OFF
|