Browse Source

Silence os constants access warnings

master
Abe Pazos 1 year ago
committed by Edwin Jakobs
parent
commit
88c716804b
  1. 41
      build.gradle.kts

41
build.gradle.kts

@ -163,23 +163,16 @@ tasks {
} }
named<org.beryx.runtime.JPackageTask>("jpackage") { named<org.beryx.runtime.JPackageTask>("jpackage") {
doLast { doLast {
when (OperatingSystem.current()) { val destPath = if(OperatingSystem.current().isMacOsX)
OperatingSystem.WINDOWS, OperatingSystem.LINUX -> { "build/jpackage/openrndr-application.app/Contents/Resources/data"
copy { else
from("data") { "build/jpackage/openrndr-application/data"
include("**/*")
} copy {
into("build/jpackage/openrndr-application/data") from("data") {
} include("**/*")
}
OperatingSystem.MAC_OS -> {
copy {
from("data") {
include("**/*")
}
into("build/jpackage/openrndr-application.app/Contents/Resources/data")
}
} }
into(destPath)
} }
} }
} }
@ -201,7 +194,7 @@ runtime {
jpackage { jpackage {
imageName = "openrndr-application" imageName = "openrndr-application"
skipInstaller = true skipInstaller = true
if (OperatingSystem.current() == OperatingSystem.MAC_OS) { if (OperatingSystem.current().isMacOsX) {
jvmArgs.add("-XstartOnFirstThread") jvmArgs.add("-XstartOnFirstThread")
jvmArgs.add("-Duser.dir=${"$"}APPDIR/../Resources") jvmArgs.add("-Duser.dir=${"$"}APPDIR/../Resources")
} }
@ -226,6 +219,8 @@ class Openrndr {
// choices are "orx-tensorflow-gpu", "orx-tensorflow" // choices are "orx-tensorflow-gpu", "orx-tensorflow"
val orxTensorflowBackend = "orx-tensorflow" val orxTensorflowBackend = "orx-tensorflow"
val currArch = DefaultNativePlatform("current").architecture.name
val currOs = OperatingSystem.current()
val os = if (project.hasProperty("targetPlatform")) { val os = if (project.hasProperty("targetPlatform")) {
val supportedPlatforms = setOf("windows", "macos", "linux-x64", "linux-arm64") val supportedPlatforms = setOf("windows", "macos", "linux-x64", "linux-arm64")
val platform: String = project.property("targetPlatform") as String val platform: String = project.property("targetPlatform") as String
@ -234,18 +229,18 @@ class Openrndr {
} else { } else {
platform platform
} }
} else when (OperatingSystem.current()) { } else when {
OperatingSystem.WINDOWS -> "windows" currOs.isWindows -> "windows"
OperatingSystem.MAC_OS -> when (val h = DefaultNativePlatform("current").architecture.name) { currOs.isMacOsX -> when (currArch) {
"aarch64", "arm-v8" -> "macos-arm64" "aarch64", "arm-v8" -> "macos-arm64"
else -> "macos" else -> "macos"
} }
OperatingSystem.LINUX -> when (val h = DefaultNativePlatform("current").architecture.name) { currOs.isLinux -> when (currArch) {
"x86-64" -> "linux-x64" "x86-64" -> "linux-x64"
"aarch64" -> "linux-arm64" "aarch64" -> "linux-arm64"
else -> throw IllegalArgumentException("architecture not supported: $h") else -> throw IllegalArgumentException("architecture not supported: $currArch")
} }
else -> throw IllegalArgumentException("os not supported") else -> throw IllegalArgumentException("os not supported: ${currOs.name}")
} }
fun orx(module: String) = "org.openrndr.extra:$module:$orxVersion" fun orx(module: String) = "org.openrndr.extra:$module:$orxVersion"

Loading…
Cancel
Save