diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2011-09-26 09:26:04 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2011-09-26 09:26:04 +0400 |
commit | 4b273f013e043d2f64997bc60f0058e0898e49b8 (patch) | |
tree | 202da65236a7b71e54a9ce9d93c9bc96c1e93828 /source/creator | |
parent | a932f93098ae64edbfd79ff3debe9712a55f2421 (diff) |
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.
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/CMakeLists.txt | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 0b5d9f7c15c..87fd880ee72 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -709,6 +709,63 @@ elseif(APPLE) \${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) |