From 164c762f1bf09dff0992977441a7f392e6db107a Mon Sep 17 00:00:00 2001 From: Darius Maitia Date: Thu, 19 Dec 2024 10:29:49 -0300 Subject: [PATCH] Aarch64 windows support Adding support for AARCH64 architectures on windows --- .github/workflows/publish-jvm.yml | 56 ++++++++++--------- .../src/jvmMain/kotlin/io/zenoh/Target.kt | 2 + .../src/jvmMain/kotlin/io/zenoh/Zenoh.kt | 4 ++ 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish-jvm.yml b/.github/workflows/publish-jvm.yml index 3f8d4d01..3fbb1cb9 100644 --- a/.github/workflows/publish-jvm.yml +++ b/.github/workflows/publish-jvm.yml @@ -29,35 +29,41 @@ jobs: job: # In order to load any added target at runtime, editing the Zenoh class under jvmMain is required. - { - target: x86_64-unknown-linux-gnu, - arch: amd64, - os: ubuntu-20.04, - build-cmd: "cargo", - } + target: x86_64-unknown-linux-gnu, + arch: amd64, + os: ubuntu-20.04, + build-cmd: "cargo", + } - { - target: aarch64-unknown-linux-gnu, - arch: arm64, - os: ubuntu-20.04, - build-cmd: "cross", - } + target: aarch64-unknown-linux-gnu, + arch: arm64, + os: ubuntu-20.04, + build-cmd: "cross", + } - { - target: x86_64-apple-darwin, - arch: darwin, - os: macos-latest, - build-cmd: "cargo", - } + target: x86_64-apple-darwin, + arch: darwin, + os: macos-latest, + build-cmd: "cargo", + } - { - target: aarch64-apple-darwin, - arch: darwin, - os: macos-latest, - build-cmd: "cargo", - } + target: aarch64-apple-darwin, + arch: darwin, + os: macos-latest, + build-cmd: "cargo", + } - { - target: x86_64-pc-windows-msvc, - arch: win64, - os: windows-2019, - build-cmd: "cargo", - } + target: x86_64-pc-windows-msvc, + arch: win64, + os: windows-2019, + build-cmd: "cargo", + } + - { + target: aarch64-pc-windows-msvc, + arch: arm64, + os: windows-2019, + build-cmd: "cargo", + } steps: - name: Checkout source code uses: actions/checkout@v4 diff --git a/zenoh-java/src/jvmMain/kotlin/io/zenoh/Target.kt b/zenoh-java/src/jvmMain/kotlin/io/zenoh/Target.kt index 0e58c219..f3f28256 100644 --- a/zenoh-java/src/jvmMain/kotlin/io/zenoh/Target.kt +++ b/zenoh-java/src/jvmMain/kotlin/io/zenoh/Target.kt @@ -16,6 +16,7 @@ package io.zenoh internal enum class Target { WINDOWS_X86_64_MSVC, + WINDOWS_AARCH64_MSVC, LINUX_X86_64, LINUX_AARCH64, APPLE_AARCH64, @@ -24,6 +25,7 @@ internal enum class Target { override fun toString(): String { return when (this) { WINDOWS_X86_64_MSVC -> "x86_64-pc-windows-msvc" + WINDOWS_AARCH64_MSVC -> "aarch64-pc-windows-msvc" LINUX_X86_64 -> "x86_64-unknown-linux-gnu" LINUX_AARCH64 -> "aarch64-unknown-linux-gnu" APPLE_AARCH64 -> "aarch64-apple-darwin" diff --git a/zenoh-java/src/jvmMain/kotlin/io/zenoh/Zenoh.kt b/zenoh-java/src/jvmMain/kotlin/io/zenoh/Zenoh.kt index 593e451d..8da47656 100644 --- a/zenoh-java/src/jvmMain/kotlin/io/zenoh/Zenoh.kt +++ b/zenoh-java/src/jvmMain/kotlin/io/zenoh/Zenoh.kt @@ -51,6 +51,10 @@ internal actual object ZenohLoad { osName.contains("win") -> when { osArch.contains("x86_64") || osArch.contains("amd64") || osArch.contains("x64") -> Target.WINDOWS_X86_64_MSVC + + osArch.contains("aarch64") || osArch.contains("arm64") -> + Target.WINDOWS_AARCH64_MSVC + else -> throw UnsupportedOperationException("Unsupported architecture on Windows: $osArch") }