ci: add Windows on ARM64 cross-compilation and packaging jobs
- Add `build-windows-arm64` and `package-windows-arm64` stages to `.gitlab-ci.yml` and wire download links to wiki updates - Create `scripts/mingw-w64-arm64-toolchain.cmake` targeting `Windows` / `aarch64` with LLVM-MinGW - Update `docker/Dockerfile.build` with LLVM-MinGW toolchain, MSYS2 Qt 6.10 ARM64 packages, and ARM64 cross-compiled static libraries (libiconv, uchardet, zlib, minizip, libarchive) - Isolate GCC x86_64 and LLVM-MinGW ARM64 toolchains in `scripts/mingw-w64-toolchain.cmake` and PATH configuration - Refactor `packaging/package-windows.sh` to package both x86_64 and ARM64 runtime DLLs and support MSYS2 plugin/QML directory layouts - Update `scripts/test-ci-windows.sh` with `--arm64`, `--only-arm64`, `--image`, and local image detection - Guard `-mwindows` link flag with `if(MINGW)` in `CMakeLists.txt` - Document Windows ARM64 build targets and instructions in `AGENTS.md` and `README.md`
This commit is contained in:
9 files changed
+337
-72
No files matched your search
+49
-14
@@ -1,24 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Run CI build/package jobs locally using podman or docker.
|
||||
# Usage: test-ci-windows.sh [--build-image] [--linux]
|
||||
# Usage: test-ci-windows.sh [--build-image] [--linux] [--arm64]
|
||||
# --build-image build the CI image from Dockerfile instead of pulling the prebuilt one
|
||||
# --linux also run build-linux + package-linux in addition to Windows jobs
|
||||
# --arm64 also run build-windows-arm64 + package-windows-arm64
|
||||
set -euo pipefail
|
||||
|
||||
export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
OUTPUT_DIR="$PROJECT_DIR/ci-output"
|
||||
DOCKERFILE="$PROJECT_DIR/docker/Dockerfile.build"
|
||||
PREBUILT_IMAGE="registry.gitlab.com/asteria-bookreader/asteria-qt/build-env:latest"
|
||||
PREBUILT_IMAGE="${PREBUILT_IMAGE:-registry.gitlab.com/asteria-bookreader/asteria-qt/build-env:latest}"
|
||||
IMAGE_TAG="$PREBUILT_IMAGE"
|
||||
BUILD_IMAGE=false
|
||||
RUN_LINUX=false
|
||||
RUN_X86_64=true
|
||||
RUN_ARM64=false
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--build-image) BUILD_IMAGE=true; IMAGE_TAG="asteria-qt-ci-local:latest" ;;
|
||||
--linux) RUN_LINUX=true ;;
|
||||
*) echo "Unknown argument: $arg"; exit 1 ;;
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--build-image) BUILD_IMAGE=true; IMAGE_TAG="asteria-qt-ci-local:latest"; shift ;;
|
||||
--image) IMAGE_TAG="$2"; shift 2 ;;
|
||||
--image=*) IMAGE_TAG="${1#*=}"; shift ;;
|
||||
--linux) RUN_LINUX=true; shift ;;
|
||||
--arm64) RUN_ARM64=true; shift ;;
|
||||
--only-arm64) RUN_ARM64=true; RUN_X86_64=false; shift ;;
|
||||
*) echo "Unknown argument: $1"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -41,9 +50,11 @@ if [ "$BUILD_IMAGE" = true ]; then
|
||||
-t "$IMAGE_TAG" \
|
||||
-f "$DOCKERFILE" \
|
||||
"$PROJECT_DIR"
|
||||
else
|
||||
elif ! "$RUNTIME" image inspect "$IMAGE_TAG" &>/dev/null; then
|
||||
echo "==> Pulling prebuilt CI image: $IMAGE_TAG"
|
||||
"$RUNTIME" pull --platform linux/amd64 "$IMAGE_TAG"
|
||||
else
|
||||
echo "==> Using local image: $IMAGE_TAG"
|
||||
fi
|
||||
|
||||
rm -rf "$OUTPUT_DIR"
|
||||
@@ -67,9 +78,10 @@ run_in_container() {
|
||||
'
|
||||
}
|
||||
|
||||
# ── Windows build ────────────────────────────────────────────────────────────
|
||||
echo "==> build-windows"
|
||||
CI_SCRIPT='
|
||||
# ── Windows x86_64 build ─────────────────────────────────────────────────────
|
||||
if [ "$RUN_X86_64" = true ]; then
|
||||
echo "==> build-windows (x86_64)"
|
||||
CI_SCRIPT='
|
||||
PKG_CONFIG_PATH="${MINGW_SYSROOT}/lib/pkgconfig" cmake -B build-windows -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/src/scripts/mingw-w64-toolchain.cmake \
|
||||
@@ -80,12 +92,35 @@ cmake --build build-windows --target asteria-qt
|
||||
cp -r build-windows /out/build-windows
|
||||
' run_in_container -v "$OUTPUT_DIR:/out"
|
||||
|
||||
echo "==> package-windows"
|
||||
CI_SCRIPT='
|
||||
echo "==> package-windows (x86_64)"
|
||||
CI_SCRIPT='
|
||||
cp -r /out/build-windows build-windows
|
||||
chmod +x packaging/package-windows.sh
|
||||
packaging/package-windows.sh build-windows "${QT_WINDOWS_DIR}" "${MINGW_SYSROOT}" /out
|
||||
packaging/package-windows.sh build-windows "${QT_WINDOWS_DIR}" "${MINGW_SYSROOT}" /out x86_64
|
||||
' run_in_container -v "$OUTPUT_DIR:/out"
|
||||
fi
|
||||
|
||||
# ── Windows ARM64 build (optional) ───────────────────────────────────────────
|
||||
if [ "$RUN_ARM64" = true ]; then
|
||||
echo "==> build-windows-arm64"
|
||||
CI_SCRIPT='
|
||||
PKG_CONFIG_PATH="${MINGW_ARM64_SYSROOT}/lib/pkgconfig" cmake -B build-windows-arm64 -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/src/scripts/mingw-w64-arm64-toolchain.cmake \
|
||||
-DCMAKE_PREFIX_PATH="${QT_WINDOWS_ARM64_DIR};${MINGW_ARM64_SYSROOT}" \
|
||||
-DCMAKE_FIND_ROOT_PATH="${QT_WINDOWS_ARM64_DIR};${MINGW_ARM64_SYSROOT}" \
|
||||
-DQT_HOST_PATH="${QT_LINUX_DIR}"
|
||||
cmake --build build-windows-arm64 --target asteria-qt
|
||||
cp -r build-windows-arm64 /out/build-windows-arm64
|
||||
' run_in_container -v "$OUTPUT_DIR:/out"
|
||||
|
||||
echo "==> package-windows-arm64"
|
||||
CI_SCRIPT='
|
||||
cp -r /out/build-windows-arm64 build-windows-arm64
|
||||
chmod +x packaging/package-windows.sh
|
||||
packaging/package-windows.sh build-windows-arm64 "${QT_WINDOWS_ARM64_DIR}" "${MINGW_ARM64_SYSROOT}" /out arm64
|
||||
' run_in_container -v "$OUTPUT_DIR:/out"
|
||||
fi
|
||||
|
||||
# ── Linux build (optional) ───────────────────────────────────────────────────
|
||||
if [ "$RUN_LINUX" = true ]; then
|
||||
|
||||
Reference in new issue
Block a user