Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MacOSX Bundle with working translations #748

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,22 @@ Windows:
the wxWidgets libraries.
7. To distribute, build an installer with `TS_installer.nsi` (requires nsis.sourceforge.net)

Linux:
Linux / MacOS X:

1. Configure the build process with `cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release` or similar.
- If you have `git` installed, the submodules for wxWidgets will be automatically updated and wxWidgets will be compiled as a CMake subproject. TreeSheets will be then statically linked against this wxWidgets build.
- If you do like to link dynamically against an existing wxWidgets installation instead, you can switch off the option `GIT_WXWIDGETS_SUBMODULES` in the CMake project. In this case:
- You can use the version of wxWidgets from https://github.com/wxWidgets/wxWidgets.git.
- Follow the instructions to build there, but add `--enable-unicode` and `--disable-shared` to the `configure` step.
- You can change the default installation prefix (`/usr/local`) by passing something like `-DCMAKE_INSTALL_PREFIX=/usr`.
- If you are MacOS X user, a bundle will be installed to the installation prefix.
2. Build using `cmake --build _build`.
3. Install using `sudo cmake --install _build`.

OSX:

1. Build wxWidgets as follows (inside the wxWidgets dir):
1. `mkdir build_osx`
2. `cd build_osx`
3. `../configure --enable-unicode --disable-shared --disable-sys-libs --without-libtiff --with-osx_cocoa --enable-universal_binary=x86_64,arm64 CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++" OBJCXXFLAGS="-stdlib=libc++" --disable-mediactrl CC=clang CXX=clang++`
4. `make -j8`
5. `sudo make install`
2. use the XCode project in `osx/TreeSheets` to build treesheets. put the resulting
.app together with the files from the `TS` folder in `osx/TreeSheetsBeta` to distribute.
Note to use the "Archive" operation to create a release executable.
For Mac OS X users:

4. Run the application bundle that has been installed to the installation prefix. You might consider to drag-and-drop it to Applications.


Contributing:
-------------
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>
Loading