Skip to content

Commit 6fc9d3c

Browse files
committed
feat: Add iOS Qt build.
1 parent ecedb30 commit 6fc9d3c

24 files changed

Lines changed: 191 additions & 45 deletions

.github/workflows/docker.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ jobs:
272272
--dep-prefix /Users/runner/work/deps
273273
- name: Build tarball
274274
run: tar -zcf qt-static-macos-${{ matrix.arch }}-${{ matrix.macos }}.tar.gz -C /Users/runner/work/deps qt
275+
- name: Upload artifact
276+
uses: actions/upload-artifact@v4
277+
with:
278+
name: qt-static-macos-${{ matrix.arch }}-${{ matrix.macos }}-qt
279+
path: qt-static-macos-${{ matrix.arch }}-${{ matrix.macos }}.tar.gz
275280
- name: Upload tarball to nightly release
276281
if: github.event_name == 'push'
277282
uses: ncipollo/release-action@v1
@@ -283,3 +288,62 @@ jobs:
283288
prerelease: true
284289
replacesArtifacts: true
285290
artifacts: qt-static-macos-${{ matrix.arch }}-${{ matrix.macos }}.tar.gz
291+
292+
qt-static-ios:
293+
needs: [update-nightly-tag, qt-static-macos]
294+
strategy:
295+
matrix:
296+
arch: [ios-arm64, iphonesimulator-arm64, iphonesimulator-x86_64]
297+
include:
298+
- arch: ios-arm64
299+
host_arch: arm64
300+
- arch: iphonesimulator-arm64
301+
host_arch: arm64
302+
- arch: iphonesimulator-x86_64
303+
host_arch: x86_64
304+
runs-on: ${{ matrix.host_arch == 'arm64' && 'macos-14' || 'macos-15-intel' }}
305+
permissions:
306+
contents: write
307+
steps:
308+
- uses: actions/checkout@v4
309+
- name: Download host Qt
310+
uses: actions/download-artifact@v4
311+
with:
312+
name: qt-static-macos-${{ matrix.host_arch }}-12.0-qt
313+
- name: Extract host Qt
314+
run: |
315+
mkdir -p /Users/runner/work/host-qt
316+
tar -zxf qt-static-macos-${{ matrix.host_arch }}-12.0.tar.gz --strip-components=1 -C /Users/runner/work/host-qt
317+
- name: Debug host Qt
318+
run: |
319+
echo "Checking host Qt directory: /Users/runner/work/host-qt"
320+
ls -F /Users/runner/work/host-qt
321+
- name: Cache Qt
322+
id: cache-qt
323+
uses: actions/cache@v4
324+
with:
325+
path: |
326+
/Users/runner/work/deps/qt
327+
key: ${{ github.job }}-${{ matrix.arch }}-qt
328+
- name: Homebrew dependencies to build dependencies
329+
run: brew bundle --file qtox/deps/Brewfile-static
330+
- name: Build Qt
331+
if: steps.cache-qt.outputs.cache-hit != 'true'
332+
run: qtox/deps/local_install_deps.sh
333+
--arch ${{ matrix.arch }}
334+
--dep-file qtox/deps/qt.depfile
335+
--dep-prefix /Users/runner/work/deps
336+
--host-path /Users/runner/work/host-qt
337+
- name: Build tarball
338+
run: tar -zcf qt-static-${{ matrix.arch }}.tar.gz -C /Users/runner/work/deps qt
339+
- name: Upload tarball to nightly release
340+
if: github.event_name == 'push'
341+
uses: ncipollo/release-action@v1
342+
with:
343+
allowUpdates: true
344+
tag: nightly
345+
omitBodyDuringUpdate: true
346+
omitNameDuringUpdate: true
347+
prerelease: true
348+
replacesArtifacts: true
349+
artifacts: qt-static-${{ matrix.arch }}.tar.gz

qtox/build_extra_cmake_modules.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
99

1010
source "$SCRIPT_DIR/build_utils.sh"
1111

12-
parse_arch --dep "extra-cmake-modules" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm" "$@"
12+
parse_arch --dep "extra-cmake-modules" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1313

1414
"$SCRIPT_DIR/download/download_extra_cmake_modules.sh"
1515

qtox/build_ffmpeg.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
1111

1212
source "$SCRIPT_DIR/build_utils.sh"
1313

14-
parse_arch --dep "ffmpeg" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm" "$@"
14+
parse_arch --dep "ffmpeg" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1515

1616
CONFIGURE_FLAGS=()
1717
if [ "$LIB_TYPE" = "shared" ]; then
@@ -44,6 +44,16 @@ elif [ "$SCRIPT_ARCH" == "wasm" ]; then
4444
--ranlib="$EMSDK/upstream/bin/llvm-ranlib"
4545
--dep-cc="emcc"
4646
)
47+
elif [[ "$SCRIPT_ARCH" == "ios-"* ]] || [[ "$SCRIPT_ARCH" == "iphonesimulator-"* ]]; then
48+
FFMPEG_ARCH="${SCRIPT_ARCH#*-}"
49+
if [ "$FFMPEG_ARCH" == "x86_64" ]; then
50+
FFMPEG_ARCH="x86_64"
51+
elif [ "$FFMPEG_ARCH" == "arm64" ]; then
52+
FFMPEG_ARCH="aarch64"
53+
fi
54+
TARGET_OS="darwin"
55+
CROSS_PREFIX=""
56+
CONFIGURE_FLAGS+=(--enable-cross-compile)
4757
else
4858
FFMPEG_ARCH=""
4959
TARGET_OS=""

qtox/build_hunspell.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
99

1010
source "$SCRIPT_DIR/build_utils.sh"
1111

12-
parse_arch --dep "hunspell" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 win32 win64" "$@"
12+
parse_arch --dep "hunspell" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1313

1414
if [ "$LIB_TYPE" = "shared" ]; then
1515
ENABLE_STATIC=--disable-static

qtox/build_kimageformats.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
99

1010
source "$SCRIPT_DIR/build_utils.sh"
1111

12-
parse_arch --dep "kimageformats" --supported "linux-x86_64 macos-x86_64 macos-arm64 win32 win64" "$@"
12+
parse_arch --dep "kimageformats" --supported "linux-x86_64 macos-x86_64 macos-arm64 win32 win64 ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1313

1414
"$SCRIPT_DIR/download/download_kimageformats.sh"
1515

qtox/build_libexif.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
1111

1212
source "$SCRIPT_DIR/build_utils.sh"
1313

14-
parse_arch --dep "libexif" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm" "$@"
14+
parse_arch --dep "libexif" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1515

1616
if [ "$LIB_TYPE" = "shared" ]; then
1717
ENABLE_STATIC=--disable-static

qtox/build_openal.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
1111

1212
source "$SCRIPT_DIR/build_utils.sh"
1313

14-
parse_arch --dep "openal" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm" "$@"
14+
parse_arch --dep "openal" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1515

1616
if [ "$SCRIPT_ARCH" = "win32" ] || [ "$SCRIPT_ARCH" = "win64" ]; then
1717
"$SCRIPT_DIR/download/download_openal.sh" patched
@@ -32,13 +32,19 @@ else
3232
LIBTYPE=STATIC
3333
fi
3434

35+
if [[ "$SCRIPT_ARCH" == "ios-"* ]] || [[ "$SCRIPT_ARCH" == "iphonesimulator-"* ]]; then
36+
DEPLOYMENT_TARGET="$IOS_MINIMUM_SUPPORTED_VERSION"
37+
else
38+
DEPLOYMENT_TARGET="$MACOS_MINIMUM_SUPPORTED_VERSION"
39+
fi
40+
3541
export CFLAGS="-fPIC"
3642
export CXXFLAGS="-fPIC -std=c++20"
3743
"${EMCMAKE[@]}" cmake \
38-
"$CMAKE_TOOLCHAIN_FILE" \
44+
"${CMAKE_TOOLCHAIN_FILE[@]}" \
3945
-DCMAKE_INSTALL_PREFIX="$DEP_PREFIX" \
4046
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
41-
-DCMAKE_OSX_DEPLOYMENT_TARGET="$MACOS_MINIMUM_SUPPORTED_VERSION" \
47+
-DCMAKE_OSX_DEPLOYMENT_TARGET="$DEPLOYMENT_TARGET" \
4248
-DCMAKE_MACOSX_RPATH="$MACOSX_RPATH" \
4349
-DALSOFT_UTILS=OFF \
4450
-DALSOFT_EXAMPLES=OFF \

qtox/build_openssl.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
1111

1212
source "$SCRIPT_DIR/build_utils.sh"
1313

14-
parse_arch --dep "openssl" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm" "$@"
14+
parse_arch --dep "openssl" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1515

1616
if [ "$SCRIPT_ARCH" == "win64" ]; then
1717
OPENSSL_ARCH="mingw64"
@@ -25,6 +25,12 @@ elif [ "$SCRIPT_ARCH" == "macos-x86_64" ]; then
2525
elif [ "$SCRIPT_ARCH" == "macos-arm64" ]; then
2626
OPENSSL_ARCH="darwin64-arm64-cc"
2727
CROSS_COMPILE_ARCH=""
28+
elif [[ "$SCRIPT_ARCH" == "ios-"* ]]; then
29+
OPENSSL_ARCH="ios64-xcrun"
30+
CROSS_COMPILE_ARCH=""
31+
elif [[ "$SCRIPT_ARCH" == "iphonesimulator-"* ]]; then
32+
OPENSSL_ARCH="iossimulator-xcrun"
33+
CROSS_COMPILE_ARCH=""
2834
elif [ "$SCRIPT_ARCH" == "linux-x86_64" ]; then
2935
OPENSSL_ARCH="linux-x86_64"
3036
CROSS_COMPILE_ARCH=""

qtox/build_qrencode.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
1111

1212
source "$SCRIPT_DIR/build_utils.sh"
1313

14-
parse_arch --dep "qrencode" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm" "$@"
14+
parse_arch --dep "qrencode" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64 wasm ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1515

1616
if [ "$LIB_TYPE" = "shared" ]; then
1717
BUILD_SHARED_LIBS=ON
@@ -21,11 +21,17 @@ fi
2121

2222
"$SCRIPT_DIR/download/download_qrencode.sh"
2323

24+
if [[ "$SCRIPT_ARCH" == "ios-"* ]] || [[ "$SCRIPT_ARCH" == "iphonesimulator-"* ]]; then
25+
DEPLOYMENT_TARGET="$IOS_MINIMUM_SUPPORTED_VERSION"
26+
else
27+
DEPLOYMENT_TARGET="$MACOS_MINIMUM_SUPPORTED_VERSION"
28+
fi
29+
2430
"${EMCMAKE[@]}" cmake . \
2531
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
2632
-DCMAKE_INSTALL_PREFIX="$DEP_PREFIX" \
27-
-DCMAKE_OSX_DEPLOYMENT_TARGET="$MACOS_MINIMUM_SUPPORTED_VERSION" \
28-
"$CMAKE_TOOLCHAIN_FILE" \
33+
-DCMAKE_OSX_DEPLOYMENT_TARGET="$DEPLOYMENT_TARGET" \
34+
"${CMAKE_TOOLCHAIN_FILE[@]}" \
2935
-DWITH_TOOLS=OFF \
3036
-DBUILD_SHARED_LIBS="$BUILD_SHARED_LIBS"
3137

qtox/build_qtbase_macos.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
99

1010
source "$SCRIPT_DIR/build_utils.sh"
1111

12-
parse_arch --dep "qtbase" --supported "macos-arm64 macos-x86_64" "$@"
12+
parse_arch --dep "qtbase" --supported "macos-arm64 macos-x86_64 ios-arm64 iphonesimulator-arm64 iphonesimulator-x86_64" "$@"
1313

1414
"$SCRIPT_DIR/download/download_qtbase.sh"
1515

@@ -29,15 +29,27 @@ else
2929
QT_CONFIGURE_FLAGS+=("-no-force-debug-info")
3030
fi
3131

32-
if [ "$MACOS_MINIMUM_SUPPORTED_VERSION" != "10.15" ]; then
33-
QT_CONFIGURE_FLAGS+=("-no-feature-printsupport")
32+
if [[ "$SCRIPT_ARCH" == "ios-"* ]]; then
33+
QT_CONFIGURE_FLAGS+=("-sdk" "iphoneos" "-no-feature-printsupport" "-no-feature-icu" "-no-feature-filesystemwatcher")
34+
elif [[ "$SCRIPT_ARCH" == "iphonesimulator-"* ]]; then
35+
QT_CONFIGURE_FLAGS+=("-sdk" "iphonesimulator" "-no-feature-printsupport" "-no-feature-icu" "-no-feature-filesystemwatcher")
36+
else
37+
if [ "$MACOS_MINIMUM_SUPPORTED_VERSION" != "10.15" ]; then
38+
QT_CONFIGURE_FLAGS+=("-no-feature-printsupport")
39+
fi
40+
fi
41+
42+
if [ -n "$QT_HOST_PATH" ]; then
43+
QT_CONFIGURE_FLAGS+=("-qt-host-path" "$QT_HOST_PATH")
3444
fi
3545

3646
# We want -Werror to catch warnings related to macOS version compatibility.
37-
sed -i '' -e 's/-Wextra/-Wextra -Werror "-Wno-#warnings" -Wno-cast-function-type-mismatch -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-vla-cxx-extension/' cmake/QtCompilerFlags.cmake
47+
# We silence unused-variable because disabling features (like filesystemwatcher) can leave variables unused in Qt's source.
48+
sed -i '' -e 's/-Wextra/-Wextra -Werror "-Wno-#warnings" -Wno-cast-function-type-mismatch -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-unused-variable -Wno-vla-cxx-extension/' cmake/QtCompilerFlags.cmake
3849

3950
mkdir _build && pushd _build
4051
../configure \
52+
-platform macx-clang \
4153
--prefix="$QT_PREFIX" \
4254
-appstore-compliant \
4355
-static \
@@ -61,7 +73,7 @@ mkdir _build && pushd _build
6173
-no-openssl \
6274
-- \
6375
-DCMAKE_FIND_ROOT_PATH="$DEP_PREFIX" \
64-
-DCMAKE_OSX_DEPLOYMENT_TARGET="$MACOS_MINIMUM_SUPPORTED_VERSION" \
76+
"${CMAKE_TOOLCHAIN_FILE[@]}" \
6577
-Wno-dev
6678
cat config.summary
6779
cmake --build .

0 commit comments

Comments
 (0)