]> git.mxchange.org Git - flightgear.git/commitdiff
Use Cmake to generate app-bundle on Mac
authorJames Turner <zakalawe@mac.com>
Fri, 14 Feb 2014 18:58:36 +0000 (18:58 +0000)
committerJames Turner <zakalawe@mac.com>
Fri, 14 Feb 2014 18:58:36 +0000 (18:58 +0000)
- build the .plist using CMake features
- update the nightly Mac packaging script for the new layout

CMakeModules/FlightGearBundleInfo.plist.in [new file with mode: 0644]
package/mac/build-mac-nightly-dmg.rb
package/mac/nightly.plist.in [deleted file]
src/Main/CMakeLists.txt

diff --git a/CMakeModules/FlightGearBundleInfo.plist.in b/CMakeModules/FlightGearBundleInfo.plist.in
new file mode 100644 (file)
index 0000000..b45a34e
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+       <key>CFBundleGetInfoString</key>
+       <string>${MACOSX_BUNDLE_INFO_STRING}</string>
+       <key>CFBundleIconFile</key>
+       <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+       <key>CFBundleIdentifier</key>
+       <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleLongVersionString</key>
+       <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+       <key>CFBundleName</key>
+       <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+       
+    <key>LSMinimumSystemVersion</key>
+    <string>10.6.0</string>
+       
+    <key>NSHumanReadableCopyright</key>
+       <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+</dict>
+</plist>
index 575c837fd1ec401170f9a75bdf95b2fb9c2eecf1..8ea313d59656e136b2afa193d2f56530743060d1 100755 (executable)
@@ -20,10 +20,6 @@ puts "Code signing identity is #{$codeSignIdentity}"
 
 puts "osgVersion=#{osgVersion}, so-number=#{$osgSoVersion}"
 
-$svnLibs = ['svn_client', 'svn_wc', 'svn_delta', 'svn_diff', 'svn_ra', 
-  'svn_ra_local', 'svn_repos', 'svn_fs', 'svn_fs_fs', 'svn_fs_util',
-  'svn_ra_svn', 'svn_subr', 'svn_ra_neon']
-
 def fix_install_names(object)
   #puts "fixing install names for #{object}"
   
@@ -46,6 +42,11 @@ puts "Erasing previous image dir"
 `rm -rf #{dmgDir}`
 
 bundle=dmgDir + "/FlightGear.app"
+
+puts "Moving & renaming app bundle"
+`mkdir -p #{dmgDir}`
+`mv #{$prefixDir}/fgfs.app #{bundle}`
+
 contents=bundle + "/Contents"
 macosDir=contents + "/MacOS"
 $frameworksDir=contents +"/Frameworks"
@@ -53,25 +54,6 @@ resourcesDir=contents+"/Resources"
 osgPluginsDir=contents+"/PlugIns/osgPlugins-#{osgVersion}"
 volName="\"FlightGear Nightly Build\""
 
-def fix_svn_install_names(object)
-  $svnLibs.each do |l|
-    fileName = "lib#{l}-1.0.dylib"
-    newName = "@executable_path/../Frameworks/#{fileName}"
-    `install_name_tool -change #{fileName} #{newName} #{object}`
-  end
-end
-
-def copy_svn_libs()
-  puts "Copying Subversion client libraries"
-  $svnLibs.each do |l|
-    libFile = "lib#{l}-1.0.dylib"
-    path = "#{$frameworksDir}/#{libFile}"
-    `cp #{$prefixDir}/lib/#{libFile} #{$frameworksDir}`
-    fix_svn_install_names(path)
-   # `install_name_tool -id #{libFile}  #{path}`    
-  end
-end
-
 def code_sign(path)
   puts "Signing #{path}"
   `codesign -s "#{$codeSignIdentity}" #{path}`
@@ -82,7 +64,6 @@ fgVersion = File.read("#{srcDir}/version").strip
 dmgPath = Dir.pwd + "/fg_mac_nightly_#{fgVersion}.dmg"
 
 puts "Creating directory structure"
-`mkdir -p #{macosDir}`
 `mkdir -p #{$frameworksDir}`
 `mkdir -p #{resourcesDir}`
 `mkdir -p #{osgPluginsDir}`
@@ -97,7 +78,6 @@ bins.each do |b|
   outPath = "#{macosDir}/#{b}"
   `cp #{$prefixDir}/bin/#{b} #{outPath}`
   fix_install_names(outPath)
-  fix_svn_install_names(outPath)
 end
 
 puts "copying libraries"
@@ -117,16 +97,6 @@ $osgPlugins.each do |p|
   fix_install_names("#{osgPluginsDir}/#{pluginFile}")
 end
 
-copy_svn_libs()
-
-# Info.plist
-template = File.read("#{srcDir}/package/mac/nightly.plist.in")
-output = ERB.new(template).result(binding)
-
-File.open("#{contents}/Info.plist", 'w') { |f|
-  f.write(output)
-}
-
 `cp #{srcDir}/package/mac/nightly-readme.rtf #{dmgDir}/ReadMe.rtf`
 `cp #{srcDir}/package/mac/FlightGear.icns #{resourcesDir}/FlightGear.icns`
 `cp #{srcDir}/COPYING #{dmgDir}`
diff --git a/package/mac/nightly.plist.in b/package/mac/nightly.plist.in
deleted file mode 100644 (file)
index 8ad6f12..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>CFBundleIconFile</key>
-       <string>FlightGear.icns</string>
-       <key>CFBundlePackageType</key>
-       <string>APPL</string>
-       <key>CFBundleGetInfoString</key>
-       <string>FlightGear nightly build</string>
-       <key>CFBundleSignature</key>
-       <string>????</string>
-       <key>CFBundleExecutable</key>
-       <string>FlightGear</string>
-       <key>CFBundleIdentifier</key>
-       <string>org.flightgear.FlightGear</string>
-       <key>CFBundleVersion</key>
-       <string><%= fgVersion %></string>
-       <key>CFBundleShortVersionString</key>
-       <string>unstable nightly build</string>
-       <key>LSMinimumSystemVersion</key>
-       <string>10.6.0</string>
-       <key>NSMainNibFile</key>
-       <string>MainMenu</string>
-       <key>NSPrincipalClass</key>
-       <string>NSApplication</string>
-</dict>
-</plist>
-
index 5512db22d651f0c54628252ada21f6f93f972efa..e6475ea7f36c094febce6a3ff5781f1b68bfe96d 100644 (file)
@@ -70,7 +70,34 @@ source_group("Main\\Sources" FILES ${SOURCES})
 # important we pass WIN32 here so the console is optional. Other
 # platforms ignore this option. If a console is needed we allocate
 # it manually via AllocConsole()
-add_executable(fgfs WIN32 ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
+# similarly pass MACOSX_BUNDLE so we generate a .app on Mac
+add_executable(fgfs WIN32 MACOSX_BUNDLE
+                ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
+
+#-----------------------------------------------------------------------------
+# MacOSX bundle packagaing
+
+if(APPLE)
+    execute_process(COMMAND date +%Y
+        OUTPUT_VARIABLE CURRENT_YEAR
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+        
+    # in our local CMakeModules dir
+    set_target_properties(fgfs PROPERTIES
+        MACOSX_BUNDLE_INFO_PLIST FlightGearBundleInfo.plist.in
+        MACOSX_BUNDLE_GUI_IDENTIFIER "org.flightgear.FlightGear"
+        MACOSX_BUNDLE_SHORT_VERSION_STRING ${FLIGHTGEAR_VERSION}
+        MACOSX_BUNDLE_LONG_VERSION_STRING "FlightGear ${FLIGHTGEAR_VERSION} Nightly"
+        MACOSX_BUNDLE_BUNDLE_VERSION ${FLIGHTGEAR_VERSION}
+        MACOSX_BUNDLE_COPYRIGHT "FlightGear ${FLIGHTGEAR_VERSION} © 1997-${CURRENT_YEAR}, The FlightGear Project. Licensed under the GNU Public License version 2."
+        MACOSX_BUNDLE_INFO_STRING "Nightly build of FlightGear ${FLIGHTGEAR_VERSION} for testing and development"
+        MACOSX_BUNDLE_BUNDLE_NAME "FlightGear"
+        MACOSX_BUNDLE_ICON_FILE "FlightGear.icns"
+    )
+endif()
+
+#-----------------------------------------------------------------------------
 
 get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
 #message(STATUS "fg libs ${FG_LIBS}")
@@ -110,7 +137,6 @@ target_link_libraries(fgfs
        ${OPENSCENEGRAPH_LIBRARIES}
        ${OPENGL_LIBRARIES}
        ${PLIB_LIBRARIES}
-       ${JPEG_LIBRARY}
        ${HLA_LIBRARIES}
        ${EVENT_INPUT_LIBRARIES}
        ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
@@ -118,7 +144,11 @@ target_link_libraries(fgfs
        ${PLATFORM_LIBS}
 )
 
-install(TARGETS fgfs RUNTIME DESTINATION bin)
+if (APPLE)  
+    install(TARGETS fgfs BUNDLE DESTINATION .)
+else()
+    install(TARGETS fgfs RUNTIME DESTINATION bin)
+endif()
 
 if(ENABLE_METAR)
     add_executable(metar metar_main.cxx)