Setup macOS bundle for celestia-qt

pull/347/head
Li Linfeng 2019-08-03 12:42:24 +08:00 committed by Hleb Valoshka
parent ad8eda79f4
commit 19d36c0d2d
4 changed files with 67 additions and 4 deletions

View File

@ -17,6 +17,7 @@ endif()
project(celestia)
set(VERSION "1.7.0")
set(DISPLAY_NAME "Celestia")
#
#
#
@ -183,8 +184,21 @@ foreach (_variableName ${_variableNames})
endforeach()
]]#
set(DATADIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
set(FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
########### macOS Bundling ###############
if(NATIVE_OSX_APP)
message(STATUS "Generating Info.plist for macOS Bundle")
configure_file(${CMAKE_SOURCE_DIR}/Info.plist.in ${CMAKE_BINARY_DIR}/Info.plist @ONLY)
endif()
if(NATIVE_OSX_APP)
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.app/Contents")
set(CMAKE_INSTALL_FULL_LOCALEDIR "${CMAKE_INSTALL_PREFIX}/Resources/locale")
set(DATADIR "${CMAKE_INSTALL_PREFIX}/Resources")
set(FULL_DATADIR "${CMAKE_INSTALL_PREFIX}/Resources")
else()
set(DATADIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
set(FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
endif()
if (NOT GIT_COMMIT)
find_program(GIT_FOUND git)
@ -274,6 +288,10 @@ set(BASE_DATA_SOURCES
install(FILES ${BASE_DATA_SOURCES} DESTINATION ${DATADIR})
install(FILES "splash.png" DESTINATION "${DATADIR}/splash")
if(NATIVE_OSX_APP)
install(FILES ${CMAKE_BINARY_DIR}/Info.plist DESTINATION .)
endif()
add_subdirectory(src)
add_subdirectory(po)
add_subdirectory(po2)

36
Info.plist.in 100644
View File

@ -0,0 +1,36 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>celestia-qt</string>
<key>CFBundleIconFile</key>
<string>celestia</string>
<key>CFBundleIdentifier</key>
<string>org.celestia.Celestia</string>
<key>CFBundleName</key>
<string>Celestia</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@VERSION@</string>
<key>CFBundleShortVersionString</key>
<string>@VERSION@</string>
<key>LSMinimumSystemVersion</key>
<string>@CMAKE_OSX_DEPLOYMENT_TARGET@</string>
<key>CFBundleDisplayName</key>
<string>@DISPLAY_NAME@</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>Application Category</key>
<string>Education</string>
</dict>
</plist>

View File

@ -27,7 +27,11 @@ macro(GETTEXT_CREATE_TRANSLATIONS2 _potFile _firstPoFileArg)
DEPENDS ${_absPotFile} ${_absFile}
)
install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
if(NATIVE_OSX_APP)
install(FILES ${_gmoFile} DESTINATION Resources/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
else()
install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
endif()
set(_gmoFiles ${_gmoFiles} ${_gmoFile})
endforeach ()

View File

@ -73,4 +73,9 @@ if(APPLE)
set_property(TARGET celestia-qt APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreFoundation")
set_property(TARGET celestia-qt APPEND_STRING PROPERTY LINK_FLAGS " -framework CoreServices")
endif()
install(TARGETS celestia-qt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(NATIVE_OSX_APP)
install(TARGETS celestia-qt RUNTIME DESTINATION MacOS)
install(FILES ../macosx/celestia.icns DESTINATION Resources)
else()
install(TARGETS celestia-qt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()