From 603ceb0f3899a30f249627889df5f389af5ecfa8 Mon Sep 17 00:00:00 2001 From: Tobias Predel Date: Sun, 3 Nov 2024 21:32:01 +0100 Subject: [PATCH] Make MacOSX Bundle with working translations - To create bundle, both build and install must be run by CMake - Localizations now need to be extra declared in Info.plist --- CMakeLists.txt | 13 ++++++++++++- osx/Info.plist | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 osx/Info.plist diff --git a/CMakeLists.txt b/CMakeLists.txt index 008443ae..ae4068f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,9 +100,16 @@ endif() add_executable( treesheets + MACOSX_BUNDLE src/main.cpp ) +if(APPLE) + set_target_properties(treesheets PROPERTIES + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/osx/Info.plist" + ) +endif() + target_include_directories(treesheets PUBLIC lobster/src) target_link_libraries( @@ -142,6 +149,10 @@ if(LINUX AND NOT TREESHEETS_RELOCATABLE_INSTALLATION) install(FILES linux/com.strlen.TreeSheets.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) install(FILES linux/com.strlen.TreeSheets.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) install(FILES linux/com.strlen.TreeSheets.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages) +elseif(APPLE) + set(TREESHEETS_BINDIR ${CMAKE_INSTALL_PREFIX}) + set(TREESHEETS_DOCDIR ${CMAKE_INSTALL_PREFIX}/treesheets.app/Contents/Resources) + set(TREESHEETS_PKGDATADIR ${CMAKE_INSTALL_PREFIX}/treesheets.app/Contents/Resources) else() set(TREESHEETS_BINDIR ${CMAKE_INSTALL_PREFIX}) set(TREESHEETS_DOCDIR ${CMAKE_INSTALL_PREFIX}) @@ -179,7 +190,7 @@ elseif(APPLE) foreach(locale ${locales}) install( FILES "TS/translations/${locale}/ts.mo" - DESTINATION "${CMAKE_INSTALL_PREFIX}/translations/${locale}.lproj" + DESTINATION "${CMAKE_INSTALL_PREFIX}/treesheets.app/Contents/Resources/translations/${locale}.lproj" ) endforeach() else() diff --git a/osx/Info.plist b/osx/Info.plist new file mode 100644 index 00000000..bd397f6d --- /dev/null +++ b/osx/Info.plist @@ -0,0 +1,43 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + treesheets + CFBundleGetInfoString + + CFBundleIconFile + App.icns + CFBundleIdentifier + com.strlen.TreeSheets + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + + CFBundleName + + CFBundlePackageType + APPL + CFBundleShortVersionString + + CFBundleSignature + ???? + CFBundleVersion + + CSResourcesFileMapped + + NSHumanReadableCopyright + Wouter van Oortmersen + CFBundleLocalizations + + English + German + French + Chinese + Portuguese + Russian + + +