-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
61 lines (58 loc) · 2.1 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import java.io.ByteArrayOutputStream
plugins {
kotlin("multiplatform") version "1.9.0"
}
group = "de.atennert"
repositories {
mavenCentral()
}
kotlin {
val nativeTarget = when (System.getProperty("os.name")) {
"Linux" -> {
val architecture: String = ByteArrayOutputStream().use { os ->
project.exec {
commandLine("uname", "-m")
standardOutput = os
}
os.toString().trim()
}
when {
architecture == "x86_64" -> linuxX64("native")
architecture.startsWith("arm64") -> linuxArm64("native")
architecture.startsWith("aarch64") -> linuxArm64("native")
else -> throw GradleException("Host CPU architecture not supported: $architecture.\n" +
"If you think, it should work, please:\n" +
"1. check your CPU architecture with \"uname -a\",\n" +
"2. find the corresponding target in this list: https://kotlinlang.org/docs/mpp-dsl-reference.html#targets,\n" +
"3. add a it to the architectures in build.gradle.kts,\n" +
"4. run the build and\n" +
"5. if it works, please create a ticket with the changes on https://github.com/lcarsde/lcarswm/issues to have it added permanently.")
}
}
else -> throw GradleException("Host OS is not supported.")
}
nativeTarget.apply {
binaries {
executable {
entryPoint = "main"
}
}
compilations.getByName("main") {
val statusbar by cinterops.creating
}
}
sourceSets {
commonMain {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
}
}
commonTest {
dependencies {
implementation( "org.jetbrains.kotlin:kotlin-test-common")
}
}
val nativeMain by getting
val nativeTest by getting
}
}