2023-10-20 18:28:12 +00:00
|
|
|
kotlin {
|
2023-10-25 09:33:05 +00:00
|
|
|
def hostOs = System.getProperty("os.name")
|
|
|
|
def isMingwX64 = hostOs.startsWith("Windows")
|
|
|
|
def isArch64 = System.getProperty("os.arch") == "aarch64"
|
2023-10-20 18:28:12 +00:00
|
|
|
|
2023-10-25 09:33:05 +00:00
|
|
|
def nativeTarget
|
|
|
|
if (hostOs == "Linux") {
|
|
|
|
if (isArch64) {
|
|
|
|
nativeTarget = linuxArm64("native") { binaries { executable() } }
|
|
|
|
} else {
|
|
|
|
nativeTarget = linuxX64("native") { binaries { executable() } }
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (isMingwX64) {
|
|
|
|
nativeTarget = mingwX64("native") { binaries { executable() } }
|
|
|
|
} else {
|
|
|
|
throw new GradleException("Host OS is not supported in Kotlin/Native.")
|
|
|
|
}
|
|
|
|
}
|
2023-10-20 18:28:12 +00:00
|
|
|
}
|