All Projects → libgdx → gdx-jnigen

libgdx / gdx-jnigen

Licence: Apache-2.0 license
jnigen is a small library that can be used with or without libGDX which allows C/C++ code to be written inline with Java source code.

Programming Languages

java
68154 projects - #9 most used programming language
c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
objective c
16641 projects - #2 most used programming language

Labels

Projects that are alternatives of or similar to gdx-jnigen

Xcrash
🔥 xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.
Stars: ✭ 2,689 (+8303.13%)
Mutual labels:  jni
Jxnet
Jxnet is a Java library for capturing and sending custom network packet buffers with no copies. Jxnet wraps a native packet capture library (libpcap/winpcap/npcap) via JNI (Java Native Interface).
Stars: ✭ 26 (-18.75%)
Mutual labels:  jni
java-cpp-example
Example of using C++ classes from Java. Showcases SWIG, JNA and JNI
Stars: ✭ 135 (+321.88%)
Mutual labels:  jni
Adi
ADI(Android Debug Intensive) 是通过 JVMTI 实现的 Android 应用开发调试的增强工具集,目前主要提供性能相关的监控能力。
Stars: ✭ 194 (+506.25%)
Mutual labels:  jni
Easyincrementalupdate
Android差分补丁库,通过native层合并APK,实现增量更新升级,让你更新的APK更小。
Stars: ✭ 233 (+628.13%)
Mutual labels:  jni
clojure-rust-graalvm
An example of Clojure program calling a Rust library, all combined into one executable using GraalVM.
Stars: ✭ 113 (+253.13%)
Mutual labels:  jni
Scapix
Scapix Language Bridge
Stars: ✭ 171 (+434.38%)
Mutual labels:  jni
Libbulletjme
A JNI interface to Bullet Physics and V-HACD
Stars: ✭ 55 (+71.88%)
Mutual labels:  jni
Android Disassembler
Disassemble ANY files including .so (NDK, JNI), Windows PE(EXE, DLL, SYS, etc), linux binaries, libraries, and any other files such as pictures, audios, etc(for fun)files on Android. Capstone-based disassembler application on android. 안드로이드 NDK 공유 라이브러리, Windows 바이너리, etc,... 리버싱 앱
Stars: ✭ 250 (+681.25%)
Mutual labels:  jni
monero-java
A Java library for using Monero
Stars: ✭ 76 (+137.5%)
Mutual labels:  jni
Inline Java
Haskell/Java interop via inline Java code in Haskell modules.
Stars: ✭ 197 (+515.63%)
Mutual labels:  jni
Relinker
A robust native library loader for Android.
Stars: ✭ 2,612 (+8062.5%)
Mutual labels:  jni
Android
Swift library for Android
Stars: ✭ 48 (+50%)
Mutual labels:  jni
Jfasttext
Java interface for fastText
Stars: ✭ 193 (+503.13%)
Mutual labels:  jni
ffmpeg4java
FFmpeg4Java provides a JNI wrapper of FFmpeg library
Stars: ✭ 21 (-34.37%)
Mutual labels:  jni
Sand
Using JNI to achieve Sobel operator image edge detection使用JNI实现Sobel算子图像边缘检测,支持kotlin https://github.com/Jomes/sand
Stars: ✭ 186 (+481.25%)
Mutual labels:  jni
JNI RSA Sign
通过JNI实现验证App签名获取公钥
Stars: ✭ 86 (+168.75%)
Mutual labels:  jni
terra-java
Lua/Terra + Java Native Interface
Stars: ✭ 20 (-37.5%)
Mutual labels:  jni
sentencepiece-jni
Java JNI wrapper for SentencePiece: unsupervised text tokenizer for Neural Network-based text generation.
Stars: ✭ 26 (-18.75%)
Mutual labels:  jni
wgpu-mc
Rust-based replacement for the default Minecraft renderer
Stars: ✭ 254 (+693.75%)
Mutual labels:  jni

gdx-jnigen

Build Status

The gdx-jnigen tool can be used with or without libGDX to allow C/C++ code to be written inline with Java source code.

This increases the locality of code that conceptually belongs together (the Java native class methods and the actual implementation) and makes refactoring a lot easier compared to the usual JNI workflow. Arrays and direct buffers are converted for you, further reducing boilerplate. Building the natives for Windows, Linux, macOS, and Android and iOS is handled for you. jnigen also provides a mechanism for loading native libraries from a JAR at runtime, which avoids "java.library.path" troubles.

See the libGDX Wiki for usage: https://libgdx.com/wiki/utils/jnigen

gdx-jnigen-gradle quickstart

We recommend you look at some existing projects for examples:

// Add buildscript dependency
buildscript {
    dependencies {
        classpath "com.badlogicgames.gdx:gdx-jnigen-gradle:2.X.X"
    }
}

// Apply jnigen plugin
apply plugin: "com.badlogicgames.gdx.gdx-jnigen"

...

// Define jnigen extension
jnigen {
    // Your shared library name
    sharedLibName = "example"
    //temporaryDir = "target"
    //libsDir = "libs"
    //jniDir = "jni"

    // Shared configuration for all BuildTargets. Executed first
    // See all BuildTarget options here: https://github.com/libgdx/gdx-jnigen/blob/master/gdx-jnigen/src/main/java/com/badlogic/gdx/jnigen/BuildTarget.java
    // Most paths are relative to the $jniDir directory
    // String options can be replaced by using `x = "value"` or appended to with `x += "extravalue"`
    // String[] options can be replaced by using `x = ["value"]` or appended to with `x += "extravalue"` or `x += ["extravalue", "extravalue2"]`
    all {
        // Add extra flags passed to the C compiler
        cFlags += " -fvisibility=hidden "
        // Add extra flags passed to the C++ compiler
        cppFlags += " -std=c++11 -fvisibility=hidden "
        // Add extra flags passed to the linker
        linkerFlags += " -fvisibility=hidden "
    }

    // Configure robovm.xml for IOS builds, most simple libraries will not need to do this
    robovm {
        // Use preexisting robovm.xml, cannot be combined with other options.
        //manualFile file("robovm.xml")
        
        // Add extra patterns to forceLinkClasses
        //forceLinkClasses "test", "test2"
        //forceLinkClasses "pattern3"
        // Add extra library "test.a" with variant "device"
        //extraLib "test.a", "device"
    }

    // Add BuildTargets
    // All BuildTarget options can be further customized in an OS+Arch specific manner within a {} block

    // Add windows 32-bit BuildTarget and customize it
    add(Windows, x32) {
        //cFlags += " -fextraflag=fake "
        //compilerPrefix = "someprefix-";
        //cIncludes += "windowsspecificdir/*.c"
    }
    add(Windows, x64)
    add(Linux, x32)
    add(Linux, x64)
    add(Linux, x32, ARM)
    add(Linux, x64, ARM)
    add(MacOsX, x64)
    add(MacOsX, x64, ARM)
    add(Android) {
        // Add extra content to the generated Application.mk file
        //androidApplicationMk += "APP_STL := c++_static"
        // Specify which ABIs to build
        //androidABIs = ["armeabi", "armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
    }
    add(IOS)

    // Customize each BuildTarget that matches the condition
    each({ it.os != Android && !it.isARM }) {
        //cppFlags += " -march=nocona "
    }
    // Customize everything again, can be used for conditional changes
    each({ true }) {
        //if(!it.cppCompiler.contains("clang")) {
        //    it.cFlags += " -flto "
        //    it.cppFlags += " -flto "
        //    it.linkerFlags += " -flto "
        //}

        //if(it.cppCompiler.contains("clang"))
        //    it.linkerFlags += " -Wl,-dead_strip -Wl,-s "
        //else
        //    it.linkerFlags += " -Wl,--gc-sections "
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].