commit 8325b97f022849edadec9839c3b9a4c8c97477bb
parent 46c179a58cc6851cf0ceb4e45f0020433f845528
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 11 Nov 2023 08:58:02 -0500
add Windows ARM64EC builds (Windows 11, REAPER 7.04+)
https://devblogs.microsoft.com/windows-music-dev/load-x64-plug-ins-like-vsts-from-your-arm-code-using-arm64ec/
https://devblogs.microsoft.com/cppblog/arm64ec-support-in-visual-studio/
https://techcommunity.microsoft.com/t5/windows-os-platform-blog/getting-to-know-arm64ec-defines-and-intrinsic-functions/ba-p/2957235
Diffstat:
5 files changed, 100 insertions(+), 77 deletions(-)
diff --git a/.appveyor.yml b/.appveyor.yml
@@ -14,7 +14,8 @@ build_script:
- cmake --build build
test_script:
- - '[ "$ARCH" = "arm64" ] || cmake --build build --target test'
+ - sh: '[[ "$ARCH" = arm64 ]] || cmake --build build --target test'
+ - cmd: 'if NOT "%ARCH%" == "arm64ec" cmake --build build --target test'
for:
- matrix: { only: [ appveyor_build_worker_image: &linux Ubuntu1804 ] }
@@ -113,11 +114,14 @@ for:
- matrix: { only: [ appveyor_build_worker_image: &windows Visual Studio 2022 ] }
cache:
- - build\vcpkg_installed -> vcpkg.json
+ - build\vcpkg_installed -> vcpkg.json, cmake\vcpkg-triplets\arm64ec-windows-static.cmake
install:
- - if "%ARCH%" == "x64" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
- - if "%ARCH%" == "x86" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat"
+ - if "%ARCH%" == "x64" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
+ - if "%ARCH%" == "x86" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat"
+ - if "%ARCH%" == "arm64ec" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
+ - if "%ARCH%" == "arm64ec" set CFLAGS=-arm64EC & set CXXFLAGS=-arm64EC
build_script:
+ - set VCPKG_OVERLAY_TRIPLETS=cmake\vcpkg-triplets
- cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DVCPKG_TARGET_TRIPLET=%ARCH%-windows-static
-DCMAKE_TOOLCHAIN_FILE=C:\Tools\vcpkg\scripts\buildsystems\vcpkg.cmake
@@ -128,12 +132,15 @@ for:
environment:
matrix:
- - job_name: Windows 64-bit
+ - job_name: Windows x86 64-bit
appveyor_build_worker_image: *windows
ARCH: x64
- - job_name: Windows 32-bit
+ - job_name: Windows x86 32-bit
appveyor_build_worker_image: *windows
ARCH: x86
+ - job_name: Windows ARM 64-bit EC
+ appveyor_build_worker_image: *windows
+ ARCH: arm64ec
- job_name: macOS x86 64-bit
appveyor_build_worker_image: macos-mojave
ARCH: x86_64
diff --git a/cmake/vcpkg-triplets/arm64ec-windows-static.cmake b/cmake/vcpkg-triplets/arm64ec-windows-static.cmake
@@ -0,0 +1,3 @@
+set(VCPKG_TARGET_ARCHITECTURE arm64ec)
+set(VCPKG_CRT_LINKAGE static)
+set(VCPKG_LIBRARY_LINKAGE static)
diff --git a/src/platform.cpp b/src/platform.cpp
@@ -46,7 +46,9 @@ const Platform::Enum Platform::Current = Platform::
# endif
#elif _WIN32
-# ifdef _WIN64
+# ifdef _M_ARM64EC
+ Windows_arm64ec
+# elif _M_X64
Windows_x64
# else
Windows_x86
@@ -76,9 +78,10 @@ auto Platform::parse(const char *platform) -> Enum
{ "linux-armv7l", Linux_armv7l },
{ "linux-aarch64", Linux_aarch64 },
- { "windows", Windows_Any },
- { "win32", Windows_x86 },
- { "win64", Windows_x64 },
+ { "windows", Windows_Any },
+ { "win32", Windows_x86 },
+ { "win64", Windows_x64 },
+ { "windows-arm64ec", Windows_arm64ec },
};
for(auto &[key, value] : map) {
diff --git a/src/platform.hpp b/src/platform.hpp
@@ -34,11 +34,12 @@ public:
Linux_aarch64 = 1<<6,
Linux_Any = Linux_i686 | Linux_x86_64 | Linux_armv7l | Linux_aarch64,
- Windows_x86 = 1<<7,
- Windows_x64 = 1<<8,
- Windows_Any = Windows_x86 | Windows_x64,
+ Windows_x86 = 1<<7,
+ Windows_x64 = 1<<8,
+ Windows_arm64ec = 1<<9,
+ Windows_Any = Windows_x86 | Windows_x64 | Windows_arm64ec,
- Generic = Darwin_Any | Linux_Any | Windows_Any,
+ Generic = Darwin_Any | Linux_Any | Windows_Any,
};
static const Enum Current;
diff --git a/test/platform.cpp b/test/platform.cpp
@@ -20,9 +20,10 @@ TEST_CASE("platform from string", M) {
REQUIRE(Platform("all") == Platform::Generic);
SECTION("windows") {
- REQUIRE(Platform("windows") == Platform::Windows_Any);
- REQUIRE(Platform("win32") == Platform::Windows_x86);
- REQUIRE(Platform("win64") == Platform::Windows_x64);
+ REQUIRE(Platform("windows") == Platform::Windows_Any);
+ REQUIRE(Platform("win32") == Platform::Windows_x86);
+ REQUIRE(Platform("win64") == Platform::Windows_x64);
+ REQUIRE(Platform("windows-arm64ec") == Platform::Windows_arm64ec);
}
SECTION("macOS") {
@@ -47,84 +48,92 @@ TEST_CASE("test platform", M) {
{Platform::Generic, true },
#ifdef __APPLE__
- {Platform::Linux_Any, false},
- {Platform::Linux_x86_64, false},
- {Platform::Linux_i686, false},
- {Platform::Linux_armv7l, false},
- {Platform::Linux_aarch64, false},
- {Platform::Windows_Any, false},
- {Platform::Windows_x64, false},
- {Platform::Windows_x86, false},
-
- {Platform::Darwin_Any, true },
+ {Platform::Linux_Any, false},
+ {Platform::Linux_x86_64, false},
+ {Platform::Linux_i686, false},
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, false},
+ {Platform::Windows_Any, false},
+ {Platform::Windows_x64, false},
+ {Platform::Windows_x86, false},
+ {Platform::Windows_arm64ec, false},
+
+ {Platform::Darwin_Any, true },
# ifdef __x86_64__
- {Platform::Darwin_i386, false},
- {Platform::Darwin_x86_64, true },
- {Platform::Darwin_arm64, false},
+ {Platform::Darwin_i386, false},
+ {Platform::Darwin_x86_64, true },
+ {Platform::Darwin_arm64, false},
# elif __i386__
- {Platform::Darwin_i386, true },
- {Platform::Darwin_x86_64, false},
- {Platform::Darwin_arm64, false},
+ {Platform::Darwin_i386, true },
+ {Platform::Darwin_x86_64, false},
+ {Platform::Darwin_arm64, false},
# elif __arm64__
- {Platform::Darwin_i386, false},
- {Platform::Darwin_x86_64, false},
- {Platform::Darwin_arm64, true },
+ {Platform::Darwin_i386, false},
+ {Platform::Darwin_x86_64, false},
+ {Platform::Darwin_arm64, true },
# else
# error Untested architecture
# endif
#elif __linux__
- {Platform::Darwin_Any, false},
- {Platform::Darwin_i386, false},
- {Platform::Darwin_x86_64, false},
- {Platform::Darwin_arm64, false},
- {Platform::Windows_Any, false},
- {Platform::Windows_x86, false},
- {Platform::Windows_x64, false},
-
- {Platform::Linux_Any, true },
+ {Platform::Darwin_Any, false},
+ {Platform::Darwin_i386, false},
+ {Platform::Darwin_x86_64, false},
+ {Platform::Darwin_arm64, false},
+ {Platform::Windows_Any, false},
+ {Platform::Windows_x86, false},
+ {Platform::Windows_x64, false},
+ {Platform::Windows_arm64ec, false},
+
+ {Platform::Linux_Any, true },
# ifdef __x86_64__
- {Platform::Linux_i686, false},
- {Platform::Linux_x86_64, true },
- {Platform::Linux_armv7l, false},
- {Platform::Linux_aarch64, false},
+ {Platform::Linux_i686, false},
+ {Platform::Linux_x86_64, true },
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, false},
# elif __i686__
- {Platform::Linux_i686, true },
- {Platform::Linux_x86_64, false},
- {Platform::Linux_armv7l, false},
- {Platform::Linux_aarch64, false},
+ {Platform::Linux_i686, true },
+ {Platform::Linux_x86_64, false},
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, false},
# elif __ARM_ARCH_7A__
- {Platform::Linux_i686, false},
- {Platform::Linux_x86_64, false},
- {Platform::Linux_armv7l, true },
- {Platform::Linux_aarch64, false},
+ {Platform::Linux_i686, false},
+ {Platform::Linux_x86_64, false},
+ {Platform::Linux_armv7l, true },
+ {Platform::Linux_aarch64, false},
# elif __aarch64__
- {Platform::Linux_i686, false},
- {Platform::Linux_x86_64, false},
- {Platform::Linux_armv7l, false},
- {Platform::Linux_aarch64, true },
+ {Platform::Linux_i686, false},
+ {Platform::Linux_x86_64, false},
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, true },
# else
# error Untested architecture
# endif
#elif _WIN32
- {Platform::Darwin_Any, false},
- {Platform::Darwin_i386, false},
- {Platform::Darwin_x86_64, false},
- {Platform::Darwin_arm64, false},
- {Platform::Linux_Any, false},
- {Platform::Linux_x86_64, false},
- {Platform::Linux_i686, false},
- {Platform::Linux_armv7l, false},
- {Platform::Linux_aarch64, false},
-
- {Platform::Windows_Any, true },
-# ifdef _WIN64
- {Platform::Windows_x86, false},
- {Platform::Windows_x64, true },
+ {Platform::Darwin_Any, false},
+ {Platform::Darwin_i386, false},
+ {Platform::Darwin_x86_64, false},
+ {Platform::Darwin_arm64, false},
+ {Platform::Linux_Any, false},
+ {Platform::Linux_x86_64, false},
+ {Platform::Linux_i686, false},
+ {Platform::Linux_armv7l, false},
+ {Platform::Linux_aarch64, false},
+
+ {Platform::Windows_Any, true },
+# ifdef _M_ARM64EC
+ {Platform::Windows_x86, false},
+ {Platform::Windows_x64, false},
+ {Platform::Windows_arm64ec, true },
+# elif _M_X64
+ {Platform::Windows_x86, false},
+ {Platform::Windows_x64, true },
+ {Platform::Windows_arm64ec, false},
# else
- {Platform::Windows_x86, true },
- {Platform::Windows_x64, false},
+ {Platform::Windows_x86, true },
+ {Platform::Windows_x64, false},
+ {Platform::Windows_arm64ec, false},
# endif
#else