[Bf-blender-cvs] [d813862ad92] temp-cycles-rtti: Cycles: disable RTTI only for OSL

Brecht Van Lommel noreply at git.blender.org
Wed Mar 11 14:05:58 CET 2020


Commit: d813862ad92fc6a5a71bf1b5387ea9f55616e4c8
Author: Brecht Van Lommel
Date:   Wed Mar 11 13:46:06 2020 +0100
Branches: temp-cycles-rtti
https://developer.blender.org/rBd813862ad92fc6a5a71bf1b5387ea9f55616e4c8

Cycles: disable RTTI only for OSL

Other libraries like OpenVDB need RTTI.

===================================================================

M	intern/cycles/CMakeLists.txt
M	intern/cycles/kernel/osl/CMakeLists.txt
M	intern/cycles/render/CMakeLists.txt

===================================================================

diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 1014831c403..6d4d2e38e82 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -177,14 +177,11 @@ if(CXX_HAS_AVX2)
   add_definitions(-DWITH_KERNEL_AVX2)
 endif()
 
-if(WITH_CYCLES_OSL)
-  # LLVM and OSL need to build without RTTI
-  if(WIN32 AND MSVC)
-    set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
-  elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
-    set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
-  endif()
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
+# LLVM and OSL need to build without RTTI
+if(WIN32 AND MSVC)
+  set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
+elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
+  set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
 endif()
 
 # Definitions and Includes
diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt
index 5be5bd181ec..fc0c845fd4f 100644
--- a/intern/cycles/kernel/osl/CMakeLists.txt
+++ b/intern/cycles/kernel/osl/CMakeLists.txt
@@ -33,6 +33,9 @@ set(LIB
   ${LLVM_LIBRARY}
 )
 
+# OSL and LLVM are built without RTTI
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
+
 include_directories(${INC})
 include_directories(SYSTEM ${INC_SYS})
 
diff --git a/intern/cycles/render/CMakeLists.txt b/intern/cycles/render/CMakeLists.txt
index 2a077f486fa..6cde52bb89d 100644
--- a/intern/cycles/render/CMakeLists.txt
+++ b/intern/cycles/render/CMakeLists.txt
@@ -92,6 +92,8 @@ if(WITH_CYCLES_OSL)
   list(APPEND LIB
     cycles_kernel_osl
   )
+
+  SET_PROPERTY(SOURCE osl.cpp PROPERTY COMPILE_FLAGS ${RTTI_DISABLE_FLAGS})
 endif()
 
 include_directories(${INC})



More information about the Bf-blender-cvs mailing list