From ce0185adc462cb07bb81cec7da158e1c03b96b9a Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 23 May 2026 19:32:50 -0600 Subject: [PATCH] CI: Add ARM64 Windows and Linux builds (#1778) * ci: Try arm64 Linux/Windows builds * Update aurora * Explicitly set CMAKE_SYSTEM_PROCESSOR on Windows * Update build-appimage.sh for aarch64 * Set Rust_RUSTUP_INSTALL_MISSING_TARGET=ON * Use CMAKE_SYSTEM_PROCESSOR normalization for jpeg-turbo build too * MSVC ARM64 support for freeverb --- .github/workflows/build.yml | 24 ++++++++++++------------ CMakeLists.txt | 3 +++ CMakePresets.json | 11 +++++++++-- ci/build-appimage.sh | 3 ++- cmake/WindowsTargetProcessor.cmake | 9 +++++++++ extern/aurora | 2 +- libs/freeverb/denormals.h | 15 ++++++++++++++- 7 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 cmake/WindowsTargetProcessor.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 139b0654d3..a157fb8829 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,13 +22,13 @@ jobs: matrix: include: - name: GCC x86_64 - runner: ubuntu-latest + runner: ubuntu-24.04 preset: gcc artifact_arch: x86_64 - # - name: GCC aarch64 - # runner: ubuntu-24.04-arm - # preset: gcc - # artifact_arch: aarch64 + - name: GCC aarch64 + runner: ubuntu-24.04-arm + preset: gcc + artifact_arch: aarch64 # - name: Clang x86_64 # runner: ubuntu-latest # preset: clang @@ -221,12 +221,12 @@ jobs: msvc_arch: amd64 vcpkg_arch: x64 artifact_arch: x86_64 - # - name: MSVC arm64 - # runner: windows-11-arm - # preset: arm64-msvc - # msvc_arch: arm64 - # vcpkg_arch: arm64 - # artifact_arch: arm64 + - name: MSVC arm64 + runner: windows-latest + preset: arm64-msvc + msvc_arch: amd64_arm64 + vcpkg_arch: arm64 + artifact_arch: arm64 # - name: Clang x86_64 # runner: windows-latest # preset: clang @@ -255,7 +255,7 @@ jobs: - name: Install dependencies run: | choco install ninja - vcpkg install freetype:${{matrix.vcpkg_arch}}-windows-static zstd:${{matrix.vcpkg_arch}}-windows-static + vcpkg install freetype:${{matrix.vcpkg_arch}}-windows zstd:${{matrix.vcpkg_arch}}-windows - name: Configure CMake run: cmake --preset x-windows-ci-${{matrix.preset}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 0659dc9c53..e93ba3cb22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,8 @@ project(dusklight LANGUAGES C CXX VERSION ${DUSK_VERSION_STRING}) if (APPLE) enable_language(OBJC OBJCXX) endif () +# Adjust CMAKE_SYSTEM_PROCESSOR on Windows to match compiler target +include(cmake/WindowsTargetProcessor.cmake) if (APPLE AND NOT TVOS AND CMAKE_SYSTEM_NAME STREQUAL tvOS) # ios.toolchain.cmake hack for SDL set(TVOS ON) @@ -168,6 +170,7 @@ if (DUSK_MOVIE_SUPPORT) endif () set(_jpeg_cmake_args -DCMAKE_INSTALL_PREFIX=${_jpeg_install_dir} + -DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/WindowsTargetProcessor.cmake -DENABLE_SHARED=OFF -DWITH_TURBOJPEG=ON -DWITH_JAVA=OFF diff --git a/CMakePresets.json b/CMakePresets.json index ce84f84149..1c7f989b0c 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -33,7 +33,11 @@ "value": true }, "DUSK_SENTRY_DSN": "$env{SENTRY_DSN}", - "DUSK_SENTRY_ENVIRONMENT": "production" + "DUSK_SENTRY_ENVIRONMENT": "production", + "Rust_RUSTUP_INSTALL_MISSING_TARGET": { + "type": "BOOL", + "value": true + } } }, { @@ -489,7 +493,10 @@ "inherits": [ "x-windows-ci", "windows-arm64-msvc" - ] + ], + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "arm64-windows" + } } ], "buildPresets": [ diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh index 6653876f71..b401dab253 100755 --- a/ci/build-appimage.sh +++ b/ci/build-appimage.sh @@ -6,6 +6,7 @@ fi build_dir="$PWD/build" linuxdeploy="$build_dir/linuxdeploy-$(uname -m).AppImage" +lib_dir="/usr/lib/$(uname -m)-linux-gnu" # Get linuxdeploy mkdir -p "$build_dir" @@ -23,4 +24,4 @@ cp platforms/freedesktop/dusklight.desktop build/appdir/usr/share/applications cd build/install VERSION="$DUSK_VERSION" NO_STRIP=1 "$linuxdeploy" \ - -l /usr/lib/x86_64-linux-gnu/libusb-1.0.so --appdir "$build_dir/appdir" --output appimage + -l "$lib_dir/libusb-1.0.so" --appdir "$build_dir/appdir" --output appimage diff --git a/cmake/WindowsTargetProcessor.cmake b/cmake/WindowsTargetProcessor.cmake new file mode 100644 index 0000000000..0fba82add5 --- /dev/null +++ b/cmake/WindowsTargetProcessor.cmake @@ -0,0 +1,9 @@ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if (CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64" OR CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64EC") + set(CMAKE_SYSTEM_PROCESSOR "ARM64") + elseif (CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64") + set(CMAKE_SYSTEM_PROCESSOR "AMD64") + elseif (CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86") + set(CMAKE_SYSTEM_PROCESSOR "X86") + endif () +endif () diff --git a/extern/aurora b/extern/aurora index db9923749f..924a88cb1e 160000 --- a/extern/aurora +++ b/extern/aurora @@ -1 +1 @@ -Subproject commit db9923749fb6d24d84a0e6fc7ee875db8fa361af +Subproject commit 924a88cb1edafc7ddbfb285a7872c71831685495 diff --git a/libs/freeverb/denormals.h b/libs/freeverb/denormals.h index d68cb444f7..9193798abe 100644 --- a/libs/freeverb/denormals.h +++ b/libs/freeverb/denormals.h @@ -13,20 +13,33 @@ inline denormal_state denormals_enable() } inline void denormals_restore(denormal_state saved) { _mm_setcsr(saved); } -#elif defined(__aarch64__) || defined(_M_ARM64) +#elif defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) #include +#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM64) || defined(_M_ARM64EC)) +#include +#endif using denormal_state = uint64_t; inline denormal_state denormals_enable() { +#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM64) || defined(_M_ARM64EC)) + denormal_state saved = static_cast(_ReadStatusReg(ARM64_FPCR)); + _WriteStatusReg(ARM64_FPCR, static_cast<__int64>(saved | (1ULL << 24))); // FZ + return saved; +#else denormal_state saved; asm volatile("mrs %0, fpcr" : "=r"(saved)); asm volatile("msr fpcr, %0" :: "r"(saved | (1ULL << 24))); // FZ return saved; +#endif } inline void denormals_restore(denormal_state saved) { +#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM64) || defined(_M_ARM64EC)) + _WriteStatusReg(ARM64_FPCR, static_cast<__int64>(saved)); +#else asm volatile("msr fpcr, %0" :: "r"(saved)); +#endif } #elif defined(__arm__) || defined(_M_ARM)