Skip to content

Commit

Permalink
Fix building on macOS in CI
Browse files Browse the repository at this point in the history
The original hack no longer works as Homebrew installs to /opt/homebrew
by default for ARM [1], and hosted macOS runners on GitHub now uses ARM
by default [2].

While I'm at it, I replaced the hack with a more general solution. It's
inspired by other Homebrew formulae that use cmake and qt@5 [3].

[1] https://docs.brew.sh/Installation
[2] https://github.com/actions/runner-images?tab=readme-ov-file#available-images
[3] https://github.com/search?q=repo%3AHomebrew%2Fhomebrew-core+CMAKE_PREFIX_PATH+qt%405&type=code
  • Loading branch information
yan12125 committed Jul 15, 2024
1 parent 07ec632 commit b603144
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ jobs:
brew update
brew install libchewing qt@5
# Qt
brew link --force qt@5
# Homebrew does not link mkspecs and plugins https://github.com/Homebrew/homebrew-core/issues/93056
export HOMEBREW_QT5_VERSION=$(brew list --versions qt@5 | rev | cut -d' ' -f1 | rev)
sudo ln -s /usr/local/Cellar/qt@5/$HOMEBREW_QT5_VERSION/mkspecs /usr/local/mkspecs
sudo ln -s /usr/local/Cellar/qt@5/$HOMEBREW_QT5_VERSION/plugins /usr/local/plugins
# Allow CMake to find qt@5 by passing down the environment variable
echo "CMAKE_PREFIX_PATH=$(brew --prefix qt@5)" >> $GITHUB_ENV
if: ${{ matrix.os == 'macos-latest' }}

- name: Configure CMake
Expand Down

0 comments on commit b603144

Please sign in to comment.