Skip to content

Commit 4bfe3a8

Browse files
committedMar 11, 2024·
Forgot the build.gradle last commit
1 parent 65f666d commit 4bfe3a8

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
 

‎build.gradle.kts

+41
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,52 @@ repositories {
99
mavenCentral()
1010
}
1111

12+
val lwjglVersion = "3.3.3"
13+
14+
val lwjglNatives = Pair(
15+
System.getProperty("os.name")!!,
16+
System.getProperty("os.arch")!!
17+
).let { (name, arch) ->
18+
when {
19+
arrayOf("Linux", "SunOS", "Unit").any { name.startsWith(it) } ->
20+
if (arrayOf("arm", "aarch64").any { arch.startsWith(it) })
21+
"natives-linux${if (arch.contains("64") || arch.startsWith("armv8")) "-arm64" else "-arm32"}"
22+
else if (arch.startsWith("ppc"))
23+
"natives-linux-ppc64le"
24+
else if (arch.startsWith("riscv"))
25+
"natives-linux-riscv64"
26+
else
27+
"natives-linux"
28+
arrayOf("Mac OS X", "Darwin").any { name.startsWith(it) } ->
29+
"natives-macos${if (arch.startsWith("aarch64")) "-arm64" else ""}"
30+
arrayOf("Windows").any { name.startsWith(it) } ->
31+
if (arch.contains("64"))
32+
"natives-windows${if (arch.startsWith("aarch64")) "-arm64" else ""}"
33+
else
34+
"natives-windows-x86"
35+
else ->
36+
throw Error("Unrecognized or unsupported platform. Please set \"lwjglNatives\" manually")
37+
}
38+
}
39+
1240
dependencies {
1341
implementation("org.jetbrains.kotlin:kotlin-reflect")
1442
implementation("org.slf4j:slf4j-simple:2.0.12")
1543

1644
testImplementation("org.jetbrains.kotlin:kotlin-test")
45+
46+
testImplementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
47+
48+
testImplementation("org.lwjgl", "lwjgl")
49+
testImplementation("org.lwjgl", "lwjgl-glfw")
50+
testImplementation("org.lwjgl", "lwjgl-nanovg")
51+
testImplementation("org.lwjgl", "lwjgl-opengl")
52+
testImplementation("org.lwjgl", "lwjgl-stb")
53+
testRuntimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives)
54+
testRuntimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives)
55+
testRuntimeOnly("org.lwjgl", "lwjgl-nanovg", classifier = lwjglNatives)
56+
testRuntimeOnly("org.lwjgl", "lwjgl-opengl", classifier = lwjglNatives)
57+
testRuntimeOnly("org.lwjgl", "lwjgl-stb", classifier = lwjglNatives)
1758
}
1859

1960
tasks.test {

0 commit comments

Comments
 (0)
Please sign in to comment.