tools/CMakeLists.txt
branchwebgl
changeset 9521 8054d9d775fd
parent 9347 5b582d49358c
child 9679 dfaa39674e1e
child 9961 c18c66d621e5
--- a/tools/CMakeLists.txt	Fri Oct 11 11:55:31 2013 +0200
+++ b/tools/CMakeLists.txt	Fri Oct 11 17:43:13 2013 +0200
@@ -50,10 +50,25 @@
         message(FATAL_ERROR "The utility macdeployqt is required to create the bundle (seached: ${qt_base_dir})")
     endif()
 
-    #dummy target, we're interested in the postscript file
-    add_custom_target(bundle)
-    set_target_properties(bundle PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake)
+    #create the .app bundle
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CreateMacBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake)
+    install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake
+            CODE "message(STATUS \"Your app bundle is ready\")")
 
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CreateMacBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake)
+    #create the .dmg for deployment
+    #first make sure .app exists, then remove any old .dmg with same name, finally run the script
+    add_custom_target(dmg COMMAND if [ ! -a Hedgewars.app ]; then make install\; fi;
+                          COMMAND rm -f ${CMAKE_BINARY_DIR}/Hedgewars-${HEDGEWARS_VERSION}.dmg
+                          COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/create-dmg.sh
+                                  --volname "Hedgewars ${HEDGEWARS_VERSION}"
+                                # --volicon icon.icns
+                                  --window-size 600 470
+                                  --icon-size 96
+                                  --icon "Hedgewars" 190 190
+                                  --app-drop-link 410 190
+                                  --background "${CMAKE_CURRENT_SOURCE_DIR}/../misc/dmgBackground.png"
+                                  ${CMAKE_BINARY_DIR}/Hedgewars-${HEDGEWARS_VERSION}.dmg
+                                  ${CMAKE_BINARY_DIR}/Hedgewars.app
+                          WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
 endif()