Skip to content

WebIDL JNI java parser and builder for desktop, mobile and browser

License

Notifications You must be signed in to change notification settings

xpenatan/jParser

Repository files navigation

jParser

Build Build Sonatype Nexus (Snapshots) Static Badge

jParser is a small Java library that helps bind C/C++ code to desktop, mobile, and the web, allowing it to be written inline with Java source code.

It was inspired by gdx-jnigen that you add a native code into a code block. This code block will be translated to the specific code target. You can add multiple code block targets in the same java source. For each code target, it will generate a new java source code.

For the web, it needs emscripten to generate a js/wasm file and teavm. The generated classes in teavm module use JSBody to communicate with javascript.

jParser only supports JNI and TEAVM code targets.

How it works

jParser has two part.

  • Read the java source code containing the jParser solution and generate a new java source code for each target. We use base module for this. For desktop/mobile the generated JNI code will be at core module and the web code will be inside teavm module.
  • Compile C/C++ for each platform (Windows/Linux/MacOS/Android/iOS/Web).

WebIDL

To improve even more the long hours of porting each method manually, jParser also has Emscripten WebIDL support. You create a webidl file, and it will generate binding code for JNI and teaVM. It's not 100%, but it will reduce the amount of work binding big libraries. You can check the example:lib module or gdx-imgui for a complete example.

Libraries usisng jParser:

Requirements: