Skip to content

Commit

Permalink
More Mac OS X bundle support for CMake/CPack
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/mmapper/code/trunk/mmapper@164 14c008a5-6e10-0410-bf79-c100e0f1932b
  • Loading branch information
nschimme committed Jun 14, 2009
1 parent 31c36fe commit d5ac0b4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 11 deletions.
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ else (NOT MINGW)
message(STATUS "Warning: MingW requires zlib to be installed manually")
endif (NOT MINGW)

# Version
set(VERSION "2.0.4-final2")

# Get SVN revision number
find_package(Subversion)
if (Subversion_FOUND)
Expand All @@ -36,10 +39,21 @@ if (UNIX)
endif (UNIX)

if (APPLE)
# In order to build a universal binary we need the following two lines:
add_definitions(-DCMAKE_OSX_SYSROOT="/Developer/SDKs/MacOSX10.4u.sdk")
add_definitions(-DCMAKE_OSX_ARCHITECTURES="ppc;i386")
message(STATUS "Warning: For deployment you should have compiled Qt statically")
# This is bundle metadata to create "bundles" and "Universal Binaries" on
# Mac OS X
# http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_build_universal_binaries_on_Mac_OS_X.3F
# By the way, there is a bug in the cross-compilation SDKs for
# Tiger in Leopard, so you need to follow these instructions:
# http://groups.google.com/group/vim_mac/browse_thread/thread/064da55ec412e768
# which means typing the following command in Terminal.app:
# $ sudo ln -s /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.o /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.10.5.o

# In order to build a universal binary we need the following line:
set(CMAKE_OSX_ARCHITECTURES ppc;i386)

# To support much older OSX machines we need the following lines:
#set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk)
#set(CMAKE_FIND_ROOT_PATH /Developer/SDKs/MacOSX10.4u.sdk)
endif (APPLE)

add_subdirectory(src)
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ else
cd build
fi

cmake ../ -DCMAKE_INSTALL_REFIX=. && make -j$JFLAG && make install
cmake ../ -DCMAKE_INSTALL_REFIX=. && make -j$JFLAG && make package
39 changes: 33 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ QT4_WRAP_CPP(mmapper_MOC_SRCS ${mmapper_MOC_HDRS})
QT4_WRAP_UI(mmapper_UIS_H ${mmapper_UIS})
QT4_ADD_RESOURCES(mmapper_RCC_SRCS ${mmapper_RCS})

add_executable(mmapper WIN32
add_executable(mmapper WIN32 MACOSX_BUNDLE
${mmapper_SRCS}
${mmapper_MOC_SRCS}
${mmapper_UIS_H}
Expand Down Expand Up @@ -288,40 +288,67 @@ endif (WIN32)

# Apple Install Settings
if (APPLE)
# Bundle the libraries with the binary (requires Qt 4.5)
add_custom_command(
TARGET mmapper
POST_BUILD
COMMAND macdeployqt ${CMAKE_CURRENT_BINARY_DIR}/mmapper.app
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Deploying the Qt Framework onto the bundle"
)

# Install Executables
install(
TARGETS mmapper
RUNTIME DESTINATION bin
BUNDLE DESTINATION ../Applications/MMapper
COMPONENT applications
)

# Install Map
install(
FILES ${PROJECT_SOURCE_DIR}/map/arda.mm2
DESTINATION bin
DESTINATION ../Applications/MMapper
COMPONENT map
)

# Install Help Documentation
install(FILES
"${PROJECT_SOURCE_DIR}/doc/Installation Guide.URL"
"${PROJECT_SOURCE_DIR}/doc/mapping_advice.txt"
DESTINATION bin
DESTINATION ../Applications/MMapper
COMPONENT help
)

# If we are supporting older machines, use the following
set(CPACK_OSX_PACKAGE_VERSION 10.5)

# Package Settings
set(CPACK_GENERATOR "PackageMaker")
set(CPACK_SOURCE_GENERATOR "TGZ")

# Libraries are bundled directly
set(CPACK_COMPONENT_LIBRARIES_HIDDEN TRUE)

# Bundle Properties
#SET(MACOSX_BUNDLE_ICON_FILE icon.icns)
SET(MACOSX_BUNDLE_BUNDLE_NAME MMapper)
SET(MACOSX_BUNDLE_BUNDLE_VERSION ${VERSION})
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING ${VERSION})
SET(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${VERSION}")

endif (APPLE)

# More General CPack Settings
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/INSTALL.txt")
#set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/INSTALL.txt")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "Nils Schimmelmann")
set(CPACK_PACKAGE_CONTACT "nschimme@gmail.com")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A mud mapper especially written for the mud MUME")
if (SVN_BUILD)
set(CPACK_PACKAGE_VERSION "svn-build-${SVN_BUILD}")
else (SVN_BUILD)
set(CPACK_PACKAGE_VERSION "2.0.4-final2")
set(CPACK_PACKAGE_VERSION ${VERSION})
endif (SVN_BUILD)
set(CPACK_PACKAGE_VERSION_MAJOR "2")
set(CPACK_PACKAGE_VERSION_MINOR "0")
Expand Down

0 comments on commit d5ac0b4

Please sign in to comment.