From 9154c29bcd6082650e47dc6d346ef6f049660a95 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Jan 2024 20:16:04 -0500 Subject: [PATCH] Fix desktop previews on Mac Arm machine --- composeApp/build.gradle.kts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 6c5d710..973c083 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -11,6 +11,22 @@ plugins { } val projectVersion = project.ext.get("version")?.toString() +val osName = System.getProperty("os.name")!! +val targetOs = when { + osName == "Mac OS X" -> "macos" + osName.startsWith("Win") -> "windows" + osName.startsWith("Linux") -> "linux" + else -> error("Unsupported OS: $osName") +} + +val targetArch = when (val osArch = System.getProperty("os.arch")) { + "x86_64", "amd64" -> "x64" + "aarch64" -> "arm64" + else -> error("Unsupported arch: $osArch") +} + +val targetPlatform = "${targetOs}-${targetArch}" +println("Found target platform: $targetPlatform") kotlin { js(IR) { @@ -60,6 +76,7 @@ kotlin { } desktopMain.dependencies { implementation(compose.desktop.currentOs) + implementation("org.jetbrains.skiko:skiko-awt-runtime-$targetPlatform:${libs.versions.skiko.get()}") } iosMain.dependencies { }