From c21db677219fbd0f877906696bdcecf1aa8613f5 Mon Sep 17 00:00:00 2001 From: Karl Goetz Date: Sun, 15 Feb 2015 17:22:35 +1100 Subject: [PATCH] Changes to make package build and run on osx MegaGlest is the correct spelling, the process of building a package upper cases the binary so I'm removing my modification via an earlier branch. This also sets CUSTOM_DATA_INSTALL_PATH to /Applications - this is the final step in getting MegaGlest.app to launch after building and installing. The previously hard coded path was ok for gnumake but failed when Xcode got involved as it has build types (release/debug/et al) which the hard coding didn't support. I've added an if/else catch for the two build types that i've seen while working on megaglest and it should be trivial to add any others that may be desirable. There is still an outstanding issue of embedding dependencies or using system provided dependancies which I haven't sorted out. --- mk/macosx/CMakeLists.txt | 18 +++++++++++++++++- mk/macosx/Info.plist | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mk/macosx/CMakeLists.txt b/mk/macosx/CMakeLists.txt index cecf5f9b..ba39c027 100644 --- a/mk/macosx/CMakeLists.txt +++ b/mk/macosx/CMakeLists.txt @@ -29,6 +29,9 @@ ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE) INCLUDE_DIRECTORIES(/opt/local/include) LINK_DIRECTORIES(/opt/local/lib) +# Set custom data path as macos apps don't use /local/ +SET(CUSTOM_DATA_INSTALL_PATH "/Applications/MegaGlest.app/Contents/Resources/share/megaglest/") + ##install part # This changes Info.plist from something with variables and CMakeisms to @@ -48,7 +51,20 @@ set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns") set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/docs/COPYRIGHT.source_code.txt") set (CPACK_BUNDLE_NAME "MegaGlest") -set (CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/data/glest_game/megaglest") + +# This variable changs depending on the build type +IF(CMAKE_GENERATOR STREQUAL Xcode) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + set (CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/source/glest_game/Release/megaglest") + ELSEIF(CMAKE_BUILD_TYPE STREQUAL Debug) + set (CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/source/glest_game/Debug/megaglest") + ENDIF() +ELSE() +# Assume gnumake + set (CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/source/glest_game/megaglest") +ENDIF() + + set (CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/MegaGlest.icns") set (CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist") diff --git a/mk/macosx/Info.plist b/mk/macosx/Info.plist index 25372035..bcef4570 100644 --- a/mk/macosx/Info.plist +++ b/mk/macosx/Info.plist @@ -5,9 +5,9 @@ CFBundleDevelopmentRegion English CFBundleExecutable - megaglest + MegaGlest CFBundleGetInfoString - ${VER_MAJOR}.${VER_MINOR}.${VER_RELEASE}, © 2001-2015 The Glest Team All Rights Reserved. + ${VER_MAJOR}.${VER_MINOR}.${VER_RELEASE}, © 2001-2015 The MegaGlest Team. CFBundleIconFile MegaGlest CFBundleIdentifier