[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51443] trunk/blender: Cycles OSL: some build system tweaks to avoid global includes and definitions,

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Oct 20 14:17:49 CEST 2012


Revision: 51443
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51443
Author:   blendix
Date:     2012-10-20 12:17:45 +0000 (Sat, 20 Oct 2012)
Log Message:
-----------
Cycles OSL: some build system tweaks to avoid global includes and definitions,
which ensures there is no conflict with other libraries, and avoids full rebuild
when toggling OSL on/off.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/intern/cycles/CMakeLists.txt
    trunk/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2012-10-20 10:37:15 UTC (rev 51442)
+++ trunk/blender/CMakeLists.txt	2012-10-20 12:17:45 UTC (rev 51443)
@@ -734,23 +734,14 @@
 		execute_process(COMMAND ${LLVM_CONFIG} --libdir
 		                OUTPUT_VARIABLE LLVM_LIB_DIR
 		                OUTPUT_STRIP_TRAILING_WHITESPACE)
-		execute_process(COMMAND ${LLVM_CONFIG} --includedir
-		                OUTPUT_VARIABLE LLVM_INCLUDES
-		                OUTPUT_STRIP_TRAILING_WHITESPACE)
 		find_library(LLVM_LIBRARY
 		             NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
 		             PATHS ${LLVM_LIB_DIR})
 		message(STATUS "LLVM version  = ${LLVM_VERSION}")
 		message(STATUS "LLVM dir      = ${LLVM_DIRECTORY}")
-		message(STATUS "LLVM includes = ${LLVM_INCLUDES}")
 		message(STATUS "LLVM lib dir  = ${LLVM_LIB_DIR}")
 
-		if(LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
-			# ensure include directory is added (in case of non-standard locations
-			include_directories(BEFORE "${LLVM_INCLUDES}")
-			string(REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
-			message(STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
-			add_definitions("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
+		if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
 			if(LLVM_STATIC)
 				# if static LLVM libraries were requested, use llvm-config to generate
 				# the list of what libraries we need, and substitute that in the right
@@ -788,8 +779,6 @@
 		else()
 			message(STATUS "OSL not found")
 		endif()
-	
-		include_directories(${OSL_INCLUDES})
 	endif()
 
 	# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
@@ -957,8 +946,6 @@
 		else()
 			message(STATUS "OSL not found")
 		endif()
-	
-		include_directories(${OSL_INCLUDES})
 	endif()
 
 	if(MSVC)
@@ -1640,23 +1627,14 @@
 		execute_process(COMMAND ${LLVM_CONFIG} --libdir
 		                OUTPUT_VARIABLE LLVM_LIB_DIR
 		                OUTPUT_STRIP_TRAILING_WHITESPACE)
-		execute_process(COMMAND ${LLVM_CONFIG} --includedir
-		                OUTPUT_VARIABLE LLVM_INCLUDES
-		                OUTPUT_STRIP_TRAILING_WHITESPACE)
 		find_library(LLVM_LIBRARY
 		             NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
 		             PATHS ${LLVM_LIB_DIR})
 		message(STATUS "LLVM version  = ${LLVM_VERSION}")
 		message(STATUS "LLVM dir      = ${LLVM_DIRECTORY}")
-		message(STATUS "LLVM includes = ${LLVM_INCLUDES}")
 		message(STATUS "LLVM lib dir  = ${LLVM_LIB_DIR}")
 
-		if(LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
-			# ensure include directory is added (in case of non-standard locations
-			include_directories(BEFORE "${LLVM_INCLUDES}")
-			string(REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
-			message(STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
-			add_definitions("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
+		if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
 			if(LLVM_STATIC)
 				# if static LLVM libraries were requested, use llvm-config to generate
 				# the list of what libraries we need, and substitute that in the right
@@ -1693,8 +1671,6 @@
 		else()
 			message(STATUS "OSL not found")
 		endif()
-	
-		include_directories(${OSL_INCLUDES})
 	endif()
 
 	set(EXETYPE MACOSX_BUNDLE)

Modified: trunk/blender/intern/cycles/CMakeLists.txt
===================================================================
--- trunk/blender/intern/cycles/CMakeLists.txt	2012-10-20 10:37:15 UTC (rev 51442)
+++ trunk/blender/intern/cycles/CMakeLists.txt	2012-10-20 12:17:45 UTC (rev 51443)
@@ -41,6 +41,7 @@
 
 if(WITH_CYCLES_OSL)
 	add_definitions(-DWITH_OSL)
+	include_directories(${OSL_INCLUDES})
 endif()
 
 if(WITH_CYCLES_PARTIO)

Modified: trunk/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt
===================================================================
--- trunk/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt	2012-10-20 10:37:15 UTC (rev 51442)
+++ trunk/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt	2012-10-20 12:17:45 UTC (rev 51443)
@@ -88,7 +88,7 @@
 	unset(_OSO_FILE)
 endforeach()
 
-add_custom_target(shader ALL DEPENDS ${SRC_OSO} ${SRC_OSL_HEADERS})
+add_custom_target(cycles_osl_shaders ALL DEPENDS ${SRC_OSO} ${SRC_OSL_HEADERS})
 
 # CMAKE_CURRENT_SOURCE_DIR is already included in OSO paths
 delayed_install("" "${SRC_OSO}" ${CYCLES_INSTALL_PATH}/shader)




More information about the Bf-blender-cvs mailing list