Skip to content

Commit

Permalink
Forgot the build.gradle last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon3244 committed Mar 11, 2024
1 parent 65f666d commit 4bfe3a8
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4bfe3a8

Please sign in to comment.