diff --git a/native/.gitignore b/native/.gitignore deleted file mode 100644 index db5c42d..0000000 --- a/native/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.idea/ -*.iml -cmake-build-*/ \ No newline at end of file diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt deleted file mode 100644 index fa32ed9..0000000 --- a/native/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.21) -project(compose-gl LANGUAGES CXX) - -file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "src/*.cpp" "src/*.h" "src/*.hpp") -add_library(compose-gl SHARED ${SOURCES}) - -find_package(PkgConfig REQUIRED) -pkg_check_modules(GL REQUIRED IMPORTED_TARGET gl glx egl) -target_link_libraries(compose-gl PRIVATE PkgConfig::GL) -target_include_directories(compose-gl PRIVATE "/usr/lib/jvm/java-21-openjdk/include" "/usr/lib/jvm/java-21-openjdk/include/linux") diff --git a/native/build.gradle.kts b/native/build.gradle.kts deleted file mode 100644 index 4888e07..0000000 --- a/native/build.gradle.kts +++ /dev/null @@ -1,37 +0,0 @@ -import org.jetbrains.kotlin.incremental.createDirectory - -plugins { - base -} - -configurations.create("main") - -tasks { - register("generateMakefile") { - workingDir = layout.buildDirectory.dir("cmake").get().asFile.apply { createDirectory() } - commandLine("cmake", "-GNinja", layout.projectDirectory.asFile.absolutePath) - - inputs.file(layout.projectDirectory.file("CMakeLists.txt")) - outputs.dir(workingDir) - } - register("compileNative") { - workingDir = layout.buildDirectory.dir("cmake").get().asFile - commandLine("ninja") - dependsOn("generateMakefile") - - inputs.file(layout.buildDirectory.file("cmake/build.ninja")) - inputs.dir(layout.projectDirectory.dir("src")) - inputs.file(layout.projectDirectory.file("CMakeLists.txt")) - outputs.files(layout.buildDirectory.file("cmake/libcompose-gl.so")) - } - - build { - dependsOn("compileNative") - } -} - -artifacts { - tasks["compileNative"].outputs.files.onEach { - add("main", it) - } -} diff --git a/src/main/java/dev/silenium/compose/gl/util/Natives.kt b/src/main/java/dev/silenium/compose/gl/util/Natives.kt deleted file mode 100644 index 67b7736..0000000 --- a/src/main/java/dev/silenium/compose/gl/util/Natives.kt +++ /dev/null @@ -1,32 +0,0 @@ -package dev.silenium.compose.gl.util - -import java.nio.file.Files -import java.nio.file.Path -import kotlin.io.path.* - -@OptIn(ExperimentalPathApi::class) -object Natives { - private val dir = Files.createTempDirectory("compose-gl-natives") - private val libs = mutableMapOf() - - init { - Runtime.getRuntime().addShutdownHook(Thread { - dir.deleteRecursively() - }) - } - - // TODO: Support different os and architectures - fun load(libFileName: String) { - val libFile = libs.getOrPut(libFileName) { - val outputFile = dir.resolve(libFileName) - outputFile.createParentDirectories() - Natives::class.java.classLoader.getResourceAsStream("natives/$libFileName")!!.use { input -> - outputFile.outputStream().use { output -> - input.copyTo(output) - } - } - outputFile - } - System.load(libFile.absolutePathString()) - } -}