Skip to content

Commit f5ac44c

Browse files
committed
Add all native targets in mpp-sample depending on a platform
1 parent 435860e commit f5ac44c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

integration-testing/examples/mpp-sample/build.gradle.kts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,18 @@ repositories {
2828

2929
kotlin {
3030
jvm()
31-
macosX64("native")
31+
32+
val hostOs = System.getProperty("os.name")
33+
val isArm64 = System.getProperty("os.arch") == "aarch64"
34+
val isMingwX64 = hostOs.startsWith("Windows")
35+
val nativeTarget = when {
36+
hostOs == "Mac OS X" && isArm64 -> macosArm64("native")
37+
hostOs == "Mac OS X" && !isArm64 -> macosX64("native")
38+
hostOs == "Linux" && isArm64 -> linuxArm64("native")
39+
hostOs == "Linux" && !isArm64 -> linuxX64("native")
40+
isMingwX64 -> mingwX64("native")
41+
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
42+
}
3243

3344
sourceSets {
3445
val commonMain by getting

0 commit comments

Comments
 (0)