Fix LWJGL native load error

This commit is contained in:
JeremyStar™ 2024-10-15 04:06:05 +02:00
parent cdde093b31
commit f4019455cc
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -26,6 +26,29 @@ plugins {
id("maven-publish") id("maven-publish")
} }
// Determine operating system and architecture
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
project.dependencyLwjglNatives = "natives-linux"
def osArch = System.getProperty("os.arch")
if (osArch.startsWith("arm") || osArch.startsWith("aarch64"))
project.dependencyLwjglNatives += osArch.contains("64") || osArch.startsWith("armv8") ? "-arm64" : "-arm32"
else if (osArch.startsWith("ppc"))
project.dependencyLwjglNatives += "-ppc64le"
else if (osArch.startsWith("riscv"))
project.dependencyLwjglNatives += "-riscv64"
break
case OperatingSystem.MAC_OS:
project.dependencyLwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos"
break
case OperatingSystem.WINDOWS:
def osArch = System.getProperty("os.arch")
project.dependencyLwjglNatives = osArch.contains("64")
? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}"
: "natives-windows-x86"
break
}
// Dependencies // Dependencies
dependencies { dependencies {
// Lombok // Lombok
@ -125,26 +148,6 @@ publishing {
} }
} }
// Determine operating system and architecture
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
project.dependencyLwjglNatives = "natives-linux"
def osArch = System.getProperty("os.arch")
if (osArch.startsWith("arm") || osArch.startsWith("aarch64"))
project.dependencyLwjglNatives += osArch.contains("64") || osArch.startsWith("armv8") ? "-arm64" : "-arm32"
else if (osArch.startsWith("ppc"))
project.dependencyLwjglNatives += "-ppc64le"
else if (osArch.startsWith("riscv"))
project.dependencyLwjglNatives += "-riscv64"
case OperatingSystem.MAC_OS:
project.dependencyLwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos"
case OperatingSystem.WINDOWS:
def osArch = System.getProperty("os.arch")
project.dependencyLwjglNatives = osArch.contains("64")
? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}"
: "natives-windows-x86"
}
// Fix delombok task // Fix delombok task
delombok.doFirst { delombok.doFirst {
File target = file("${project.projectDir}/src/main/module-info.java") File target = file("${project.projectDir}/src/main/module-info.java")