Skip to content

Commit

Permalink
Default to build against distribution wxWidgets (#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiolo authored Feb 1, 2025
1 parent f8edf8a commit fe7de52
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: install gtk
run: sudo apt-get -o Acquire::Retries=3 install libgtk-3-dev
- name: cmake
run: CXX=${{ matrix.cxx }} cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=TreeSheets-relocatable -DTREESHEETS_RELOCATABLE_INSTALLATION=ON
run: CXX=${{ matrix.cxx }} cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=TreeSheets-relocatable -DTREESHEETS_RELOCATABLE_INSTALLATION=ON -DGIT_WXWIDGETS_SUBMODULES=ON
- name: build TreeSheets
run: cmake --build _build -j4
- name: install files
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $(date +'%Y.%m.%d')" osx/Info.plist
/usr/libexec/PlistBuddy -c "Set :LSMinimumSystemVersion $minmac" osx/Info.plist
- name: cmake
run: cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="$minmac" -DCMAKE_INSTALL_PREFIX=macos-bundle
run: cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="$minmac" -DCMAKE_INSTALL_PREFIX=macos-bundle -DGIT_WXWIDGETS_SUBMODULES=ON
- name: Build TreeSheets
run: cmake --build _build -j4
- name: Create bundle
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ OPTION(TREESHEETS_WITH_STATIC_WXWIDGETS "Build wxWidgets along with TreeSheets a
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
OPTION(GIT_WXWIDGETS_SUBMODULES "Check wxWidgets git submodules during build" ON)
OPTION(GIT_WXWIDGETS_SUBMODULES "Checkout wxWidgets git submodules during build" OFF)
if(GIT_WXWIDGETS_SUBMODULES)
message(STATUS "The Git wxWidgets submodules are currently being updated...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --remote --recursive
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ cd treesheets
```sh
cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Applications
```

Please note that you need to have wxWidgets installed, e.g. distributed by Homebrew or built by yourself.
If you wish to compile statically against wxWidgets, append `-DGIT_WXWIDGETS_SUBMODULES=ON` (autodownloads wxWidgets) or `-DTREESHEETS_WITH_STATIC_WXWIDGETS=ON` (if you have already placed the wxWidgets source in `lib/wxWidgets`).

4. Build
```sh
cmake --build _build -j
Expand All @@ -111,6 +115,10 @@ cd treesheets
```sh
cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release
```

Please note that you need to have wxWidgets installed, e.g. distributed by your distribution or built by yourself.
If you wish to compile statically against wxWidgets, append `-DGIT_WXWIDGETS_SUBMODULES=ON` (autodownloads wxWidgets) or `-DTREESHEETS_WITH_STATIC_WXWIDGETS=ON` (if you have already placed the wxWidgets source in `lib/wxWidgets`).

4. Build
```sh
cmake --build _build -j
Expand All @@ -121,12 +129,10 @@ sudo cmake --install _build
```

### Further information for Mac OS / Linux

- 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:
<details>
- If you like to build wxWidgets by yourself:
- 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.
- Alternatively you can build against the wxWidgets package of your distribution.
- 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.
</details>
Expand Down

0 comments on commit fe7de52

Please sign in to comment.