This message was deleted.
# native
s
This message was deleted.
g
I'm trying to express somehow this in Gradle
Copy code
[Compiler] Executing 'gcc' with arguments:
 [Compiler] '-c'
 [Compiler] '-m64'
 [Compiler] '-O3'
 [Compiler] '-flto'
 [Compiler] '-fPIC'
 [Compiler] '-pthread'
 [Compiler] '-DNDEBUG'
 [Compiler] '-DLWJGL_LINUX'
 [Compiler] '-DLWJGL_x64'
 [Compiler] '-U_FORTIFY_SOURCE'
 [Compiler] '-D_FORTIFY_SOURCE=0'
 [Compiler] '-D_GNU_SOURCE'
 [Compiler] '-D_FILE_OFFSET_BITS=64'
 [Compiler] '-I/usr/lib/jvm/java-11-openjdk-amd64/include'
 [Compiler] '-I/usr/lib/jvm/java-11-openjdk-amd64/include/linux'
 [Compiler] '-I../../../../modules/lwjgl/core/src/main/c'
 [Compiler] '-I../../../../modules/lwjgl/core/src/main/c/linux'
 [Compiler] '-I../../../../modules/lwjgl/core/src/main/c/linux/liburing'
 [Compiler] '-I../../../../modules/lwjgl/core/src/main/c/linux/liburing/include'
 [Compiler] '-DCONFIG_HAVE_MEMFD_CREATE'
 [Compiler] '/home/elect/IdeaProjects/lwjgl3/modules/lwjgl/core/src/main/c/linux/liburing/queue.c'
 [Compiler] '/home/elect/IdeaProjects/lwjgl3/modules/lwjgl/core/src/main/c/linux/liburing/register.c'
 [Compiler] '/home/elect/IdeaProjects/lwjgl3/modules/lwjgl/core/src/main/c/linux/liburing/setup.c'
 [Compiler] '/home/elect/IdeaProjects/lwjgl3/modules/lwjgl/core/src/main/c/linux/liburing/syscall.c'
d
It looks like you are trying to compile a shared library to create a JNI library, is that correct?
You can use directly the plugin
dev.nokee.jni-library
with regards to what you need to do for configuring, I would estimate the build script to be something similar to the following:
Copy code
plugins {
  id 'dev.nokee.jni-library'
  id 'dev.nokee.c-language'
  id 'java'
}

library {
  targetMachine = [machines.linux.x86_64]
  variants.configureEach {
    sharedLibrary {
      compileTasks.configureEach {
        compilerArgs.addAll(['-O3', '-flto', '-fPIC', '-pthread', '-DNDEBUG', '-DLWJGL_LINUX', '-DLWJGL_x64', '-D_FORTIFY_SOURCE', '-D_FORTIFY_SOURCE=0', '-D_GNU_SOURCE', '-D_FILE_OFFSET_BITS=64', '-DCONFIG_HAVE_MEMFD_CREATE'])
      }
    }
  }
}
For the includes and sources, I will need a bit more info as the relative path doesn’t confirm if the includes are part of the project or not. In general, the sources you declare on the
library
DSL is wired into the compile tasks automatically.
the
build
macro is defined a little earlier, at line 61
I need to run 2 compilations of
.c
files (first normal sources and then generated sources) into
.o
files and then link