OSX: fix player bundle_creation

This commit is contained in:
Jens Verwiebe 2011-09-27 10:51:57 +00:00
parent 768806adc0
commit 7ba71fff8c
2 changed files with 60 additions and 24 deletions

@ -63,8 +63,18 @@ if(WIN32 AND NOT UNIX)
endif()
add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
elseif(APPLE)
add_executable(blenderplayer MACOSX_BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
# setup Info.plist
execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app)
set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist)
set_target_properties(blenderplayer PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${PLAYER_SOURCEINFO}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
else()
add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
endif()

@ -713,40 +713,66 @@ elseif(APPLE)
# install blenderplayer bundle - copy of blender.app above. re-using macros et al
# note we are using OSX Bundle as base and copying Blender dummy bundle on top of it
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})
set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app)
set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist)
set(PLAYER_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)
set_target_properties(blender PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${SOURCEINFO}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
# important to make a clean install each time else old scripts get loaded.
# 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}'
"file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})"
)
# handy install macro to exclude files, we use \$ escape for the "to"
# argument when calling so ${BUILD_TYPE} does not get expanded
macro(install_dir from to)
install(
DIRECTORY ${from}
DESTINATION ${to}
PATTERN ".svn" EXCLUDE
PATTERN "*.pyc" EXCLUDE
PATTERN "*.pyo" EXCLUDE
PATTERN "*.orig" EXCLUDE
PATTERN "*.rej" EXCLUDE
PATTERN "__pycache__" EXCLUDE
PATTERN "__MACOSX" EXCLUDE
PATTERN ".DS_Store" EXCLUDE
)
endmacro()
install(
FILES ${SOURCEDIR}/Contents/PkgInfo
FILES ${PLAYER_SOURCEDIR}/Contents/PkgInfo
DESTINATION ${TARGETDIR}/blenderplayer.app/Contents
)
install_dir(
${SOURCEDIR}/Contents/Resources
${PLAYER_SOURCEDIR}/Contents/Resources
\${TARGETDIR}/blenderplayer.app/Contents/
)
install(
FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
DESTINATION ${PLAYER_TARGETDIR_VER}
)
# localization
if(WITH_INTERNATIONAL)
install(
FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
DESTINATION ${PLAYER_TARGETDIR_VER}/datafiles
)
install(
DIRECTORY
${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts
${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
DESTINATION ${PLAYER_TARGETDIR_VER}/datafiles
PATTERN ".svn" EXCLUDE
)
endif()
# python
if(WITH_PYTHON)
add_custom_command(
@ -759,10 +785,10 @@ elseif(APPLE)
# copy extracted python files
install_dir(
${CMAKE_CURRENT_BINARY_DIR}/python
\${TARGETDIR_VER}
\${PLAYER_TARGETDIR_VER}
)
endif()
endif()
endif()