Skip to content

Commit

Permalink
Make MacOSX Bundle with working translations
Browse files Browse the repository at this point in the history
- To create bundle, both build and install must be run by CMake
- Localizations now need to be extra declared in Info.plist
  • Loading branch information
tobiolo committed Nov 3, 2024
1 parent d363448 commit 603ceb0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -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()
Expand Down
43 changes: 43 additions & 0 deletions osx/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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>treesheets</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>App.icns</string>
<key>CFBundleIdentifier</key>
<string>com.strlen.TreeSheets</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Wouter van Oortmersen</string>
<key>CFBundleLocalizations</key>
<array>
<string>English</string>
<string>German</string>
<string>French</string>
<string>Chinese</string>
<string>Portuguese</string>
<string>Russian</string>
</array>
</dict>
</plist>

0 comments on commit 603ceb0

Please sign in to comment.