[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40548] trunk/blender/source/creator/ CMakeLists.txt: cmake files for bundling blenderplayer in OSX

Dalai Felinto dfelinto at gmail.com
Mon Sep 26 07:26:04 CEST 2011


Revision: 40548
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40548
Author:   dfelinto
Date:     2011-09-26 05:26:04 +0000 (Mon, 26 Sep 2011)
Log Message:
-----------
cmake files for bundling blenderplayer in OSX
this is working fine. The only problem is described in the XXX there.

While Blender is linked to the right place during `make` time (~/bin/blender.app/Content/MacOS/blender)
blenderplayer is in the top bin folder (~/bin/blenderplayer).

That means it will be correct only after you run `make install` (we are moving it to the right place inside the bundle).
I couldn't find the place to fix this properly. I will see with Jens Verwiebe how we can address that.

Modified Paths:
--------------
    trunk/blender/source/creator/CMakeLists.txt

Modified: trunk/blender/source/creator/CMakeLists.txt
===================================================================
--- trunk/blender/source/creator/CMakeLists.txt	2011-09-26 05:10:37 UTC (rev 40547)
+++ trunk/blender/source/creator/CMakeLists.txt	2011-09-26 05:26:04 UTC (rev 40548)
@@ -709,6 +709,63 @@
 			\${TARGETDIR_VER}
 		)
 	endif()
+
+	# install blenderplayer bundle - copy of blender.app above. re-using macros et al
+	if(WITH_GAMEENGINE AND WITH_PLAYER)
+		set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app)
+		set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
+		set(TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION})
+
+		# setup Info.plist
+		execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+		# important to make a clean install each time else old scripts get loaded.
+		install(
+			CODE
+			"file(REMOVE_RECURSE ${TARGETDIR_VER})"
+		)
+	
+		# message after building.
+		add_custom_command(
+			TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+			COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}'
+		)
+	
+		install(
+			FILES ${SOURCEDIR}/Contents/PkgInfo
+			DESTINATION ${TARGETDIR}/blenderplayer.app/Contents
+		)
+
+		install_dir(
+			${SOURCEDIR}/Contents/Resources
+			\${TARGETDIR}/blenderplayer.app/Contents/
+		)
+
+		# python
+		if(WITH_PYTHON)
+			add_custom_command(
+				OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
+				COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/
+				COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/
+				COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/
+				DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
+	
+			# copy extracted python files
+			install_dir(
+				${CMAKE_CURRENT_BINARY_DIR}/python
+				\${TARGETDIR_VER}
+			)
+		endif()
+
+		# This is a hack. Blender is linked to the right place (inside the .app)
+		# blenderplayer not ... that also means blenderplayer is in the right place
+		# only when we do make install. XXX to be fixed.
+		install(
+			CODE
+			"file(RENAME ${TARGETDIR}/blenderplayer ${TARGETDIR}/blenderplayer.app/Contents/MacOS/blenderplayer)"
+		)
+	
+	endif()
 endif()
 
 unset(BLENDER_TEXT_FILES)




More information about the Bf-blender-cvs mailing list