This message was deleted.
# native
s
This message was deleted.
d
The most plain would be to use the
CCompile
task and one of the link task, however, it wasn’t ever intended to be used as standalone task. Hopefully we can fix that in Nokee but for now, it would be recommended to use one of the plugins. For compiling C sources, Nokee provide the
dev.nokee.c-library
and
dev.nokee.c-application
plugin which produce one of two entry point (a library, either static or shared, or application). However, in your specific case of producing a JNI library, I would recommend using the
dev.nokee.jni-library
plugin as it does a bit more such as wiring the shared library to the
Test
task, produce a JNI JAR (a JAR with the built shared library), adds the JVM includes, generate the JNI includes for
native
class, etc.
g
Could you assist/guide me?
d
Is your project in a public repo? I’m currently searching for a project that is small enough which uses LWJGL and has native component. If you have a sample, I can work with that as a guide.
g
it's actually a fork of lwjgl
let me clean it up a little and push it
d
Awww, I see. Let me have a closer look at the project.
My understanding is a generator populate the
generated
folder which seems to be Java/JNI binding for some libraries. The files are already in source control for when the source library are not present. Then all of those native files are compiled together into the JNI shared library as well as the Java sources. Then I assume a JVM JAR contains the compiled classes and several JNI JAR for each of the JNI shared library. Does that seems accurate in what is happening?
g
yes
for all the lwjgl modules
could we by any chance have a quick call? So I can give you a short overview
Spasi replied:
> > The files are already in source control for when the source library are not present.
Not sure what that means. The generated files are source controlled because it's generally useful (tracking changes, history, etc.)
> Then all of those native files are compiled together into the JNI shared library
The shared library may be produced by compiling both generated and non-generated files. It's not the same for all modules though. Some have generated sources only, others have both.
> Then I assume a JVM JAR contains the compiled classes and several JNI JAR for each of the JNI shared library
A single build produces a classes JAR and a single natives JAR per module. Some modules don't even have a natives JAR, they're Java-only. The natives JAR contains the shared library for the build's target platform. Shared libraries for other platforms are produced by LWJGL's github actions infrastructure (see the LWJGL-CI account).