Files
asteria-qt/scripts/mingw-w64-toolchain.cmake
T
Agel 8782a3be8a 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`
2026-10-31 14:15:36 +01:00

28 lines
1.2 KiB
CMake

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
# Explicitly prefer GCC toolchain in /usr/bin when available to prevent collision with llvm-mingw
if(EXISTS "/usr/bin/x86_64-w64-mingw32-gcc")
set(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres)
else()
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
endif()
# Append default sysroot paths. list(APPEND) preserves any paths already set via
# -DCMAKE_FIND_ROOT_PATH on the cmake command line (e.g. the Qt Windows install dir),
# while plain set() would silently override them and break find_package(Qt6).
list(APPEND CMAKE_FIND_ROOT_PATH /opt/mingw-sysroot /usr/x86_64-w64-mingw32)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# Point pkg-config at the MinGW sysroot so it finds cross-compiled .pc files
set(ENV{PKG_CONFIG_LIBDIR} "$ENV{MINGW_SYSROOT}/lib/pkgconfig")
set(ENV{PKG_CONFIG_PATH} "")