[Bf-blender-cvs] [7743a56] opensubdiv-modifier: Fix compilation error when using Msvc2012

Sergey Sharybin noreply at git.blender.org
Thu May 15 13:44:56 CEST 2014


Commit: 7743a56044f0855c56926f7cce451b38bf80288a
Author: Sergey Sharybin
Date:   Thu May 15 12:22:42 2014 +0600
https://developer.blender.org/rB7743a56044f0855c56926f7cce451b38bf80288a

Fix compilation error when using Msvc2012

Msvc2008 is not supported because of missing precompiled
libraries. Not in the mood of spending time on making libs
for 2008 yet, because they're likely to be re-compiled still
in order to have proper runtime cuda/opencl detection and
not making blender.exe depending on cuda/opencl.

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

M	CMakeLists.txt
M	build_files/cmake/macros.cmake
M	build_files/scons/config/win64-vc-config.py
M	build_files/scons/tools/Blender.py
M	intern/opensubdiv/CMakeLists.txt
M	intern/opensubdiv/SConscript
M	intern/opensubdiv/opensubdiv_capi.cc
M	intern/opensubdiv/opensubdiv_gpu_capi.cc

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03c8209..bf75c2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -882,7 +882,6 @@ if(UNIX AND NOT APPLE)
 
 		set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
 		set(OPENSUBDIV_LIBPATH)  # TODO, remove and reference the absolute path everywhere
-		set(OPENSUBDIV_DEFINITIONS)
 
 		if(NOT OPENSUBDIV_FOUND)
 			set(WITH_OPENSUBDIV OFF)
@@ -1338,6 +1337,13 @@ elseif(WIN32)
 			)
 		endif()
 
+		if(WITH_OPENSUBDIV)
+			set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
+			set(OPENSUBDIV_LIBRARIES "osdutil osdCPU osdGPU")
+			set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
+			find_package(OpenSubdiv)
+		endif()
+
 		# used in many places so include globally, like OpenGL
 		blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
 
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 598fbd9..240e048 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -338,7 +338,10 @@ macro(setup_liblinks
 		target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
 	endif()
 	if(WITH_OPENSUBDIV)
-		target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
+		file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d")
+		target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}")
+		target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}")
+		unset(OPENSUBDIV_LIBRARIES_DEBUG)
 	endif()
 	if(WITH_BOOST)
 		target_link_libraries(${target} ${BOOST_LIBRARIES})
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index ce8ba86..79f8eb7 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -236,10 +236,10 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['']
 #Freestyle
 WITH_BF_FREESTYLE = True
 
-WITH_BF_OPENSUBDIV = False
+WITH_BF_OPENSUBDIV = True if VC_VERSION == '12.0' else False
 BF_OPENSUBDIV = LIBDIR + '/opensubdiv'
 BF_OPENSUBDIV_INC = '${BF_OPENSUBDIV}/include'
-BF_OPENSUBDIV_LIB = 'osdCPU'
+BF_OPENSUBDIV_LIB = 'osdutil osdCPU osdGPU'
 BF_OPENSUBDIV_LIBPATH = '${BF_OPENSUBDIV}/lib'
 
 WITH_BF_STATICOPENGL = False
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index 50fce20..87a3467 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -353,7 +353,10 @@ def setup_syslibs(lenv):
 
     if lenv['WITH_BF_OPENSUBDIV']:
         if not lenv['WITH_BF_STATICOPENSUBDIV']:
-            syslibs += Split(lenv['BF_OPENSUBDIV_LIB'])
+            if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
+                syslibs += [osdlib+'_d' for osdlib in Split(lenv['BF_OPENSUBDIV_LIB'])]
+            else:
+                syslibs += Split(lenv['BF_OPENSUBDIV_LIB'])
 
     syslibs += lenv['LLIBS']
 
diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index 942f995..ce2011d 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -30,6 +30,7 @@ set(INC
 
 set(INC_SYS
 	${OPENSUBDIV_INCLUDE_DIR}
+	${GLEW_INCLUDE_PATH}
 )
 
 set(SRC
@@ -41,7 +42,7 @@ set(SRC
 )
 
 MACRO(OPENSUBDIV_DEFINE_COMPONENT component)
-	if(${component})
+	if(${${component}})
 		add_definitions(-D${component})
 	endif()
 ENDMACRO()
@@ -54,4 +55,6 @@ OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE)
 
 data_to_c_simple(gpu_shader_opensubd_display.glsl SRC)
 
+add_definitions(-DGLEW_STATIC)
+
 blender_add_lib(bf_intern_opensubdiv "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/opensubdiv/SConscript b/intern/opensubdiv/SConscript
index 73c188d..d637b53 100644
--- a/intern/opensubdiv/SConscript
+++ b/intern/opensubdiv/SConscript
@@ -31,10 +31,11 @@ Import('env')
 
 sources = env.Glob('*.cc')
 
-defs = []
+defs = [ 'GLEW_STATIC' ]
 
 incs = '. ../guardedalloc'
 incs += ' ' + env['BF_OPENSUBDIV_INC']
+incs += ' #/extern/glew/include'
 
 def checkOpenSubdivHeaderDefine(header, define):
     include_path = Dir(env.subst(env['BF_OPENSUBDIV_INC'])).abspath
diff --git a/intern/opensubdiv/opensubdiv_capi.cc b/intern/opensubdiv/opensubdiv_capi.cc
index b11b936..4c99dba 100644
--- a/intern/opensubdiv/opensubdiv_capi.cc
+++ b/intern/opensubdiv/opensubdiv_capi.cc
@@ -26,6 +26,10 @@
 
 #include "opensubdiv_capi.h"
 
+#ifdef _MSC_VER
+#  include "iso646.h"
+#endif
+
 #include <opensubdiv/osd/glMesh.h>
 #include <opensubdiv/osd/glDrawRegistry.h>
 #include <opensubdiv/osdutil/evaluator_capi.h>
diff --git a/intern/opensubdiv/opensubdiv_gpu_capi.cc b/intern/opensubdiv/opensubdiv_gpu_capi.cc
index 294db51..9f731d9 100644
--- a/intern/opensubdiv/opensubdiv_gpu_capi.cc
+++ b/intern/opensubdiv/opensubdiv_gpu_capi.cc
@@ -31,12 +31,18 @@
 
 #include "opensubdiv_capi.h"
 
+#ifdef _MSC_VER
+#  include "iso646.h"
+#endif
+
 #include <GL/glew.h>
 #include <vector>
 
 #include <opensubdiv/osd/glMesh.h>
 
-#include <opensubdiv/osd/cudaGLVertexBuffer.h>
+#ifdef OPENSUBDIV_HAS_CUDA
+#  include <opensubdiv/osd/cudaGLVertexBuffer.h>
+#endif
 #include <opensubdiv/osd/glDrawRegistry.h>
 
 // **************** Types declaration ****************




More information about the Bf-blender-cvs mailing list