1111
1212jobs :
1313 build-macos :
14- if : github.ref == 'refs/heads/issue-7133-macos-test' # ensure only this branch runs this job
14+ if : github.ref == 'refs/heads/issue-7133-macos-test'
1515 runs-on : macos-latest
1616 steps :
1717 - uses : actions/checkout@v4
1818
19- # Isolated Python so pip works ( avoids PEP 668)
19+ # Isolated Python; avoids PEP 668 and lets us pip install aqt
2020 - name : Set up Python
2121 uses : actions/setup-python@v5
2222 with :
2323 python-version : ' 3.11'
2424
2525 - name : Toolchain info
2626 run : |
27+ uname -a
28+ echo "Machine arch: $(uname -m)"
2729 which cmake || true
2830 cmake --version || true
2931 which ninja || true
3032 ninja --version || true
3133 python3 --version
32- uname -a
3334
3435 - name : Cache Qt
3536 uses : actions/cache@v4
@@ -42,28 +43,57 @@ jobs:
4243 python3 -m pip install --upgrade pip
4344 python3 -m pip install aqtinstall
4445
45- # Correct syntax: --modules <VERSION> <ARCH>
46- - name : List available Qt modules
46+ # Determine Qt arch for this runner and show what’s available
47+ - name : Determine Qt architecture and list modules
48+ id : qarch
4749 run : |
48- python3 -m aqt list-qt mac desktop --modules "${QT_VERSION}" macos
50+ set -eux
51+ ARCH="$(uname -m)"
52+ if [ "$ARCH" = "x86_64" ]; then
53+ Q_ARCH="clang_64"
54+ else
55+ Q_ARCH="arm64"
56+ fi
57+ echo "Q_ARCH=$Q_ARCH" >> $GITHUB_OUTPUT
58+ echo "Using Qt arch: $Q_ARCH"
59+ python3 -m aqt list-qt mac desktop --arch "${QT_VERSION}"
60+ python3 -m aqt list-qt mac desktop --modules "${QT_VERSION}" "$Q_ARCH" || true
4961
50- - name : Install Qt (aqt, no Homebrew)
62+ - name : Install Qt (auto-select available modules)
63+ env :
64+ Q_ARCH : ${{ steps.qarch.outputs.Q_ARCH }}
5165 run : |
5266 set -eux
53- if [ ! -d "$HOME/Qt/${QT_VERSION}/macos" ]; then
54- python3 -m aqt install-qt mac desktop "${QT_VERSION}" macos -O "$HOME/Qt" \
55- -m qtdeclarative qtquickcontrols2 qtpositioning qtserialport qtmultimedia qtsvg qtlocation qtshadertools
67+ QT_DIR="$HOME/Qt/${QT_VERSION}/${Q_ARCH}"
68+ if [ ! -d "$QT_DIR" ]; then
69+ # Desired modules; we'll intersect with what is actually available for the arch
70+ WANT="qtdeclarative qtquickcontrols2 qtpositioning qtserialport qtmultimedia qtsvg qtlocation qtshadertools qtimageformats qt5compat"
71+ AVAIL="$(python3 -m aqt list-qt mac desktop --modules "${QT_VERSION}" "${Q_ARCH}" \
72+ | tr -s ' ' '\n' | sed 's/\r$//' || true)"
73+ HAVE=""
74+ for m in $WANT; do
75+ if echo "$AVAIL" | grep -q "^${m}$"; then
76+ HAVE="$HAVE $m"
77+ fi
78+ done
79+ if [ -n "$HAVE" ]; then
80+ echo "Installing Qt ${QT_VERSION} ${Q_ARCH} with modules:$HAVE"
81+ python3 -m aqt install-qt mac desktop "${QT_VERSION}" "${Q_ARCH}" -O "$HOME/Qt" -m $HAVE
82+ else
83+ echo "No desired modules reported as available; installing core Qt ${QT_VERSION} ${Q_ARCH}"
84+ python3 -m aqt install-qt mac desktop "${QT_VERSION}" "${Q_ARCH}" -O "$HOME/Qt"
85+ fi
5686 fi
57- ls -la "$HOME/Qt/${QT_VERSION}/macos "
87+ ls -la "$QT_DIR "
5888
59- # Avoid Homebrew entirely. Fallback installs ninja from PyPI if missing.
60- - name : Ensure Ninja (no Homebrew)
89+ # Ensure Ninja exists without Homebrew; pip fallback if missing
90+ - name : Ensure Ninja
6191 run : |
6292 ninja --version || python3 -m pip install ninja
6393
6494 - name : Configure (CMake + Qt6)
6595 env :
66- CMAKE_PREFIX_PATH : ${{ runner.home }}/Qt/${{ env.QT_VERSION }}/macos
96+ CMAKE_PREFIX_PATH : ${{ runner.home }}/Qt/${{ env.QT_VERSION }}/${{ steps.qarch.outputs.Q_ARCH }}
6797 run : |
6898 set -eux
6999 mkdir -p build
0 commit comments