Skip to content

navicore/navijni.g8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Codacy Badge

a giter8 template for a jni + scala project based on sbt-jni

Generate projects that have:

  • a scala app built in the root project
  • a cpp native lib built in a sub-project dependency
  • a superjar containing the native shared libs - ready to run

USAGE

Generate Your Project

sbt new navicore/navijni.g8

Build and run the generated project

cd into the newly created project dir and:

sbt javah run

Deploy the generated project

sbt javah assembly
  • copy the superjar from target/scala-2.12/ to your installation
  • run via:
java -jar target/scala-2.12/<YOUR PROJECT NAME>.jar

FURTHER DEVELOPMENT OF YOUR PROJECT

  1. edit your generated Scala native wrapper found in src/main/scala, adding, changing, and deleting native methods
  2. rerun sbt javah
  3. edit the native module in native/src and implement the functions from the javah generated header file found in target/native/include/
  4. edit native/src/CMakeLists.txt adding external native libs that need linking, ie add the following after add_library if you are linking libwiringPi:
    find_library(wiringPi_LIB wiringPi)
    target_link_libraries(${LIB_NAME} ${wiringPi_LIB})
    
  5. sbt javah test
  6. sbt javah run
  7. sbt javah assembly to create superjar

TODO:

  • test, run, assembly should automatically javah
  • cross compiling (Raspberry PI, MacOS, Intel Linux, etc...)
  • a compilation database automatically generated (via bear / Build EAR?)
  • document publishing the lib to maven

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published