indoorvivants / sbt-jextract   0.1.0

GitHub
Scala versions: 2.12
sbt plugins: 1.x

sbt-jextract

sbt-jextract Scala version support

A SBT plugin that wraps jextract to generate FFM bindings from header files.

Plugin's API and behaviour is designed similarly to sn-bindgen, and the plugin can bootstrap jextract automatically.

Installation

project/plugins.sbt

addSbtPlugin("com.indoorvivants" % "sbt-jextract" % "<version>")

build.sbt

Add this to a Java/Scala project that needs some FFM bindings:

.enablePlugins(JextractPlugin)
.settings(
  jextractBindings += JextractBinding(
    (ThisBuild / baseDirectory).value / "interface.h",
    "myscalalib_bindings"
  ),
  jextractMode := JextractMode.ResourceGenerator, // default, only mentioned for documentation purposes
)

Adjust the location of the header and jextractMode value to your preference.