diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-13 07:02:48 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-13 07:04:17 +0300 |
commit | b84db342a57bb7ff94f78a3c9c142abab4dce11a (patch) | |
tree | 664c2660f30765ee02b65561d8bef23ebeee5b2d /intern/cycles/kernel/CMakeLists.txt | |
parent | af3f0bf9d4f0d9f2be0404da5d7746eb8a57c176 (diff) |
Fix build errors with older GCC versions like 4.9
We can add more fine grained checks for when these flags are supported so
that adding asan flags manually still has all the workarounds, but for now
compiling succesfully is more important.
Diffstat (limited to 'intern/cycles/kernel/CMakeLists.txt')
-rw-r--r-- | intern/cycles/kernel/CMakeLists.txt | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index cd284c06259..a8b5b077ece 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -486,15 +486,17 @@ endif() include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) -if(CMAKE_COMPILER_IS_GNUCC AND (NOT WITH_CYCLES_KERNEL_ASAN)) - # GCC hangs compiling the big kernel files with asan and release, so disable by default. - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-sanitize=all") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-sanitize=vptr") -elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") - # With OSL, Cycles disables rtti in some modules, wich then breaks at linking - # when trying to use vptr sanitizer (included into 'undefined' general option). - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-sanitize=vptr") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-sanitize=vptr") +if(WITH_COMPILER_ASAN) + if(CMAKE_COMPILER_IS_GNUCC AND (NOT WITH_CYCLES_KERNEL_ASAN)) + # GCC hangs compiling the big kernel files with asan and release, so disable by default. + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-sanitize=all") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-sanitize=vptr") + elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") + # With OSL, Cycles disables rtti in some modules, wich then breaks at linking + # when trying to use vptr sanitizer (included into 'undefined' general option). + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-sanitize=vptr") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-sanitize=vptr") + endif() endif() set_source_files_properties(kernels/cpu/kernel.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_KERNEL_FLAGS}") |