v0.5.0: Windows/ARM64 and Linux/ARM64 cross targets, .deb/.msi packaging
- Cross toolchains: llvm-mingw-aarch64 (Windows ARM64; SDL3 staged from MSYS2's clangarm64 repo since SDL ships no MinGW ARM64 dev package) and clang-aarch64-linux-gnu (Linux ARM64; arm64 libc++/SDL3 via dpkg multiarch). - Distro images: Dockerfile.linux-arm64, Dockerfile.win-arm64, Dockerfile.debian and Dockerfile.debian-arm64 (Debian 13 with upstream CMake, whose 3.31 gate cannot enable import std). - Packaging via CPack: .deb for Ubuntu 26.04 and Debian 13 on amd64 and arm64 (dependencies derived by dpkg-shlibdeps), portable .zip/.tar.gz, and a Windows .msi built with wixl (msitools) straight from the Linux cross image. wixl 0.106 lacks arm64, so Windows/ARM64 ships the portable zip only. - CMake: parameterize the SDL3 MinGW triple, add install() + CPack config. - CI: build/package jobs for both arm64 targets and both Debian packages; existing Linux/Windows jobs now also emit the .deb / .zip + .msi. - scripts/: build-linux-arm64, build-windows-arm64, build-debian, build-debian-arm64.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# Cross-compile for Linux on ARM64 (aarch64-linux-gnu) from x86_64.
|
||||
#
|
||||
# clang-21 + libc++ (for `import std;`) with the arm64 libc++ and SDL3 taken
|
||||
# from Ubuntu's arm64 packages (installed with dpkg multiarch), and the arm64
|
||||
# glibc headers/libs from `gcc-aarch64-linux-gnu`. lld links the result; the C
|
||||
# multiarch include directory is added explicitly because clang does not always
|
||||
# infer Debian's `bits/` layout from the target triple alone.
|
||||
|
||||
# The `import std` gate must be set before the compiler is probed; a toolchain
|
||||
# file is processed earlier than the project's own top-level settings.
|
||||
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
set(OPENRA3_AARCH64_TRIPLE "aarch64-linux-gnu")
|
||||
# Multiarch paths the arm64 packages install into.
|
||||
set(OPENRA3_AARCH64_INCLUDE "/usr/include/${OPENRA3_AARCH64_TRIPLE}")
|
||||
set(OPENRA3_AARCH64_LIB "/usr/lib/${OPENRA3_AARCH64_TRIPLE}")
|
||||
|
||||
# Compiler + libc++ module description are cache vars so a distro with a
|
||||
# differently-versioned clang (e.g. Debian's clang-19) can override on the
|
||||
# command line.
|
||||
set(OPENRA3_AARCH64_CC "clang-21" CACHE STRING "aarch64 C compiler")
|
||||
set(OPENRA3_AARCH64_CXX "clang++-21" CACHE STRING "aarch64 C++ compiler")
|
||||
set(OPENRA3_AARCH64_STDLIB_MODULES_JSON "/usr/lib/llvm-21/lib/libc++.modules.json" CACHE FILEPATH
|
||||
"libc++ std module description for the aarch64 target")
|
||||
|
||||
set(CMAKE_C_COMPILER ${OPENRA3_AARCH64_CC})
|
||||
set(CMAKE_CXX_COMPILER ${OPENRA3_AARCH64_CXX})
|
||||
set(CMAKE_C_COMPILER_TARGET ${OPENRA3_AARCH64_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${OPENRA3_AARCH64_TRIPLE})
|
||||
# CMake's standard-library detection does not pass COMPILER_TARGET, so without
|
||||
# this it probes the host standard library.
|
||||
set(CMAKE_C_COMPILER_ARG1 "--target=${OPENRA3_AARCH64_TRIPLE}")
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "--target=${OPENRA3_AARCH64_TRIPLE}")
|
||||
|
||||
# libc++ standard-library module description for the aarch64 target. On a
|
||||
# multiarch image only the arm64 libc++ is installed, so the standard path
|
||||
# already resolves to the aarch64 module description.
|
||||
set(CMAKE_CXX_STDLIB_MODULES_JSON "${OPENRA3_AARCH64_STDLIB_MODULES_JSON}")
|
||||
|
||||
# Strip with the cross binutils, so CPack can strip the arm64 binary.
|
||||
set(CMAKE_STRIP aarch64-linux-gnu-strip)
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "-isystem ${OPENRA3_AARCH64_INCLUDE}")
|
||||
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++ -isystem ${OPENRA3_AARCH64_INCLUDE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-stdlib=libc++ -fuse-ld=lld -L${OPENRA3_AARCH64_LIB}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-stdlib=libc++ -fuse-ld=lld -L${OPENRA3_AARCH64_LIB}")
|
||||
|
||||
# Run arm64 test binaries through qemu when it is installed, so `ctest` works
|
||||
# during the image build; harmless when the tests are only cross-compiled.
|
||||
set(CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64-static)
|
||||
@@ -0,0 +1,50 @@
|
||||
# Cross-compile for Windows on ARM64 (aarch64-w64-mingw32) with llvm-mingw:
|
||||
# clang + libc++ + the libc++ `std` module, targeting the MSVCRT MinGW runtime.
|
||||
# The same llvm-mingw release is multi-target, so only the target triple, the
|
||||
# SDL3 SDK and the sysroot paths differ from the x86_64 toolchain.
|
||||
|
||||
# The `import std` gate must be set before the compiler is probed; a toolchain
|
||||
# file is processed earlier than the project's own top-level settings.
|
||||
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
set(OPENRA3_LLVM_MINGW_ROOT "/opt/llvm-mingw" CACHE PATH "llvm-mingw installation root")
|
||||
if(NOT EXISTS "${OPENRA3_LLVM_MINGW_ROOT}/bin/clang++")
|
||||
message(FATAL_ERROR "llvm-mingw not found at ${OPENRA3_LLVM_MINGW_ROOT} (expected bin/clang++)")
|
||||
endif()
|
||||
|
||||
# llvm-mingw's per-target prefix/sysroot for the ARM64 target.
|
||||
set(OPENRA3_MINGW_TRIPLE "aarch64-w64-mingw32")
|
||||
|
||||
set(CMAKE_C_COMPILER "${OPENRA3_LLVM_MINGW_ROOT}/bin/clang")
|
||||
set(CMAKE_CXX_COMPILER "${OPENRA3_LLVM_MINGW_ROOT}/bin/clang++")
|
||||
set(CMAKE_C_COMPILER_TARGET ${OPENRA3_MINGW_TRIPLE})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${OPENRA3_MINGW_TRIPLE})
|
||||
# CMake's standard-library detection does not pass COMPILER_TARGET, so without
|
||||
# this it probes the host standard library. Putting the target in ARG1 makes
|
||||
# the probe see libc++ (the MinGW target's library).
|
||||
set(CMAKE_C_COMPILER_ARG1 "--target=${OPENRA3_MINGW_TRIPLE}")
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "--target=${OPENRA3_MINGW_TRIPLE}")
|
||||
|
||||
# libc++ standard-library module description for the MinGW target. Must be set
|
||||
# before the compiler is probed so CMake can build `import std;`.
|
||||
set(CMAKE_CXX_STDLIB_MODULES_JSON "${OPENRA3_LLVM_MINGW_ROOT}/${OPENRA3_MINGW_TRIPLE}/lib/libc++.modules.json")
|
||||
|
||||
# Select libc++ explicitly so CMake's `import std` detection recognises the
|
||||
# standard library (llvm-mingw defaults to it, but CMake keys off -stdlib=).
|
||||
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-stdlib=libc++")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-stdlib=libc++")
|
||||
|
||||
# SDL3 for aarch64-w64-mingw32. The official SDL release ships no MinGW ARM64
|
||||
# dev package, so the image stages one from MSYS2's clangarm64 repo under this
|
||||
# root in the same `<triple>/{include,lib,bin}` layout.
|
||||
set(OPENRA3_SDL3_ROOT "/opt/sdl3-aarch64" CACHE PATH "SDL3 aarch64 MinGW development package root")
|
||||
set(OPENRA3_SDL3_MINGW_TRIPLE "${OPENRA3_MINGW_TRIPLE}" CACHE STRING "SDL3 MinGW triple subdirectory")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "${OPENRA3_LLVM_MINGW_ROOT}/${OPENRA3_MINGW_TRIPLE}")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
@@ -36,6 +36,8 @@ set(CMAKE_SHARED_LINKER_FLAGS_INIT "-stdlib=libc++")
|
||||
|
||||
# Official SDL3 MinGW development package (headers + import library + DLL).
|
||||
set(OPENRA3_SDL3_ROOT "/opt/sdl3-mingw" CACHE PATH "SDL3 MinGW development package root")
|
||||
# The triple-named subdirectory inside the SDL3 MinGW package.
|
||||
set(OPENRA3_SDL3_MINGW_TRIPLE "x86_64-w64-mingw32" CACHE STRING "SDL3 MinGW triple subdirectory")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "${OPENRA3_LLVM_MINGW_ROOT}/x86_64-w64-mingw32")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
Reference in New Issue
Block a user