From f4019455cc9a5147e505a89c635695185c8621e0 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 15 Oct 2024 04:06:05 +0200 Subject: [PATCH] Fix LWJGL native load error --- windowing/glfw/build.gradle | 43 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/windowing/glfw/build.gradle b/windowing/glfw/build.gradle index 4b11546c..81f884d8 100644 --- a/windowing/glfw/build.gradle +++ b/windowing/glfw/build.gradle @@ -26,6 +26,29 @@ plugins { 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 { // 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 delombok.doFirst { File target = file("${project.projectDir}/src/main/module-info.java")