Skip to content

Commit

Permalink
adds client-maven-plugin configuration to compile with graal
Browse files Browse the repository at this point in the history
  • Loading branch information
rladstaetter committed Oct 17, 2020
1 parent 2ac0297 commit 8b3662a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ If you peek into the ``javacv-webcam`` directory.

Attention: If you are using Windows or Linux you'll have to adapt module-info.java to include native libraries of suitable for those platforms. On MacOsX, you may have problems with permissions to access your webcam from a java application, make sure to allow access in your system preferences.

## Compile and run with client-maven-plugin

This project contains also a configuration for compiling it to a native image using [GraalVM](https://www.graalvm.org/). You have
to download and install GraalVM in a recent version (I tested it with 20.2.0) and then compile and run it with following command:

mvn clean client:build client:run -Djavacpp.platform.custom -Djavacpp.platform.host -Dgraalvm.home=/path/to/your/graalvm/distribution

After downloading necessary toolings, dependencies and compiling and linking (takes some time) a JavaFX application which uses
your webcam will start.

## Links

- Have a look at [https://openjfx.io](https://openjfx.io) where you can find more information and introductory examples for developing JavaFX applications.
Expand Down
20 changes: 12 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.ladstatt.javacv</groupId>
<artifactId>javacv-webcam</artifactId>
<version>2020.3.0-SNAPSHOT</version>
<version>2020.3.1-SNAPSHOT</version>

<name>net.ladstatt.javacv.javacv-webcam</name>

Expand All @@ -15,11 +15,9 @@
<javacv.version>1.5.4</javacv.version>
<main.class>net.ladstatt.javacv.fx.WebcamFXApp</main.class>
<!-- for native compilation with graalvm -->
<!--
<client.plugin.version>0.1.31</client.plugin.version>
--><!-- other values can be ios,android -->
<!--
<client.plugin.version>0.1.33</client.plugin.version>
<client.target>host</client.target>
<!-- uncomment and provide your path
<graalvm.home>/Users/lad/.sdkman/candidates/java/20.2.0.r11-grl</graalvm.home>
-->
</properties>
Expand All @@ -39,6 +37,14 @@
<groupId>org.bytedeco</groupId>
<artifactId>javacv-platform</artifactId>
<version>${javacv.version}</version>
<exclusions>
<!-- if not excluded linking fails withc client-maven-plugin (???) -->
<exclusion>
<groupId>org.bytedeco</groupId>
<artifactId>leptonica-platform</artifactId>
</exclusion>
</exclusions>

</dependency>
</dependencies>
<build>
Expand Down Expand Up @@ -76,7 +82,6 @@
</execution>
</executions>
</plugin>
<!--
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
Expand All @@ -100,11 +105,10 @@
<resourcesList>
<list>.*.dylib$</list>
</resourcesList>
<nativeImageArgs>- -allow-incomplete-classpath</nativeImageArgs>
<nativeImageArgs>--allow-incomplete-classpath</nativeImageArgs>
<graalvmHome>${graalvm.home}</graalvmHome>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
Expand Down

0 comments on commit 8b3662a

Please sign in to comment.