diff --git a/cmake/MacOSXBundleInfo.plist.template b/cmake/MacOSXBundleInfo.plist.template index 56821efab..c62c2a16c 100644 --- a/cmake/MacOSXBundleInfo.plist.template +++ b/cmake/MacOSXBundleInfo.plist.template @@ -32,10 +32,5 @@ NSHumanReadableCopyright @MACOSX_BUNDLE_COPYRIGHT@ - LSEnvironment - - PREFIX_PATH - ../Resources - diff --git a/cmake/macros.cmake b/cmake/macros.cmake index e5b6e41e1..2c833b661 100644 --- a/cmake/macros.cmake +++ b/cmake/macros.cmake @@ -730,7 +730,7 @@ macro(cp_osx_add_target_properties TARGET VERSION VERSION_CODE) cp_set_properties(${TARGET} MACOSX_BUNDLE_COPYRIGHT "CaveProductions") cp_set_properties(${TARGET} MACOSX_BUNDLE_INFO_STRING "") cp_set_properties(${TARGET} MACOSX_BUNDLE_GUI_IDENTIFIER "org.${TARGET}") - cp_set_properties(${TARGET} MACOSX_BUNDLE_ICON_FILE "${TARGET}-icon.png") + cp_set_properties(${TARGET} MACOSX_BUNDLE_ICON_FILE "${TARGET}.icns") cp_set_properties(${TARGET} PROPERTIES XCODE_ATTRIBUTE_INSTALL_PATH "/Applications") if (IOS) if (RELEASE) @@ -931,9 +931,8 @@ macro(cp_add_executable) set(BIN_DIR "${_EXE_TARGET}.app/Contents/MacOS") install(FILES ${PROJECT_BINARY_DIR}/Info.plist DESTINATION ${SHARE_DIR} COMPONENT ${_EXE_TARGET}) install(FILES ${ROOT_DIR}/cmake/PKgInfo DESTINATION ${SHARE_DIR} COMPONENT ${_EXE_TARGET}) - endif() - - if (NOT TESTS) + install(FILES ${ROOT_DIR}/contrib/${_EXE_TARGET}.icns DESTINATION ${ICON_DIR} COMPONENT ${_EXE_TARGET}) + elseif (NOT TESTS) set(ICON "${_EXE_TARGET}-icon.png") if (EXISTS ${ROOT_DIR}/contrib/${ICON}) install(FILES ${ROOT_DIR}/contrib/${ICON} DESTINATION ${ICON_DIR} COMPONENT ${_EXE_TARGET}) diff --git a/contrib/assets/sources/background-osx-dmg.xcf.bz2 b/contrib/assets/sources/background-osx-dmg.xcf.bz2 new file mode 100644 index 000000000..6cf2de215 Binary files /dev/null and b/contrib/assets/sources/background-osx-dmg.xcf.bz2 differ diff --git a/contrib/caveexpress.icns b/contrib/caveexpress.icns new file mode 100644 index 000000000..bcaf4a76d Binary files /dev/null and b/contrib/caveexpress.icns differ diff --git a/contrib/caveexpresshd.icns b/contrib/caveexpresshd.icns new file mode 100644 index 000000000..6d94ff9de Binary files /dev/null and b/contrib/caveexpresshd.icns differ diff --git a/contrib/cavepacker.icns b/contrib/cavepacker.icns new file mode 100644 index 000000000..801d9e7c5 Binary files /dev/null and b/contrib/cavepacker.icns differ diff --git a/contrib/icon.icns b/contrib/icon.icns new file mode 100644 index 000000000..bcaf4a76d Binary files /dev/null and b/contrib/icon.icns differ diff --git a/contrib/installer/osx/background.png b/contrib/installer/osx/background.png new file mode 100644 index 000000000..708bb1f38 Binary files /dev/null and b/contrib/installer/osx/background.png differ diff --git a/contrib/scripts/create_dmg.sh b/contrib/scripts/create_dmg.sh new file mode 100755 index 000000000..8776dd067 --- /dev/null +++ b/contrib/scripts/create_dmg.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +# by Andy Maloney +# http://asmaloney.com/2013/07/howto/packaging-a-mac-os-x-application-using-a-dmg/ + +dir=${0%/*} +if [ -d "$dir" ]; then + pushd "$dir" +fi + +pushd ../../../cp-build-osx + +# ./contrib/scripts/create_dmg.sh caveexpress 2.4 + +# set up your app name, version number, and background image file name +APP_NAME="$1" +VERSION="$2" +DMG_BACKGROUND_IMG="Background.png" +cp "../caveexpress/contrib/installer/osx/background.png" ${DMG_BACKGROUND_IMG} + +# you should not need to change these +APP_EXE="${APP_NAME}.app/Contents/MacOS/${APP_NAME}" + +VOL_NAME="${APP_NAME} ${VERSION}" # volume name will be "SuperCoolApp 1.0.0" +DMG_TMP="${VOL_NAME}-temp.dmg" +DMG_FINAL="${VOL_NAME}.dmg" # final DMG name will be "SuperCoolApp 1.0.0.dmg" +STAGING_DIR="./Install" # we copy all our stuff into this dir + +# clear out any old data +rm -rf "${STAGING_DIR}" "${DMG_TMP}" "${DMG_FINAL}" + +# copy over the stuff we want in the final disk image to our staging dir +mkdir -p "${STAGING_DIR}" +cp -rpf "${APP_NAME}.app" "${STAGING_DIR}" +# ... cp anything else you want in the DMG - documentation, etc. + +pushd "${STAGING_DIR}" + +# strip the executable +echo "Stripping ${APP_EXE}..." +strip -u -r "${APP_EXE}" + +# compress the executable if we have upx in PATH +# UPX: http://upx.sourceforge.net/ +if hash upx 2>/dev/null; then + echo "Compressing (UPX) ${APP_EXE}..." + upx -9 "${APP_EXE}" +fi + +# ... perform any other stripping/compressing of libs and executables + +popd + +# figure out how big our DMG needs to be +# assumes our contents are at least 1M! +SIZE=`du -sh "${STAGING_DIR}" | sed 's/\([0-9\.]*\)M\(.*\)/\1/'` +SIZE=`echo "${SIZE} + 1.0" | bc | awk '{print int($1+0.5)}'` + +if [ $? -ne 0 ]; then + echo "Error: Cannot compute size of staging dir" + exit +fi + +# create the temp DMG file +hdiutil create -srcfolder "${STAGING_DIR}" -volname "${VOL_NAME}" -fs HFS+ \ + -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${SIZE}M "${DMG_TMP}" + +echo "Created DMG: ${DMG_TMP} with size ${SIZE}" + +# mount it and save the device +DEVICE=$(hdiutil attach -readwrite -noverify "${DMG_TMP}" | \ + egrep '^/dev/' | sed 1q | awk '{print $1}') + +sleep 2 + +# add a link to the Applications dir +echo "Add link to /Applications" +pushd /Volumes/"${VOL_NAME}" +ln -s /Applications +popd + +# add a background image +mkdir /Volumes/"${VOL_NAME}"/.background +cp "${DMG_BACKGROUND_IMG}" /Volumes/"${VOL_NAME}"/.background/ + +# tell the Finder to resize the window, set the background, +# change the icon size, place the icons in the right position, etc. +echo ' + tell application "Finder" + tell disk "'${VOL_NAME}'" + open + set current view of container window to icon view + set toolbar visible of container window to false + set statusbar visible of container window to false + set the bounds of container window to {400, 100, 920, 440} + set viewOptions to the icon view options of container window + set arrangement of viewOptions to not arranged + set icon size of viewOptions to 72 + set background picture of viewOptions to file ".background:'${DMG_BACKGROUND_IMG}'" + set position of item "'${APP_NAME}'.app" of container window to {160, 205} + set position of item "Applications" of container window to {360, 205} + close + open + update without registering applications + delay 2 + end tell + end tell +' | osascript + +sync + +# unmount it +hdiutil detach "${DEVICE}" + +# now make the final image a compressed disk image +echo "Creating compressed image" +hdiutil convert "${DMG_TMP}" -format UDZO -imagekey zlib-level=9 -o "${DMG_FINAL}" + +# clean up +rm -rf "${DMG_TMP}" +rm -rf "${STAGING_DIR}" + +echo 'Done.' + +exit \ No newline at end of file diff --git a/contrib/scripts/create_icns.sh b/contrib/scripts/create_icns.sh new file mode 100755 index 000000000..eb1f0aa23 --- /dev/null +++ b/contrib/scripts/create_icns.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +export PROJECT=caveexpress +export ICONDIR=$PROJECT.app/Contents/Resources/$PROJECT.iconset +export ORIGICON=../caveexpress/contrib/icon-512x512.png + +mkdir $ICONDIR + +# Normal screen icons +for SIZE in 16 32 64 128 256 512; do +sips -z $SIZE $SIZE $ORIGICON --out $ICONDIR/icon_${SIZE}x${SIZE}.png ; +done + +# Retina display icons +for SIZE in 16 32 64 128 256 512; do +sips -z $SIZE $SIZE $ORIGICON --out $ICONDIR/icon_$(expr $SIZE / 2)x$(expr $SIZE / 2)x2.png ; +done + +# Make a multi-resolution Icon +iconutil -c icns -o $PROJECT.app/Contents/Resources/$PROJECT.icns $ICONDIR +rm -rf $ICONDIR #it is useless now \ No newline at end of file