[Bf-blender-cvs] [e9596e5] master: Cycles: Post-reintegration tweaks to ensure things do compile

Sergey Sharybin noreply at git.blender.org
Wed Dec 31 21:32:59 CET 2014


Commit: e9596e5deff93364a0fe588f8e8e408fcbcc2b96
Author: Sergey Sharybin
Date:   Thu Jan 1 01:01:31 2015 +0500
Branches: master
https://developer.blender.org/rBe9596e5deff93364a0fe588f8e8e408fcbcc2b96

Cycles: Post-reintegration tweaks to ensure things do compile

This commit contains all the tweaks which were missing in initial patch
re-integration from the standalone Cycles repository.

This commit also contains an utility cmake macro to help linking targets
with different libraries for release/debug builds, the name currently is

  target_link_libraries_decoupled

it gets a target and list of libraries and makes sure debug builds are
using libraries with "_d" suffix.

After all this changes it'll hopefully be easier to interchange patches
between blender and standalone repositories, because they're now quite
identical.

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

M	build_files/cmake/macros.cmake
M	intern/cycles/CMakeLists.txt
M	intern/cycles/SConscript
M	intern/cycles/app/CMakeLists.txt
M	intern/cycles/cmake/external_libs.cmake
M	intern/cycles/kernel/osl/SConscript
M	intern/cycles/util/CMakeLists.txt
M	intern/cycles/util/util_opengl.h

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 40bea5e..c031df8 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -118,6 +118,19 @@ macro(target_link_libraries_debug TARGET LIBS)
 	unset(_LIB)
 endmacro()
 
+macro(target_link_libraries_decoupled target libraries_var)
+	if(NOT MSVC)
+		target_link_libraries(${target} ${${libraries_var}})
+	else()
+		# For MSVC we link to different libraries depending whether
+		# release or debug target is being built.
+		file_list_suffix(_libraries_debug "${${libraries_var}}" "_d")
+		target_link_libraries_debug(${target} "${_libraries_debug}")
+		target_link_libraries_optimized(${target} "${${libraries_var}}")
+		unset(_libraries_debug)
+	endif()
+endmacro()
+
 # Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
 # use it instead of include_directories()
 macro(blender_include_dirs
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 4facb8d..2ba6af4 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -179,10 +179,11 @@ include_directories(
 	${PUGIXML_INCLUDE_DIR}
 )
 
-# TODO(sergey): Adjust so standalone repository is also happy.
-include_directories(
-	../atomic
-)
+if(CYCLES_STANDALONE_REPOSITORY)
+	include_directories(../third_party/atomic)
+else()
+	include_directories(../atomic)
+endif()
 
 # Warnings
 if(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript
index fd7ac97..9cbdb93 100644
--- a/intern/cycles/SConscript
+++ b/intern/cycles/SConscript
@@ -65,7 +65,7 @@ if env['WITH_BF_CYCLES_DEBUG']:
 if env['WITH_BF_CYCLES_LOGGING']:
     defs.append('WITH_CYCLES_LOGGING')
     defs.append('GOOGLE_GLOG_DLL_DECL=')
-    defs.append('GFLAGS_NAMESPACE=gflags')
+    defs.append('CYCLES_GFLAGS_NAMESPACE=gflags')
     if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
         incs.append('#extern/libmv/third_party/glog/src/windows')
         incs.append('#extern/libmv/third_party/gflags')
diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index 6e7b650..f6a6f96 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -45,6 +45,7 @@ if(CYCLES_STANDALONE_REPOSITORY)
 	endif()
 else()
 	list(APPEND LIBRARIES bf_intern_glew_mx)
+	list(APPEND LIBRARIES extern_glog)
 endif()
 
 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake
index d036f3e..d7c59f4 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -136,5 +136,6 @@ else()
 		set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/glog/src)
 		set(GFLAGS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/gflags)
 	endif()
-	set(GFLAGS_NAMESPACE gflags)
+	set(GFLAGS_NAMESPACE "gflags")
+	set(LLVM_LIBRARIES ${LLVM_LIBRARY})
 endif()
diff --git a/intern/cycles/kernel/osl/SConscript b/intern/cycles/kernel/osl/SConscript
index 1cb6b6a..58b0204 100644
--- a/intern/cycles/kernel/osl/SConscript
+++ b/intern/cycles/kernel/osl/SConscript
@@ -50,7 +50,7 @@ if env['WITH_BF_CYCLES_DEBUG']:
 if env['WITH_BF_CYCLES_LOGGING']:
     defs.append('WITH_CYCLES_LOGGING')
     defs.append('GOOGLE_GLOG_DLL_DECL=')
-    defs.append('GFLAGS_NAMESPACE=gflags')
+    defs.append('CYCLES_GFLAGS_NAMESPACE=gflags')
     if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
         incs.append('#extern/libmv/third_party/glog/src/windows')
         incs.append('#extern/libmv/third_party/gflags')
diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt
index 336e5e1..d52bcd6 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -21,6 +21,10 @@ set(SRC
 	util_transform.cpp
 )
 
+if(NOT CYCLES_STANDALONE_REPOSITORY)
+	add_definitions(-DWITH_GLEW_MX)
+endif()
+
 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
 	list(APPEND SRC
 		util_view.cpp
diff --git a/intern/cycles/util/util_opengl.h b/intern/cycles/util/util_opengl.h
index 2e39636..0b5462e 100644
--- a/intern/cycles/util/util_opengl.h
+++ b/intern/cycles/util/util_opengl.h
@@ -20,6 +20,12 @@
 /* OpenGL header includes, used everywhere we use OpenGL, to deal with
  * platform differences in one central place. */
 
-#include "glew-mx.h"
+#ifdef WITH_GLEW_MX
+#  include "glew-mx.h"
+#else
+#  include <GL/glew.h>
+#  define mxCreateContext() glewInit()
+#  define mxMakeCurrentContext(x) (x)
+#endif
 
 #endif /* __UTIL_OPENGL_H__ */




More information about the Bf-blender-cvs mailing list