It may be not very well aligned with JME, but while I was preparing the electrostatic-api
, I got an idea to prepare a native project template with a Java binding using an interoperability between Gradle and CMake.
Features:
- Pure native core module using CMake outputing both static and dynamic libraries for the target system.
- Native Core examples module using CMake.
- Java Gradle core library module.
- Java Gradle Examples module.
- Gradle Native module with interoperability code running
CMakeLists
using shell, and linking the static native library with the target Java dynamic library. - Basic
helper-scripts
for CI/CD. - The Native build scripts are open for associating other compilers (e.g., Android or ARM LLVM) without extra code or conditional variant checks on the build side, the template illustrates an example for this by compiling for both
intel_x86
andintel_x86-64
chipsets. - Android-LLVM assocaiting script.
- Testing on other systems (Mac & Windows).
- Maven publishing scripts.
I will keep posting updates to the template here.
This might be helpful for native projects (e.g., Minie or Native Bullet physics) already existing and want to see how to migrate to use CMake alongside Gradle, or for new projects (e.g., Jme-alloc in case needed).
Note: the base file ordering and the architecture used on the C side are the prototypical ones utilized by GNU/Linux and Linux Kernel APIs.