[Bf-blender-cvs] [e01449f] soc-2014-viewport_fx: Fixes and workarounds for build problems: Windows 8.1, CMake 2.8.12.2, MSVC 2013

Jason Wilkins noreply at git.blender.org
Thu Jun 12 03:28:13 CEST 2014


Commit: e01449fa4bb0df252d32a3b98ee1e8f195923d96
Author: Jason Wilkins
Date:   Sat Jun 7 03:13:05 2014 -0500
https://developer.blender.org/rBe01449fa4bb0df252d32a3b98ee1e8f195923d96

Fixes and workarounds for build problems: Windows 8.1, CMake 2.8.12.2, MSVC 2013

Cmake bug(?) workaround for zlib and png:
FindPNG.cmake calls find_package(zlib) and for some reason that redundant call
causes both zlib and png to not be found properly.
(Or, at least they complain, as this does not seem to cause a build error later)
Since zlib will be found by find_package(png),
it should be OK to not call find_package(zlib) explicitly.

Setting JPEG_NAME seems to be required by any version of MSVC, not just 9,
so changed check from MSVC09 to just MSVC

The proper Boost static libraries are not found unless the following variables are set:
set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
set(Boost_USE_MULTITHREADED  ON) # suffix -mt
set(Boost_USE_STATIC_LIBS    ON) # suffix -s

Note: The debug versions of the opencollada libraries are missing from windows_v12,
but this cannot be worked around (except to disable opencollada for debug builds)
because the value of _ITERATOR_DEBUG_LEVEL is different between opencollada and the
rest of Blender, so cannot just use the release versions with a debug build.
The fix would be to add the _d versions to the library directory.

Set /SAFESEH:NO to fix linker error related to libjpeg
(not sure why libjpeg is not compatible with this flag)
Also quiets warning about ignoring  /EDITANDCONTINUE due to having /SAFESEH enabled

Some typos in buildinfo.cmake fixed.

In buildinfo.cmake, trying to determine if a branch is modified when it
has no upstream branch kills the build, so added ERROR_QUIET where upstream
check was done.

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

M	CMakeLists.txt
M	build_files/cmake/buildinfo.cmake

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7385182..8dd132a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1028,7 +1028,7 @@ elseif(WIN32)
 		set(CXX_WARNINGS "${_WARNINGS}")
 		unset(_WARNINGS)
 
-		set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
+		set(PLATFORM_LINKFLAGS "/SAFESEH:NO /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
 
 		# MSVC only, Mingw doesnt need
 		if(CMAKE_CL_64)
@@ -1071,7 +1071,11 @@ elseif(WIN32)
 		set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
 		set(ZLIB_LIBRARY ${LIBDIR}/zlib/lib/libz_st.lib)
 		set(ZLIB_DIR ${LIBDIR}/zlib)
-		find_package(zlib) # we want to find before finding things that depend on it like png
+		# XXX: Cmake bug(?) workaround for zlib and png:
+		# FindPNG.cmake calls find_package(zlib) and for some reason that redundant call causes both zlib and png to not be found properly.
+		# (Or, at least they complain, as this does not seem to cause a build error later)
+		# Since zlib will be found by find_package(png), it should be OK to not call find_package(zlib) explicitly.
+		#find_package(zlib) # we want to find before finding things that depend on it like png
 
 
 		find_package(png)
@@ -1084,7 +1088,7 @@ elseif(WIN32)
 			set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
 		endif()
 
-		if(MSVC90)
+		if(MSVC)
 			set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
 		endif()
 		find_package(jpeg REQUIRED)
@@ -1216,6 +1220,9 @@ elseif(WIN32)
 			if(WITH_INTERNATIONAL)
 				list(APPEND boost_extra_libs locale)
 			endif(WITH_INTERNATIONAL)
+			set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
+			set(Boost_USE_MULTITHREADED  ON) # suffix -mt
+			set(Boost_USE_STATIC_LIBS    ON) # suffix -s
 			find_package(Boost COMPONENTS date_time filesystem thread regex system ${boost_extra_libs})
 			IF(NOT Boost_FOUND)
 				message(WARNING "USING HARDCODED boost locations")
diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake
index c1d21c4..245d747 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -2,12 +2,12 @@
 # ./source/creator/CMakeLists.txt to write ./source/creator/buildinfo.h
 
 # Extract working copy information for SOURCE_DIR into MY_XXX variables
-# with a default in case anything fails, for examble when using git-svn
+# with a default in case anything fails, for example when using git-svn
 set(MY_WC_HASH "unknown")
 set(MY_WC_BRANCH "unknown")
 set(MY_WC_COMMIT_TIMESTAMP 0)
 
-# Guess if this is a SVN working copy and then look up the revision
+# Guess if this is a git working copy and then look up the revision
 if(EXISTS ${SOURCE_DIR}/.git)
 	# The FindGit.cmake module is part of the standard distribution
 	include(FindGit)
@@ -60,7 +60,8 @@ if(EXISTS ${SOURCE_DIR}/.git)
 			execute_process(COMMAND git log HEAD..@{u}
 			                WORKING_DIRECTORY ${SOURCE_DIR}
 			                OUTPUT_VARIABLE _git_below_check
-			                OUTPUT_STRIP_TRAILING_WHITESPACE)
+			                OUTPUT_STRIP_TRAILING_WHITESPACE
+			                ERROR_QUIET)
 			if(NOT _git_below_check STREQUAL "")
 				# If there're commits between HEAD and upstream this means
 				# that we're reset-ed to older revision. Use it's hash then.
@@ -106,7 +107,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
 		if(NOT _git_changed_files STREQUAL "")
 			set(MY_WC_BRANCH "${MY_WC_BRANCH} (modified)")
 		else()
-			# Unpushed commits are also considered local odifications
+			# Unpushed commits are also considered local modifications
 			execute_process(COMMAND git log @{u}..
 			                WORKING_DIRECTORY ${SOURCE_DIR}
 			                OUTPUT_VARIABLE _git_unpushed_log
@@ -123,7 +124,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
 endif()
 
 # BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
-# but BUILD_DATE and BUILD_TIME are plataform dependant
+# but BUILD_DATE and BUILD_TIME are platform dependent
 if(UNIX)
 	execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
 	execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)




More information about the Bf-blender-cvs mailing list