Skip to content

Commit

Permalink
Add --library arguments for jextract (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dluga93 authored Jun 1, 2024
1 parent c878569 commit d28e443
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ This is a Maven wrapper for the [`jextract`](https://github.com/openjdk/jextract
</goals>
<configuration>
<headerFile>point.h</headerFile>
<libraries>
<library>/path/to/shared/library.so</library>
</libraries>
<targetPackage>com.example.mypackage</targetPackage>
<headerClassName>Point2d</headerClassName>
<includeStructs>
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/io/github/coffeelibs/maven/jextract/SourcesMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ public class SourcesMojo extends AbstractMojo {
@Parameter(property = "jextract.includeVars", required = false)
private String[] includeVars;

/**
* <dl>
* <dt>--library</dt>
* <dd>path to shared libraries to load</dd>
* </dl>
*/
@Parameter(property = "jextract.libraries", required = false)
private String[] libraries;

/**
* <dl>
* <dt>--output</dt>
Expand Down Expand Up @@ -161,6 +170,10 @@ public void execute() throws MojoFailureException {
args.add(outputDirectory.getAbsolutePath());
args.add("--target-package");
args.add(targetPackage);
Arrays.stream(libraries).forEach(str -> {
args.add("--library");
args.add(str);
});
Arrays.stream(headerSearchPaths).forEach(str -> {
args.add("-I");
args.add(str);
Expand Down

0 comments on commit d28e443

Please sign in to comment.