OSX: fix player bundle_creation
authorJens Verwiebe <info@jensverwiebe.de>
Tue, 27 Sep 2011 10:51:57 +0000 (10:51 +0000)
committerJens Verwiebe <info@jensverwiebe.de>
Tue, 27 Sep 2011 10:51:57 +0000 (10:51 +0000)
source/blenderplayer/CMakeLists.txt
source/creator/CMakeLists.txt

index 3ab1b4a3cdd9f2ff6282c1760266ded07b58b8df..82847cb8079711e70664961ae725728881d669f7 100644 (file)
@@ -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()
index 0bd2763c7d20f839ebf9e3b1d3006fff4b828b9b..a2cd7c23c061ef906cb01afcc5fe2bdf63694390 100644 (file)
@@ -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()