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.
This commit is contained in:
Dalai Felinto 2011-09-26 05:26:04 +00:00
parent a932f93098
commit 4b273f013e

@ -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)