0030580: Configuration, CMake - introduce BUILD_RELEASE_DISABLE_EXCEPTIONS option...
authorkgv <kgv@opencascade.com>
Fri, 15 Mar 2019 11:24:15 +0000 (14:24 +0300)
committerapn <apn@opencascade.com>
Sat, 16 Mar 2019 13:46:51 +0000 (16:46 +0300)
CMakeLists.txt
adm/cmake/occt_defs_flags.cmake
adm/cmake/vardescr.cmake

index b6029e1..dc64c3c 100644 (file)
@@ -86,6 +86,11 @@ if (BUILD_WITH_DEBUG)
   set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:OCCT_DEBUG>)
 endif()
 
   set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:OCCT_DEBUG>)
 endif()
 
+# option disabling OCCT exceptions in Release builds (No_Exception)
+if (NOT DEFINED BUILD_RELEASE_DISABLE_EXCEPTIONS)
+  set (BUILD_RELEASE_DISABLE_EXCEPTIONS ON CACHE BOOL "${BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR}")
+endif()
+
 # option to enable or disable use of precompiled headers
 if (NOT DEFINED BUILD_USE_PCH)
   set (BUILD_USE_PCH OFF CACHE BOOL "${BUILD_USE_PCH_DESCR}")
 # option to enable or disable use of precompiled headers
 if (NOT DEFINED BUILD_USE_PCH)
   set (BUILD_USE_PCH OFF CACHE BOOL "${BUILD_USE_PCH_DESCR}")
index c722d14..5484c67 100644 (file)
@@ -143,5 +143,7 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW)
   set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
 endif()
 
   set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
 endif()
 
-set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
-set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
+if (BUILD_RELEASE_DISABLE_EXCEPTIONS)
+  set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
+  set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
+endif()
index e8b8f93..29fa030 100644 (file)
@@ -28,6 +28,11 @@ Applies only for Debug configuration.")
 set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
 "Append the postfix to names of output libraries")
 
 set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
 "Append the postfix to names of output libraries")
 
+set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
+"Disables exceptions like Standard_OutOfRange in Release builds.
+Defines No_Exception macros for Release builds when enabled (default).
+These exceptions are always enabled in Debug builds, but disable in Release for better performance")
+
 set (BUILD_ENABLE_FPE_SIGNAL_HANDLER_DESCR
 "Enable/Disable the floating point exceptions (FPE) during DRAW execution only.
 Corresponding environment variable (CSF_FPE) can be changed manually
 set (BUILD_ENABLE_FPE_SIGNAL_HANDLER_DESCR
 "Enable/Disable the floating point exceptions (FPE) during DRAW execution only.
 Corresponding environment variable (CSF_FPE) can be changed manually