You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the builder from the tools project in the sbt plugin
In order to ensure that the sbt plugin supports all options use the same
builder in the tools and sbt plugin projects. Separate out the options
into a new BindingOptions class to not expose unneeded methods in the
sbt plugin.
Next configure the plugin using the settings scoped to either `Compile` or `Test`:
15
-
16
-
|---------------------------|-------------------|
17
-
|`nativeBindgenHeader` | The C header file to read.
18
-
|`nativeBindgenPackage` | Package of the enclosing object. No package by default.
19
-
|`name in nativeBindgen` | Name of the enclosing object.
20
-
|`nativeBindgenLink` | Name of library to be linked.
14
+
Next configure the plugin using the `nativeBindings` setting scoped to either `Compile` or `Test`. The `NativeBinding` type to configure each binding that should be generated.
21
15
22
16
@@@ note
23
17
@@ -37,15 +31,17 @@ Example settings:
37
31
enablePlugins(ScalaNativeBindgenPlugin)
38
32
inConfig(Compile)(
39
33
Def.settings(
40
-
nativeBindgenHeader := (resourceDirectory in Compile).value /"header.h",
41
-
nativeBindgenPackage :=Some("org.example.mylib"),
42
-
nativeBindgenLink :=Some("mylib"), // Will pass `-lmylib` to the linker
43
-
nativeBindgenExclude :=Some("__"),
44
-
name in nativeBindgen :="MyLib"
34
+
nativeBindings += {
35
+
NativeBinding((resourceDirectory in Compile).value /"header.h")
36
+
.name("MyLib")
37
+
.packageName("org.example.mylib")
38
+
.link("mylib"), // Will pass `-lmylib` to the linker
39
+
.excludePrefix("__")
40
+
}
45
41
))
46
42
```
47
43
48
-
Running `nativeBindgen` will generate a file named `target/scala-2.x/src_managed/main/sbt-scala-native-bindgen//ScalaNativeBindgen.scala` containing something along the following lines:
44
+
Running `nativeBindgen` will generate a file named `target/scala-2.x/src_managed/main/sbt-scala-native-bindgen/MyLib.scala` containing something along the following lines:
0 commit comments