Skip to content

Commit

Permalink
Fix desktop previews on Mac Arm machine
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 28, 2024
1 parent 7291d55 commit 35657d1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
}
Expand Down

0 comments on commit 35657d1

Please sign in to comment.