Skip to content

Commit a747d76

Browse files
committed
issue-7133: macOS CI install Qt 6.8.3 via aqt; auto-arch; no Homebrew; correct CMAKE_PREFIX_PATH
1 parent 1addadd commit a747d76

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/macos-test.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
pull_request:
88

99
env:
10-
QT_VERSION: "6.5.3"
10+
# Match the exact version your CMake requires:
11+
QT_VERSION: "6.8.3"
1112

1213
jobs:
1314
build-macos:
@@ -16,7 +17,7 @@ jobs:
1617
steps:
1718
- uses: actions/checkout@v4
1819

19-
# Use an isolated Python so pip works (avoids PEP 668). No Homebrew used anywhere.
20+
# Isolated Python so pip works (avoids PEP 668). We do NOT use Homebrew anywhere.
2021
- name: Set up Python
2122
uses: actions/setup-python@v5
2223
with:
@@ -44,36 +45,43 @@ jobs:
4445
python3 -m pip install --upgrade pip
4546
python3 -m pip install aqtinstall
4647
47-
# Discover valid Qt architectures and pick one (prefer clang_64 for mac desktop).
48-
- name: Determine Qt arch (prefer clang_64) and list modules
48+
# Discover valid Qt architectures for this Qt version and pick one.
49+
# For mac desktop, aqt typically offers "macos" (universal) or "clang_64".
50+
- name: Determine Qt arch and list modules
4951
id: qarch
5052
run: |
5153
set -eux
5254
ARCH_LINE="$(python3 -m aqt list-qt mac desktop --arch "${QT_VERSION}")"
5355
echo "Raw arch line: ${ARCH_LINE}"
5456
echo "${ARCH_LINE}" | tr -s ' \t' ' ' | tr ' ' '\n' > arch.txt
55-
echo "Available Qt arches:"
57+
echo "Available Qt arches for ${QT_VERSION}:"
5658
cat arch.txt
5759
58-
if grep -qx "clang_64" arch.txt; then
60+
# Prefer 'macos' (universal). If not present, fall back to 'clang_64', else first entry.
61+
if grep -qx "macos" arch.txt; then
62+
Q_ARCH="macos"
63+
elif grep -qx "clang_64" arch.txt; then
5964
Q_ARCH="clang_64"
6065
else
6166
Q_ARCH="$(head -n1 arch.txt)"
6267
fi
68+
6369
echo "Selected Qt arch: ${Q_ARCH}"
6470
echo "Q_ARCH=${Q_ARCH}" >> "$GITHUB_OUTPUT"
6571
66-
# Show modules for visibility (do not fail if none listed)
72+
# List modules for visibility (non-fatal)
6773
python3 -m aqt list-qt mac desktop --modules "${QT_VERSION}" "${Q_ARCH}" || true
6874
69-
# Install Qt with aqt; handle aqt's actual install path (usually ~/Qt/<ver>/macos).
75+
# Install Qt with aqt; aqt often installs mac desktop Qt under ~/Qt/<ver>/macos even if we select clang_64.
7076
- name: Install Qt (aqt, no Homebrew)
7177
id: qtpath
7278
env:
7379
Q_ARCH: ${{ steps.qarch.outputs.Q_ARCH }}
7480
run: |
7581
set -eux
7682
WANT="qtdeclarative qtquickcontrols2 qtpositioning qtserialport qtmultimedia qtsvg qtlocation qtshadertools qtimageformats qt5compat"
83+
84+
# Which modules are available for this version/arch?
7785
AVAIL="$(python3 -m aqt list-qt mac desktop --modules "${QT_VERSION}" "${Q_ARCH}" | tr -s ' \t' ' ' | tr ' ' '\n' | sed 's/\r$//' || true)"
7886
echo "Available modules for ${QT_VERSION} ${Q_ARCH}:"
7987
echo "${AVAIL}"
@@ -85,9 +93,11 @@ jobs:
8593
fi
8694
done
8795
96+
# Install only if not already present
8897
if [ ! -d "$HOME/Qt/${QT_VERSION}/macos" ] && [ ! -d "$HOME/Qt/${QT_VERSION}/${Q_ARCH}" ]; then
8998
if [ -n "${HAVE}" ]; then
9099
echo "Installing Qt ${QT_VERSION} ${Q_ARCH} with modules:${HAVE}"
100+
# shellcheck disable=SC2086
91101
python3 -m aqt install-qt mac desktop "${QT_VERSION}" "${Q_ARCH}" -O "$HOME/Qt" -m ${HAVE}
92102
else
93103
echo "Installing core Qt ${QT_VERSION} ${Q_ARCH}"
@@ -97,11 +107,13 @@ jobs:
97107
echo "Qt already present in ~/Qt/${QT_VERSION}/(macos|${Q_ARCH}), skipping download."
98108
fi
99109
110+
# Resolve actual install dir used by aqt (mac desktop commonly ends up under 'macos')
100111
if [ -d "$HOME/Qt/${QT_VERSION}/macos" ]; then
101112
QT_DIR="$HOME/Qt/${QT_VERSION}/macos"
102113
elif [ -d "$HOME/Qt/${QT_VERSION}/${Q_ARCH}" ]; then
103114
QT_DIR="$HOME/Qt/${QT_VERSION}/${Q_ARCH}"
104115
else
116+
# Fallback: first subdir under ~/Qt/<ver>
105117
QT_DIR="$(find "$HOME/Qt/${QT_VERSION}" -mindepth 1 -maxdepth 1 -type d | head -n1)"
106118
fi
107119
@@ -113,6 +125,10 @@ jobs:
113125
if [ -x "${QT_DIR}/bin/qmake" ]; then
114126
"${QT_DIR}/bin/qmake" -v || true
115127
fi
128+
if [ -f "${QT_DIR}/lib/cmake/Qt6/Qt6Config.cmake" ]; then
129+
echo "Found Qt6Config: ${QT_DIR}/lib/cmake/Qt6/Qt6Config.cmake"
130+
grep -E '^set\(PACKAGE_VERSION' -n "${QT_DIR}/lib/cmake/Qt6/Qt6ConfigVersion.cmake" || true
131+
fi
116132
117133
- name: Ensure Ninja (no Homebrew)
118134
run: |
@@ -126,6 +142,7 @@ jobs:
126142
set -eux
127143
echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
128144
ls -la "${CMAKE_PREFIX_PATH}" || true
145+
test -f "${CMAKE_PREFIX_PATH}/lib/cmake/Qt6/Qt6Config.cmake"
129146
mkdir -p build
130147
cd build
131148
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release

0 commit comments

Comments
 (0)