generated from exerro/kotlin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
61 lines (54 loc) · 2.43 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 org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val lwjglVersion = "3.3.2"
val lwjglNatives = run {
val name = System.getProperty("os.name")!!
val arch = System.getProperty("os.arch")!!
when {
arrayOf("Linux", "FreeBSD", "SunOS", "Unit").any { name.startsWith(it) } ->
if (arrayOf("arm", "aarch64").any { arch.startsWith(it) })
"natives-linux${if (arch.contains("64") || arch.startsWith("armv8")) "-arm64" else "-arm32"}"
else
"natives-linux"
arrayOf("Mac OS X", "Darwin").any { name.startsWith(it) } ->
"natives-macos${if (arch.startsWith("aarch64")) "-arm64" else ""}"
arrayOf("Windows").any { name.startsWith(it) } ->
if (arch.contains("64"))
"natives-windows${if (arch.startsWith("aarch64")) "-arm64" else ""}"
else
"natives-windows-x86"
else -> throw Error("Unrecognized or unsupported platform. Please set \"lwjglNatives\" manually")
}
}
plugins {
kotlin("jvm") version "1.8.10"
}
allprojects {
val lwjglApi by configurations.creating
val lwjglRuntimeOnly by configurations.creating
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
dependencies {
lwjglApi(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
lwjglApi("org.lwjgl", "lwjgl")
lwjglApi("org.lwjgl", "lwjgl-glfw")
lwjglApi("org.lwjgl", "lwjgl-opengl")
lwjglApi("org.lwjgl", "lwjgl-stb")
lwjglRuntimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives)
lwjglRuntimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives)
lwjglRuntimeOnly("org.lwjgl", "lwjgl-opengl", classifier = lwjglNatives)
lwjglRuntimeOnly("org.lwjgl", "lwjgl-stb", classifier = lwjglNatives)
lwjglRuntimeOnly("org.lwjgl", "lwjgl-stb", classifier = lwjglNatives)
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xcontext-receivers"
kotlinOptions.freeCompilerArgs += "-Xskip-prerelease-check"
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.contracts.ExperimentalContracts"
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.time.ExperimentalTime"
kotlinOptions.freeCompilerArgs += "-language-version"
kotlinOptions.freeCompilerArgs += "1.6"
}
}