From: Rene Gassmoeller Date: Sat, 26 Jun 2021 15:55:01 +0000 (-0400) Subject: Define NDEBUG in release mode X-Git-Tag: v9.4.0-rc1~1174^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12503%2Fhead;p=dealii.git Define NDEBUG in release mode --- diff --git a/cmake/setup_compiler_flags_gnu.cmake b/cmake/setup_compiler_flags_gnu.cmake index ca26003cbe..737a90b821 100644 --- a/cmake/setup_compiler_flags_gnu.cmake +++ b/cmake/setup_compiler_flags_gnu.cmake @@ -187,6 +187,12 @@ IF (CMAKE_BUILD_TYPE MATCHES "Release") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-funroll-all-loops") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-fstrict-aliasing") + # + # Disable assert() in deal.II and user projects in release mode + # + LIST(APPEND DEAL_II_DEFINITIONS_RELEASE "NDEBUG") + LIST(APPEND DEAL_II_USER_DEFINITIONS_RELEASE "NDEBUG") + # # There are many places in the library where we create a new typedef and then # immediately use it in an Assert. Hence, only ignore unused typedefs in Release diff --git a/cmake/setup_compiler_flags_intel.cmake b/cmake/setup_compiler_flags_intel.cmake index 17b8fc959b..b83493f848 100644 --- a/cmake/setup_compiler_flags_intel.cmake +++ b/cmake/setup_compiler_flags_intel.cmake @@ -183,6 +183,12 @@ IF (CMAKE_BUILD_TYPE MATCHES "Release") ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O2") + # + # Disable assert() in deal.II and user projects in release mode + # + LIST(APPEND DEAL_II_DEFINITIONS_RELEASE "NDEBUG") + LIST(APPEND DEAL_II_USER_DEFINITIONS_RELEASE "NDEBUG") + # equivalent to -fno-strict-aliasing: ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-no-ansi-alias") diff --git a/cmake/setup_compiler_flags_msvc.cmake b/cmake/setup_compiler_flags_msvc.cmake index 32921fc03d..898b527306 100644 --- a/cmake/setup_compiler_flags_msvc.cmake +++ b/cmake/setup_compiler_flags_msvc.cmake @@ -99,6 +99,13 @@ IF (CMAKE_BUILD_TYPE MATCHES "Release") # General optimization flags: (very basic for now) # ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "/O2") + + # + # Disable assert() in deal.II and user projects in release mode + # + LIST(APPEND DEAL_II_DEFINITIONS_RELEASE "NDEBUG") + LIST(APPEND DEAL_II_USER_DEFINITIONS_RELEASE "NDEBUG") + ENDIF()