From fc4cf90cc3b86cd52e16b8a63d55a692dc9e7663 Mon Sep 17 00:00:00 2001 From: merati22 Date: Sun, 14 Jul 2024 14:57:58 +0330 Subject: [PATCH] Add skiko-awt-runtime dependency Co-authored-by: merati22 Co-authored-by: Mahdi Hosseinzadeh <29678011+mahozad@users.noreply.github.com> Fixes #3 --- library/build.gradle.kts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/library/build.gradle.kts b/library/build.gradle.kts index 3582893..c1bf011 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -90,7 +90,23 @@ kotlin { val desktopMain by getting { dependencies { // api(libs.androidx.ui.desktop) - // implementation("org.jetbrains.skiko:skiko-awt-runtime-windows-x64:0.7.92") + // See https://github.com/JetBrains/compose-multiplatform/blob/master/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/osUtils.kt + val osName = System.getProperty("os.name") + val osArch = System.getProperty("os.arch") + val targetOs = when { + osName.equals("Mac OS X", ignoreCase = true) -> "macos" + osName.startsWith("Linux", ignoreCase = true) -> "linux" + osName.startsWith("Win", ignoreCase = true) -> "windows" + else -> error("Unsupported OS: $osName") + } + val targetArch = when (osArch) { + "x86_64", "amd64" -> "x64" + "aarch64" -> "arm64" + else -> error("Unsupported architecture: $osArch") + } + val target = "${targetOs}-${targetArch}" + val version = libs.versions.skiko.get() + implementation("org.jetbrains.skiko:skiko-awt-runtime-$target:$version") } } val desktopTest by getting {