Building library with driver from maven

This commit is contained in:
Julien Lengrand-Lambert
2019-12-13 14:35:07 +01:00
parent 4fdff231e5
commit 1cd447ab54
6 changed files with 62 additions and 10 deletions

4
.gitignore vendored
View File

@@ -55,4 +55,6 @@ libraries/tools/kotlin-test-js-runner/lib/
libraries/tools/kotlin-source-map-loader/lib/
local.properties
*.o
*.o
/cellar-app/target/
/cellar-driver/target/

3
.idea/deployment.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" autoUpload="Always" serverName="raspberrypi.local" autoUploadExternalChanges="true">
<component name="PublishConfigData" serverName="raspberrypi.local" autoUploadExternalChanges="true">
<serverData>
<paths name="raspberrypi.local">
<serverdata>
@@ -11,6 +11,5 @@
</serverdata>
</paths>
</serverData>
<option name="myAutoUpload" value="ALWAYS" />
</component>
</project>

View File

@@ -11,5 +11,58 @@
<artifactId>cellar-driver</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<compilerArgs>
<arg>-h</arg>
<arg>target/headers</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${project.basedir}/src/main/c</workingDirectory>
<executable>make</executable>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>TestLib</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,6 +1,6 @@
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf
INCLUDES = -I. -I../java -Iadafruit/Raspberry_Pi_2 -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
HEADERS = ../java/Dht11Driver.h adafruit/common_dht_read.h adafruit/Raspberry_Pi_2/pi_2_mmio.h adafruit/Raspberry_Pi_2/pi_2_dht_read.h
HEADERS = ../../target/headers/Dht11Driver.h adafruit/common_dht_read.h adafruit/Raspberry_Pi_2/pi_2_mmio.h adafruit/Raspberry_Pi_2/pi_2_dht_read.h
FILES = adafruit/common_dht_read.c adafruit/Raspberry_Pi_2/pi_2_mmio.c adafruit/Raspberry_Pi_2/pi_2_dht_read.c Dht11Driver.c
OUT = libdht11
@@ -13,10 +13,8 @@ library:
gcc -shared -fPIC -o $(OUT).so $(INCLUDES) $(FILES)
move:
-cp $(OUT).so
-cp $(OUT).so ../resources/libs/raspberry/
clean:
-rm -f $(OUT).so
-rm -f $(OUT)
# We have to run that at some point javac -h . Dht11Driver.java
-rm -f $(OUT)

View File

@@ -10,8 +10,8 @@
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<modules>