From 4bfe3a81d41d494b4f7e09b4be4fc1e6558740bd Mon Sep 17 00:00:00 2001 From: "Simon E.W" Date: Mon, 11 Mar 2024 19:36:49 +0100 Subject: [PATCH] Forgot the build.gradle last commit --- build.gradle.kts | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 18a4441..3dc9741 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,11 +9,52 @@ repositories { mavenCentral() } +val lwjglVersion = "3.3.3" + +val lwjglNatives = Pair( + System.getProperty("os.name")!!, + System.getProperty("os.arch")!! +).let { (name, arch) -> + when { + arrayOf("Linux", "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 if (arch.startsWith("ppc")) + "natives-linux-ppc64le" + else if (arch.startsWith("riscv")) + "natives-linux-riscv64" + 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") + } +} + dependencies { implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.slf4j:slf4j-simple:2.0.12") testImplementation("org.jetbrains.kotlin:kotlin-test") + + testImplementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion")) + + testImplementation("org.lwjgl", "lwjgl") + testImplementation("org.lwjgl", "lwjgl-glfw") + testImplementation("org.lwjgl", "lwjgl-nanovg") + testImplementation("org.lwjgl", "lwjgl-opengl") + testImplementation("org.lwjgl", "lwjgl-stb") + testRuntimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives) + testRuntimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives) + testRuntimeOnly("org.lwjgl", "lwjgl-nanovg", classifier = lwjglNatives) + testRuntimeOnly("org.lwjgl", "lwjgl-opengl", classifier = lwjglNatives) + testRuntimeOnly("org.lwjgl", "lwjgl-stb", classifier = lwjglNatives) } tasks.test {