]> OCCT Git - occt-copy.git/commitdiff
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 b6029e1f9c59b7fa21da7ac054c4c2e16c6e8524..dc64c3c2bd0f7cf589bac224f352791d7e156b01 100644 (file)
@@ -86,6 +86,11 @@ if (BUILD_WITH_DEBUG)
   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}")
index c722d1482a65471082e9fc22ced9c0172eae7d87..5484c6759f3fcaf4e2a4e918b2362932de3e67ac 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_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 e8b8f933eb7edb3523f2f9c344bbeaf7aca09eef..29fa030815cb3995c60bd0ac8424988effc422ef 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_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