From 773e5d9706306a213048967e49be69970040d6dd Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Thu, 19 Sep 2024 11:13:26 +0200 Subject: [PATCH] Cross compile cli --- .github/workflows/publish.yaml | 4 ++-- build.gradle.kts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 709fe83..6ed38c3 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -28,8 +28,8 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/build.gradle.kts') }} - name: Install dependencies run: | - sudo apt update - sudo apt install libcurl4-openssl-dev + sudo apt -y update + sudo apt -y install libcurl4-openssl-dev - name: Build with Gradle run: ./gradlew commonBinaries - name: Move and apply correct permissions to binary diff --git a/build.gradle.kts b/build.gradle.kts index f16d4b4..951413f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,12 +17,14 @@ defaultTasks("commonBinaries") kotlin { val hostOs = System.getProperty("os.name") + val hostArch = System.getProperty("os.arch") // Cross Compilation val commonTarget = when { hostOs == "Mac OS X" -> macosArm64("common") - hostOs == "Linux" -> linuxX64("common") + hostOs == "Linux" && hostArch == "aarch64" -> linuxArm64("common") + hostOs == "Linux" && hostArch == "amd64" -> linuxX64("common") hostOs.startsWith("Windows") -> mingwX64("common") else -> throw GradleException("Host OS is not supported in Kotlin/Native.") }