Git Product home page Git Product logo

simple-stream-oak-java's Introduction

JNI Project With Gradle

A sample project setup/workflow for building JNI libraries (C++) with Gradle for references.

Features

Tested on

  • Mac OS X
  • Ubuntu (focal)

Prerequisite

  • OpenJDK 11+
  • CMake 3.13+

Building

Clone the repo

$ git clone https://github.com/stwind/gradle-jni.git
$ cd gradle-jni
$ ./gradlew run

The output should be something like

Downloading https://services.gradle.org/distributions/gradle-6.4-bin.zip
.........10%..........20%..........30%..........40%.........50%..........60%..........70%..........80%.........90%..........100%

Welcome to Gradle 6.4!

Here are the highlights of this release:
 - Support for building, testing and running Java Modules
 - Precompiled script plugins for Groovy DSL
 - Single dependency lock file per project

For more details see https://docs.gradle.org/6.4/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

> Task :jni-lib:compileJNI
-- The CXX compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Java: /usr/lib/jvm/java-13-openjdk-amd64/bin/java (found version "13.0.3")
-- Found JNI: NotNeeded
-- Configuring done
-- Generating done
-- Build files have been written to: /root/gradle-jni/jni-lib/build/natives
Scanning dependencies of target tools
[ 50%] Building CXX object src/main/cpp/CMakeFiles/tools.dir/tools.cpp.o
[100%] Linking CXX shared library ../../../lib/libtools.so
[100%] Built target tools

> Task :jni-runner:run
foobar

BUILD SUCCESSFUL in 26s
6 actionable tasks: 6 executed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.