From 6072d5975aaccbb87a28b4b0144eaf3e8ed7a55b Mon Sep 17 00:00:00 2001 From: kgv Date: Fri, 15 Mar 2019 14:24:15 +0300 Subject: [PATCH] 0030580: Configuration, CMake - introduce BUILD_RELEASE_DISABLE_EXCEPTIONS option managing No_Exception macros --- CMakeLists.txt | 5 +++++ adm/cmake/occt_defs_flags.cmake | 6 ++++-- adm/cmake/vardescr.cmake | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6029e1f9c..dc64c3c2bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,11 @@ if (BUILD_WITH_DEBUG) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$: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}") diff --git a/adm/cmake/occt_defs_flags.cmake b/adm/cmake/occt_defs_flags.cmake index c722d1482a..5484c6759f 100644 --- a/adm/cmake/occt_defs_flags.cmake +++ b/adm/cmake/occt_defs_flags.cmake @@ -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() diff --git a/adm/cmake/vardescr.cmake b/adm/cmake/vardescr.cmake index e8b8f933eb..29fa030815 100644 --- a/adm/cmake/vardescr.cmake +++ b/adm/cmake/vardescr.cmake @@ -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 -- 2.20.1