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.
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.