Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Disable Kotlin/Native when running in Linux Arm
Browse files Browse the repository at this point in the history
Fixes #560
  • Loading branch information
soywiz committed Apr 3, 2022
1 parent c86c68a commit 97765d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
16 changes: 11 additions & 5 deletions buildSrc/src/main/kotlin/com/soywiz/korlibs/modules/Targets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.plugin.*
import org.jetbrains.kotlin.gradle.plugin.mpp.*

val Project.doEnableKotlinNative: Boolean get() = rootProject.findProperty("enableKotlinNative") == "true"
val Project.supportKotlinNative: Boolean get() {
// Linux and Windows ARM hosts doesn't have K/N toolchains
if ((isLinux || isWindows) && isArm) return false
return false
}

val Project.doEnableKotlinNative: Boolean get() = supportKotlinNative && rootProject.findProperty("enableKotlinNative") == "true"
val Project.doEnableKotlinAndroid: Boolean get() = rootProject.findProperty("enableKotlinAndroid") == "true"
val Project.doEnableKotlinMobile: Boolean get() = rootProject.findProperty("enableKotlinMobile") == "true"
val Project.doEnableKotlinMobileTvos: Boolean get() = rootProject.findProperty("enableKotlinMobileTvos") == "true"
val Project.doEnableKotlinMobileWatchos: Boolean get() = rootProject.findProperty("enableKotlinMobileWatchos") == "true"
val Project.doEnableKotlinRaspberryPi: Boolean get() = rootProject.findProperty("enableKotlinRaspberryPi") == "true"
val Project.doEnableKotlinMobile: Boolean get() = doEnableKotlinNative && rootProject.findProperty("enableKotlinMobile") == "true"
val Project.doEnableKotlinMobileTvos: Boolean get() = doEnableKotlinMobile && rootProject.findProperty("enableKotlinMobileTvos") == "true"
val Project.doEnableKotlinMobileWatchos: Boolean get() = doEnableKotlinMobile && rootProject.findProperty("enableKotlinMobileWatchos") == "true"
val Project.doEnableKotlinRaspberryPi: Boolean get() = doEnableKotlinNative && rootProject.findProperty("enableKotlinRaspberryPi") == "true"

val KotlinTarget.isX64: Boolean get() = this.name.endsWith("X64")
val KotlinTarget.isX86: Boolean get() = this.name.endsWith("X86")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ class KorgeExtension(val project: Project) {
*/
fun targetDesktop() {
target("desktop") {
project.configureNativeDesktop()
if (supportKotlinNative) {
project.configureNativeDesktop()
}
}
}

Expand Down Expand Up @@ -185,7 +187,7 @@ class KorgeExtension(val project: Project) {
*/
fun targetIos() {
target("ios") {
if (isMacos) {
if (isMacos && supportKotlinNative) {
project.configureNativeIos()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.*
import org.jetbrains.kotlin.gradle.plugin.*

val supportKotlinNative: Boolean get() {
// Linux and Windows ARM hosts doesn't have K/N toolchains
if ((isLinux || isWindows) && isArm) return false
return false
}

val isWindows get() = Os.isFamily(Os.FAMILY_WINDOWS)
val isMacos get() = Os.isFamily(Os.FAMILY_MAC)
val isLinux get() = Os.isFamily(Os.FAMILY_UNIX) && !isMacos
Expand Down

0 comments on commit 97765d4

Please sign in to comment.