From 36814267bcfacf111047418c45a7d4c121372749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 18:22:07 +0200 Subject: [PATCH] Support windows arm64 --- .github/workflows/binary-combine-windows.yml | 37 ++++++++++++++++++++ .github/workflows/ci.yml | 2 +- packages/realm_dart/CMakePresets.json | 21 +++++++++-- packages/realm_dart/scripts/build.bat | 10 ++++-- 4 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/binary-combine-windows.yml diff --git a/.github/workflows/binary-combine-windows.yml b/.github/workflows/binary-combine-windows.yml new file mode 100644 index 000000000..58a32a2f0 --- /dev/null +++ b/.github/workflows/binary-combine-windows.yml @@ -0,0 +1,37 @@ +name: Windows Build Combine + +on: + workflow_call: + +jobs: + build-windows-combined: + name: Combine Windows binaries + timeout-minutes: 15 + runs-on: windows-latest + steps: + - name: Fetch x64 build + uses: actions/download-artifact@v4 + with: + name: librealm-windows-x64 + path: packages/realm_dart/binary/windows + + - name: Fetch arm64 build + uses: actions/download-artifact@v4 + with: + name: librealm-windows-arme64 + path: packages/realm_dart/binary/windows + + - name: Store combined artifact + uses: actions/upload-artifact@v4 + with: + name: librealm-windows + path: packages/realm_dart/binary/windows + retention-days: 1 + + - name: Delete individual build artifacts + uses: geekyeggo/delete-artifact@v4 + with: + name: | + librealm-windows-x64 + librealm-windows-arm64 + failOnError: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cf172d84..23dddf687 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: with: runner: windows-latest binary: windows - build: '["windows"]' + build: '["windows-x64", "windows-arm64"]' build-macos: name: Build MacOS diff --git a/packages/realm_dart/CMakePresets.json b/packages/realm_dart/CMakePresets.json index b802ce4be..f1f115051 100644 --- a/packages/realm_dart/CMakePresets.json +++ b/packages/realm_dart/CMakePresets.json @@ -28,13 +28,22 @@ "name": "windows", "inherits": "default", "generator": "Visual Studio 17 2022", - "architecture": "x64", "condition": { "lhs": "${hostSystemName}", "type": "equals", "rhs": "Windows" } }, + { + "name": "windows-x64", + "inherits": "windows", + "architecture": "x64" + }, + { + "name": "windows-arm64", + "inherits": "windows", + "architecture": "ARM64" + }, { "name": "macos", "displayName": "macOS", @@ -125,11 +134,17 @@ "configuration": "Debug" }, { - "name": "windows", - "configurePreset": "windows", + "name": "windows-x64", + "configurePreset": "windows-x64", "displayName": "x64", "configuration": "Debug" }, + { + "name": "windows-arm64", + "configurePreset": "windows-arm64", + "displayName": "arm64", + "configuration": "Debug" + }, { "name": "android-x86_64", "configurePreset": "android-x86_64", diff --git a/packages/realm_dart/scripts/build.bat b/packages/realm_dart/scripts/build.bat index 208b0304c..d285edbe5 100644 --- a/packages/realm_dart/scripts/build.bat +++ b/packages/realm_dart/scripts/build.bat @@ -7,5 +7,11 @@ pushd "%~dp0.." echo %CD% -cmake --preset windows -cmake --build --preset windows --config MinSizeRel +@REM only building for x64 if no arguments +set ABIS=x64 arm64 +if [%1]==[] set ABIS=x64 + +(for %%a in (%ABIS%) do ( + cmake --preset windows-%%a + cmake --build --preset windows-%%a --config MinSizeRel +)) \ No newline at end of file