From b6031448550e6846b832504ec21145093cca7ba1 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen <645432-yan12125@users.noreply.gitlab.com> Date: Mon, 15 Jul 2024 16:23:11 +0800 Subject: [PATCH] Fix building on macOS in CI 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 --- .github/workflows/ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebf7aa0..6404c42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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