aboutsummaryrefslogtreecommitdiff
path: root/build.gradle.kts
diff options
context:
space:
mode:
authorEdwin Jakobs <edwin@rndr.studio>2020-01-29 12:43:32 +0100
committerEdwin Jakobs <edwin@rndr.studio>2020-01-29 12:43:32 +0100
commitede734d74cd06e18d20a597ea0a3bb6381ddad15 (patch)
tree728aa66705a5e64839ff8c8894c5cecc9ea2bb65 /build.gradle.kts
parent89fce80affc76bd19acd9ec03c62475c7c2b03ac (diff)
downloadart-playground-openrndr-ede734d74cd06e18d20a597ea0a3bb6381ddad15.tar.gz
art-playground-openrndr-ede734d74cd06e18d20a597ea0a3bb6381ddad15.zip
Add support for cross building and support for future linux-arm64 version
Diffstat (limited to '')
-rw-r--r--build.gradle.kts19
1 files changed, 17 insertions, 2 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index c48d384..1e69120 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,5 +1,7 @@
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
+
group = "org.openrndr.template"
version = "0.3.9"
@@ -24,10 +26,23 @@ val openrndrFeatures = setOf("video", "panel")
// --------------------------------------------------------------------------------------------------------------------
-val openrndrOs = when (OperatingSystem.current()) {
+val supportedPlatforms = setOf("windows", "macos", "linux-x64", "linux-arm64")
+
+val openrndrOs = if (project.hasProperty("targetPlatform")) {
+ val platform : String = project.property("targetPlatform") as String
+ if (platform !in supportedPlatforms) {
+ throw IllegalArgumentException("target platform not supported: $platform")
+ } else {
+ platform
+ }
+} else when (OperatingSystem.current()) {
OperatingSystem.WINDOWS -> "windows"
OperatingSystem.MAC_OS -> "macos"
- OperatingSystem.LINUX -> "linux-x64"
+ OperatingSystem.LINUX -> when(val h = DefaultNativePlatform("current").architecture.name) {
+ "x86-64" -> "linux-x64"
+ "arm64" -> "linux-arm64"
+ else ->throw IllegalArgumentException("architecture not supported: $h")
+ }
else -> throw IllegalArgumentException("os not supported")
}
enum class Logging {