mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-29 18:50:05 +00:00
Create a macOS .app bundle
This commit is contained in:
parent
ccd27980a2
commit
16a962dbec
3 changed files with 107 additions and 3 deletions
BIN
scwx-qt/res/icons/scwx.icns
Normal file
BIN
scwx-qt/res/icons/scwx.icns
Normal file
Binary file not shown.
42
scwx-qt/res/scwx-qt.plist.in
Normal file
42
scwx-qt/res/scwx-qt.plist.in
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?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>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
|
||||
<key>CFBundleName</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
|
||||
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleAllowMixedLocalizations</key>
|
||||
<true/>
|
||||
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -626,6 +626,26 @@ if (WIN32)
|
|||
if (SCWX_DISABLE_CONSOLE)
|
||||
set_target_properties(supercell-wx PROPERTIES WIN32_EXECUTABLE $<IF:$<CONFIG:Release>,TRUE,FALSE>)
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
set(SCWX_ICON "${scwx-qt_SOURCE_DIR}/res/icons/scwx.icns")
|
||||
|
||||
set_source_files_properties(${SCWX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
|
||||
qt_add_executable(supercell-wx ${EXECUTABLE_SOURCES} ${SCWX_ICON})
|
||||
|
||||
string(TIMESTAMP CURRENT_YEAR "%Y")
|
||||
|
||||
set_target_properties(supercell-wx PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_INFO_LIST "${scwx-qt_SOURCE_DIR}/res/scwx-qt.plist.in"
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "net.supercellwx.app"
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "Supercell Wx"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION "${SCWX_VERSION}"
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "${SCWX_VERSION}"
|
||||
MACOSX_BUNDLE_COPYRIGHT "Copyright ${CURRENT_YEAR} Dan Paulat"
|
||||
MACOSX_BUNDLE_ICON_FILE "scwx.icns"
|
||||
MACOSX_BUNDLE_INFO_STRING "Free and open source advanced weather radar"
|
||||
RESOURCE ${SCWX_ICON})
|
||||
else()
|
||||
qt_add_executable(supercell-wx ${EXECUTABLE_SOURCES})
|
||||
endif()
|
||||
|
|
@ -735,9 +755,11 @@ target_link_libraries(scwx-qt PUBLIC Qt${QT_VERSION_MAJOR}::Widgets
|
|||
target_link_libraries(supercell-wx PRIVATE scwx-qt
|
||||
wxdata)
|
||||
|
||||
# Set DT_RUNPATH for Linux targets
|
||||
set_target_properties(MLNQtCore PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") # QMapLibre::Core
|
||||
set_target_properties(supercell-wx PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib")
|
||||
if (LINUX)
|
||||
# Set DT_RUNPATH for Linux targets
|
||||
set_target_properties(MLNQtCore PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib") # QMapLibre::Core
|
||||
set_target_properties(supercell-wx PROPERTIES INSTALL_RPATH "\$ORIGIN/../lib")
|
||||
endif()
|
||||
|
||||
install(TARGETS supercell-wx
|
||||
MLNQtCore # QMapLibre::Core
|
||||
|
|
@ -747,6 +769,10 @@ install(TARGETS supercell-wx
|
|||
"^(/usr)?/lib/.*\\.so(\\..*)?"
|
||||
RUNTIME
|
||||
COMPONENT supercell-wx
|
||||
BUNDLE
|
||||
DESTINATION .
|
||||
COMPONENT supercell-wx
|
||||
OPTIONAL
|
||||
LIBRARY
|
||||
COMPONENT supercell-wx
|
||||
OPTIONAL
|
||||
|
|
@ -773,6 +799,42 @@ install(SCRIPT ${deploy_script_qmaplibre_core}
|
|||
install(SCRIPT ${deploy_script_scwx}
|
||||
COMPONENT supercell-wx)
|
||||
|
||||
if (APPLE)
|
||||
# Install additional script to fix up the bundle
|
||||
install(CODE [[
|
||||
include (BundleUtilities)
|
||||
|
||||
# Define the bundle path
|
||||
set(BUNDLE_PATH "${CMAKE_INSTALL_PREFIX}/supercell-wx.app")
|
||||
|
||||
file(GLOB_RECURSE PLUGIN_DYLIBS "${BUNDLE_PATH}/Contents/PlugIns/**/*.dylib")
|
||||
|
||||
# Add the correct rpath for plugins to find bundled frameworks
|
||||
foreach(PLUGIN_DYLIB ${PLUGIN_DYLIBS})
|
||||
execute_process(
|
||||
COMMAND install_name_tool -add_rpath "@loader_path/../../Frameworks"
|
||||
${PLUGIN_DYLIB}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# Fix up the bundle with all dependencies
|
||||
fixup_bundle(
|
||||
"${BUNDLE_PATH}"
|
||||
""
|
||||
"${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/Frameworks"
|
||||
)
|
||||
|
||||
# Re-sign the bundle
|
||||
execute_process(
|
||||
COMMAND codesign --force --deep --sign - "${BUNDLE_PATH}"
|
||||
)
|
||||
|
||||
# Verify the bundle
|
||||
verify_app("${BUNDLE_PATH}")
|
||||
]]
|
||||
COMPONENT supercell-wx)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
set(CPACK_PACKAGE_NAME "Supercell Wx")
|
||||
set(CPACK_PACKAGE_VENDOR "Dan Paulat")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue