File tree Expand file tree Collapse file tree 10 files changed +24
-7
lines changed
Expand file tree Collapse file tree 10 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ set(cpp_lib_name "mmsolverlibs_cpp")
6767set (rust_lib_name "mmsolverlibs_rust" )
6868
6969include (MMCommonUtils )
70- mm_common_set_global_compile_options ()
70+ option (MMSOLVER_BUILD_RELEASE_ASSERTIONS "Enable Assertions to be called in Release mode." OFF )
71+ mm_common_set_global_compile_options (MMSOLVER_BUILD_RELEASE_ASSERTIONS )
7172
7273include (MMRustUtils )
7374set (rust_linktime_file "NOT-FOUND" )
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ set(test_source_files
3030)
3131
3232include (MMCommonUtils )
33- mm_common_set_global_compile_options ()
33+ option (MMSOLVER_BUILD_RELEASE_ASSERTIONS "Enable Assertions to be called in Release mode." ON )
34+ mm_common_set_global_compile_options (MMSOLVER_BUILD_RELEASE_ASSERTIONS )
3435
3536# Add test executable using the C++ bindings.
3637message (STATUS "target_test_exe_name: ${target_test_exe_name} " )
Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ set(test_source_files
3939)
4040
4141include (MMCommonUtils )
42- mm_common_set_global_compile_options ()
42+ option (MMSOLVER_BUILD_RELEASE_ASSERTIONS "Enable Assertions to be called in Release mode." ON )
43+ mm_common_set_global_compile_options (MMSOLVER_BUILD_RELEASE_ASSERTIONS )
4344
4445# Add test executable using the C++ bindings.
4546add_executable (${target_test_exe_name} ${test_source_files} )
Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ set(test_source_files
2828)
2929
3030include (MMCommonUtils )
31- mm_common_set_global_compile_options ()
31+ option (MMSOLVER_BUILD_RELEASE_ASSERTIONS "Enable Assertions to be called in Release mode." ON )
32+ mm_common_set_global_compile_options (MMSOLVER_BUILD_RELEASE_ASSERTIONS )
3233
3334# Add test executable using the C++ bindings.
3435add_executable (${target_test_exe_name} ${test_source_files} )
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ BUILD_DIR_BASE="${PROJECT_ROOT}/../"
4444
4545# What type of build? "Release" or "Debug"?
4646BUILD_TYPE=" Release"
47+ MMSOLVER_BUILD_RELEASE_ASSERTIONS=0
4748
4849RELEASE_FLAG=" "
4950BUILD_TYPE_DIR=" debug"
@@ -133,6 +134,7 @@ ${CMAKE_EXE} \
133134 -DCMAKE_MODULE_PATH=${OPENCOLORIO_CMAKE_FIND_MODULES_DIR} \
134135 -DCMAKE_VERBOSE_MAKEFILE=${MMSOLVER_BUILD_VERBOSE} \
135136 -DMMSOLVER_VFX_PLATFORM=${VFX_PLATFORM} \
137+ -DMMSOLVER_BUILD_RELEASE_ASSERTIONS=${MMSOLVER_BUILD_RELEASE_ASSERTIONS} \
136138 -DMMSOLVERLIBS_CXXBRIDGE_EXE=${MMSOLVERLIBS_CXXBRIDGE_EXE} \
137139 -DMMSOLVERLIBS_BUILD_TESTS=${MMSOLVERLIBS_BUILD_TESTS} \
138140 -DMMSOLVERLIBS_LIB_DIR=${MMSOLVERLIBS_LIB_DIR} \
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ SET BUILD_DIR_BASE=%PROJECT_ROOT%\..
3535
3636:: What type of build? "Release" or "Debug"?
3737SET BUILD_TYPE = Release
38+ SET MMSOLVER_BUILD_RELEASE_ASSERTIONS = 0
3839
3940SET RELEASE_FLAG =
4041SET BUILD_TYPE_DIR = debug
@@ -158,6 +159,7 @@ CHDIR "%BUILD_DIR%"
158159 -DCMAKE_MODULE_PATH=%OPENCOLORIO_CMAKE_FIND_MODULES_DIR% ^
159160 -DCMAKE_VERBOSE_MAKEFILE=%MMSOLVER_BUILD_VERBOSE% ^
160161 -DMMSOLVER_VFX_PLATFORM=%VFX_PLATFORM% ^
162+ -DMMSOLVER_BUILD_RELEASE_ASSERTIONS=%MMSOLVER_BUILD_RELEASE_ASSERTIONS% ^
161163 -DMMSOLVERLIBS_CXXBRIDGE_EXE=%MMSOLVERLIBS_CXXBRIDGE_EXE% ^
162164 -DMMSOLVERLIBS_BUILD_TESTS=%MMSOLVERLIBS_BUILD_TESTS% ^
163165 -DMMSOLVERLIBS_LIB_DIR=%MMSOLVERLIBS_LIB_DIR% ^
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ BUILD_DIR_BASE="${PROJECT_ROOT}/../"
5959
6060# What type of build? "Release" or "Debug"?
6161BUILD_TYPE=Release
62+ MMSOLVER_BUILD_RELEASE_ASSERTIONS=0
6263
6364# Build options, to allow faster compilation times. (not to be used by
6465# users wanting to build this project.)
@@ -140,6 +141,7 @@ ${CMAKE_EXE} \
140141 -DCMAKE_VERBOSE_MAKEFILE=${MMSOLVER_BUILD_VERBOSE} \
141142 -DOPENGL_INCLUDE_DIR=${OPENGL_INCLUDE_DIR} \
142143 -DMMSOLVER_VFX_PLATFORM=${VFX_PLATFORM} \
144+ -DMMSOLVER_BUILD_RELEASE_ASSERTIONS=${MMSOLVER_BUILD_RELEASE_ASSERTIONS} \
143145 -DMMSOLVER_BUILD_PLUGIN=${MMSOLVER_BUILD_PLUGIN} \
144146 -DMMSOLVER_BUILD_TOOLS=${MMSOLVER_BUILD_TOOLS} \
145147 -DMMSOLVER_BUILD_PYTHON=${MMSOLVER_BUILD_PYTHON} \
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ SET BUILD_PACKAGE=1
5959
6060:: What type of build? "Release" or "Debug"?
6161SET BUILD_TYPE = Release
62+ SET MMSOLVER_BUILD_RELEASE_ASSERTIONS = 0
6263
6364:: Build options, to allow faster compilation times. (not to be used by
6465:: users wanting to build this project.)
@@ -158,6 +159,7 @@ CHDIR "%BUILD_DIR%"
158159 -DCMAKE_MODULE_PATH=%OPENCOLORIO_CMAKE_FIND_MODULES_DIR% ^
159160 -DCMAKE_VERBOSE_MAKEFILE=%MMSOLVER_BUILD_VERBOSE% ^
160161 -DMMSOLVER_VFX_PLATFORM=%VFX_PLATFORM% ^
162+ -DMMSOLVER_BUILD_RELEASE_ASSERTIONS=%MMSOLVER_BUILD_RELEASE_ASSERTIONS% ^
161163 -DMMSOLVER_BUILD_PLUGIN=%MMSOLVER_BUILD_PLUGIN% ^
162164 -DMMSOLVER_BUILD_TOOLS=%MMSOLVER_BUILD_TOOLS% ^
163165 -DMMSOLVER_BUILD_PYTHON=%MMSOLVER_BUILD_PYTHON% ^
Original file line number Diff line number Diff line change @@ -226,10 +226,14 @@ function(mm_common_linux_gcc_set_global_compile_options)
226226 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=skylake" ) # Use AVX2 instructions
227227endfunction ()
228228
229- function (mm_common_set_global_compile_options )
229+ function (mm_common_set_global_compile_options enable_release_mode_assertions )
230230
231231 if (CMAKE_BUILD_TYPE EQUAL "Release" )
232- add_compile_definitions (NDEBUG )
232+ # If 'NDEBUG' is enabled, it will disable 'assert'ions.
233+ # https://en.cppreference.com/w/cpp/error/assert
234+ if (NOT enable_release_mode_assertions)
235+ add_compile_definitions (NDEBUG )
236+ endif ()
233237 elseif (CMAKE_BUILD_TYPE EQUAL "Debug" )
234238 add_compile_definitions (_DEBUG )
235239 endif ()
Original file line number Diff line number Diff line change @@ -179,7 +179,8 @@ endif ()
179179# plug-in. See 'MMSolverUtils' CMake module for more information.
180180include (MMCommonUtils )
181181mm_common_set_global_treat_warnings_as_errors ()
182- mm_common_set_global_compile_options ()
182+ option (MMSOLVER_BUILD_RELEASE_ASSERTIONS "Enable Assertions to be called in Release mode." OFF )
183+ mm_common_set_global_compile_options (MMSOLVER_BUILD_RELEASE_ASSERTIONS )
183184
184185# MM Solver standalone libraries.
185186find_package (mmsolverlibs_cpp REQUIRED )
You can’t perform that action at this time.
0 commit comments