Skip to content

Commit

Permalink
modernize native builds: they cross-compile now.
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushieno committed Jun 15, 2023
1 parent 2cad7eb commit c2d573e
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions ktmidi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,16 @@ kotlin {
}
}

iosArm64 { binaries { framework { baseName = "library" } } }
iosX64 { binaries { framework { baseName = "library" } } }
iosSimulatorArm64 { binaries {framework { baseName = "library" } } }
iosArm64 { binaries { framework { baseName = "ktmidi" } } }
iosX64 { binaries { framework { baseName = "ktmidi" } } }
iosSimulatorArm64 { binaries {framework { baseName = "ktmidi" } } }

val hostOs = System.getProperty("os.name")
val isArm64 = System.getProperty("os.arch") == "aarch64"
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" && isArm64 -> macosArm64("native")
hostOs == "Mac OS X" && !isArm64 -> macosX64("native")
hostOs == "Linux" && isArm64 -> linuxArm64("native")
hostOs == "Linux" && !isArm64 -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
macosArm64()
macosX64()
// kotlinx-datetime is not built enough to make it possible...
//linuxArm64()
linuxX64()
mingwX64()

sourceSets {
val commonMain by getting {
Expand Down Expand Up @@ -103,8 +98,14 @@ kotlin {
implementation(kotlin("test-js"))
}
}
val nativeMain by getting
val nativeTest by getting
val nativeMain by creating
val nativeTest by creating
val macosArm64Main by getting
val macosX64Main by getting
// kotlinx-datetime is not built enough to make it possible...
//val linuxArm64Main by getting
val linuxX64Main by getting
val mingwX64Main by getting
val iosArm64Main by getting
val iosArm64Test by getting
val iosSimulatorArm64Main by getting
Expand Down

0 comments on commit c2d573e

Please sign in to comment.