diff --git a/build.gradle.kts b/build.gradle.kts index 96371791..e8184839 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -118,7 +118,6 @@ artifactNameMap.forEach { (subprojectName, artifactName) -> allprojects { tasks.withType { options { - verbose() if (this is CoreJavadocOptions) { if (jdkEnablePreview.toBoolean()) { addBooleanOption("-enable-preview", true) diff --git a/buildSrc/src/main/kotlin/myproject.java-conventions.gradle.kt b/buildSrc/src/main/kotlin/myproject.java-conventions.gradle.kt index 797bc1f5..be13df4f 100644 --- a/buildSrc/src/main/kotlin/myproject.java-conventions.gradle.kt +++ b/buildSrc/src/main/kotlin/myproject.java-conventions.gradle.kt @@ -22,13 +22,16 @@ enum class NativePlatform( val nativeLibSuffix: String, val taskSuffix: String ) { - WIN_64("windows", "x64", "windows", "", ".dll", "Win64"), - WIN_ARM64("windows", "arm64", "windows-arm64", "", ".dll", "WinArm64"), + FREEBSD_X64("freebsd", "x64", "freebsd", "lib", ".so", "FreeBSD64"), LINUX_64("linux", "x64", "linux", "lib", ".so", "Linux64"), LINUX_ARM32("linux", "arm32", "linux-arm32", "lib", ".so", "LinuxArm32"), LINUX_ARM64("linux", "arm64", "linux-arm64", "lib", ".so", "LinuxArm64"), + LINUX_PPC64LE("linux", "ppc64le", "linux-ppc64le", "lib", ".so", "LinuxPpc64le"), + LINUX_RISCV64("linux", "riscv64", "linux-riscv64", "lib", ".so", "LinuxRiscv64"), MACOS("macos", "x64", "macos", "lib", ".dylib", "Macos"), - MACOS_ARM64("macos", "arm64", "macos-arm64", "lib", ".dylib", "MacosArm64"); + MACOS_ARM64("macos", "arm64", "macos-arm64", "lib", ".dylib", "MacosArm64"), + WIN_64("windows", "x64", "windows", "", ".dll", "Win64"), + WIN_ARM64("windows", "arm64", "windows-arm64", "", ".dll", "WinArm64"); companion object { val ALL = values() @@ -42,12 +45,7 @@ enum class NativeBinding( val basename: String, vararg val platforms: NativePlatform ) { - GLFW( - "glfw", "glfw3", - NativePlatform.WIN_64, - NativePlatform.LINUX_64, NativePlatform.LINUX_ARM64, - NativePlatform.MACOS, NativePlatform.MACOS_ARM64 - ), + GLFW("glfw", "glfw", *NativePlatform.ALL), NFD("nfd", "nfd", *NativePlatform.ALL), STB("stb", "stb", *NativePlatform.ALL) } @@ -97,6 +95,6 @@ enum class Artifact( fun nativeFileName(platform: NativePlatform): String? { return if (nativeBinding == null) null - else "${nativeBinding.bindingName}/${platform.osFamilyName}/${platform.osArch}/${platform.nativeLibPrefix}${nativeBinding.basename}${platform.nativeLibSuffix}" + else "${nativeBinding.bindingName}/${platform.osFamilyName}-${platform.osArch}/${platform.nativeLibPrefix}${nativeBinding.basename}${platform.nativeLibSuffix}" } } diff --git a/doc/internal/README.md b/doc/internal/README.md index a3e4cd99..dd32b061 100644 --- a/doc/internal/README.md +++ b/doc/internal/README.md @@ -4,6 +4,12 @@ To publish this library, you need a GPG key and the write permission of Maven Central. +### CI + +- [glfw](https://github.com/Over-Run/glfw-ci) +- [nfd](https://github.com/Over-Run/nfd-ci) +- [stb](https://github.com/Over-Run/stb-ci) + ### Packing Natives The build script packs the native libraries into jars. @@ -12,56 +18,27 @@ The tree structure of the native libraries is: ```text natives -├─ glfw -│ ├─ linux -│ │ ├─ arm64 -│ │ │ └─ libglfw3.so -│ │ └─ x64 -│ │ └─ libglfw3.so -│ ├─ macos -│ │ ├─ arm64 -│ │ │ └─ libglfw3.dylib -│ │ └─ x64 -│ │ └─ libglfw3.dylib -│ └─ windows -│ └─ x64 -│ └─ glfw3.dll -├─ nfd https://github.com/Over-Run/nfd-ci -│ ├─ linux -│ │ ├─ arm32 -│ │ │ └─ libnfd.so -│ │ ├─ arm64 -│ │ │ └─ libnfd.so -│ │ └─ x64 -│ │ └─ libnfd.so -│ ├─ macos -│ │ ├─ arm64 -│ │ │ └─ libnfd.dylib -│ │ └─ x64 -│ │ └─ libnfd.dylib -│ └─ windows -│ ├─ arm64 -│ │ └─ nfd.dll -│ └─ x64 -│ └─ nfd.dll -└─ stb https://github.com/Over-Run/stb-ci - ├─ linux - │ ├─ arm32 - │ │ └─ libstb.so - │ ├─ arm64 - │ │ └─ libstb.so - │ └─ x64 - │ └─ libstb.so - ├─ macos - │ ├─ arm64 - │ │ └─ libstb.dylib - │ └─ x64 - │ └─ libstb.dylib - └─ windows - ├─ arm64 - │ └─ stb.dll - └─ x64 - └─ stb.dll +└─ + ├─ freebsd-x64 + │ └─ lib.so + ├─ linux-arm32 + │ └─ lib.so + ├─ linux-arm64 + │ └─ lib.so + ├─ linux-ppc64le + │ └─ lib.so + ├─ linux-riscv64 + │ └─ lib.so + ├─ linux-x64 + │ └─ lib.so + ├─ macos-arm64 + │ └─ lib.dylib + ├─ macos-x64 + │ └─ lib.dylib + ├─ windows-arm64 + │ └─ .dll + └─ windows-x64 + └─ .dll ``` -The `natives` directory is in the project directory. +The `natives` directory is in the root project directory. diff --git a/modules/overrungl.core/src/main/java/overrungl/OverrunGL.java b/modules/overrungl.core/src/main/java/overrungl/OverrunGL.java index b0ff75bb..dbdefdf4 100644 --- a/modules/overrungl.core/src/main/java/overrungl/OverrunGL.java +++ b/modules/overrungl.core/src/main/java/overrungl/OverrunGL.java @@ -37,15 +37,15 @@ public final class OverrunGL { /** * The version of GLFW native libraries. */ - public static final String GLFW_VERSION = "3.4.0.0"; + public static final String GLFW_VERSION = "3.5.0.0"; /** * The version of NFD native libraries. */ - public static final String NFD_VERSION = "0.1.0.0"; + public static final String NFD_VERSION = "1.1.1.0"; /** * The version of STB native libraries. */ - public static final String STB_VERSION = "0.1.0.3"; + public static final String STB_VERSION = "0.1.0.4"; private static final Consumer DEFAULT_LOGGER = System.err::println; private static Consumer apiLogger = DEFAULT_LOGGER; diff --git a/modules/overrungl.core/src/main/java/overrungl/internal/RuntimeHelper.java b/modules/overrungl.core/src/main/java/overrungl/internal/RuntimeHelper.java index 4685cf39..24785d6a 100644 --- a/modules/overrungl.core/src/main/java/overrungl/internal/RuntimeHelper.java +++ b/modules/overrungl.core/src/main/java/overrungl/internal/RuntimeHelper.java @@ -39,7 +39,8 @@ public final class RuntimeHelper { * The native linker. */ private static final Linker LINKER = Linker.nativeLinker(); - private static final Path tmpdir = Path.of(System.getProperty("java.io.tmpdir")); + private static final Path tmpdir = Path.of(System.getProperty("java.io.tmpdir")) + .resolve(STR."overrungl\{System.getProperty("user.name")}"); private static final StackWalker STACK_WALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); private static final Map CANONICAL_LAYOUTS = LINKER.canonicalLayouts(); /** @@ -102,24 +103,23 @@ public static SymbolLookup load(String module, String basename, String version) uri = localFile; } else { // 2. Load from classpath - var file = tmpdir.resolve(STR."overrungl\{System.getProperty("user.name")}"); try { - if (!Files.exists(file)) { + if (!Files.exists(tmpdir)) { // Create directory - Files.createDirectories(file); - } else if (!Files.isDirectory(file)) { + Files.createDirectories(tmpdir); + } else if (!Files.isDirectory(tmpdir)) { // Remove - Files.delete(file); + Files.delete(tmpdir); // Create directory - Files.createDirectories(file); + Files.createDirectories(tmpdir); } } catch (IOException e) { - throw new IllegalStateException(STR."Couldn't create directory: \{file}; try setting -Doverrungl.natives to a valid path", e); + throw new IllegalStateException(STR."Couldn't create directory: \{tmpdir}; try setting -Doverrungl.natives to a valid path", e); } - var libFile = file.resolve(STR."\{basename}-\{version}\{suffix}"); + var libFile = tmpdir.resolve(STR."\{basename}-\{version}\{suffix}"); if (!Files.exists(libFile)) { // Extract - final String fromPath = STR."\{module}/\{os.familyName()}/\{Architecture.current()}/\{path}"; + final String fromPath = STR."\{module}/\{os.familyName()}-\{Architecture.current()}/\{path}"; try (var is = STACK_WALKER.getCallerClass().getClassLoader().getResourceAsStream(fromPath)) { Files.copy(Objects.requireNonNull(is, STR."File not found in classpath: \{fromPath}"), libFile); } catch (Exception e) { diff --git a/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java index f1745d71..7b059bea 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java @@ -33,7 +33,7 @@ final class Handles { static final SymbolLookup lookup; static { - final Supplier lib = () -> RuntimeHelper.load("glfw", "glfw3", OverrunGL.GLFW_VERSION); + final Supplier lib = () -> RuntimeHelper.load("glfw", "glfw", OverrunGL.GLFW_VERSION); final var function = Configurations.GLFW_SYMBOL_LOOKUP.get(); lookup = function != null ? function.apply(lib) : lib.get(); }