Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorTorbjörn Svensson2020-08-13 07:58:14 +0000
committerTorbjörn Svensson2020-08-13 08:13:52 +0000
commita025f75771f06c23cec07612def5c19acad9b204 (patch)
tree6d9f5855dac189ed96405bd050f4220963f43abc /native
parent7120731766a3086dc0a7258de9f7fdb3292b91a1 (diff)
downloadorg.eclipse.cdt-a025f75771f06c23cec07612def5c19acad9b204.tar.gz
org.eclipse.cdt-a025f75771f06c23cec07612def5c19acad9b204.tar.xz
org.eclipse.cdt-a025f75771f06c23cec07612def5c19acad9b204.zip
Bug 521515: Generate JNI header files as part of build
Also generate JNI header for serial component. This component does not really need it since the implementation is in one file only, but this would at least throw an error if the java part changes and the native part is not updated accordingly. Change-Id: Id598410c322580bdda37c905ed08627390c913ba Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
Diffstat (limited to 'native')
-rw-r--r--native/org.eclipse.cdt.native.serial/native_src/Makefile10
-rw-r--r--native/org.eclipse.cdt.native.serial/native_src/include/org_eclipse_cdt_serial_SerialPort.h69
-rw-r--r--native/org.eclipse.cdt.native.serial/native_src/serial.c1
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dllbin381152 -> 381152 bytes
-rw-r--r--native/org.eclipse.cdt.native.serial/pom.xml29
5 files changed, 104 insertions, 5 deletions
diff --git a/native/org.eclipse.cdt.native.serial/native_src/Makefile b/native/org.eclipse.cdt.native.serial/native_src/Makefile
index 9a70da964ca..77965b18143 100644
--- a/native/org.eclipse.cdt.native.serial/native_src/Makefile
+++ b/native/org.eclipse.cdt.native.serial/native_src/Makefile
@@ -52,20 +52,20 @@ rebuild: clean all
# most recent git commit in this directory.
$(OS_DIR)/win32/x86_64/serial.dll: serial.c
mkdir -p $(dir $@)
- SOURCE_DATE_EPOCH=$(shell git log -1 --pretty=format:%ct -- .) x86_64-w64-mingw32-gcc -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" -shared -o $@ serial.c
+ SOURCE_DATE_EPOCH=$(shell git log -1 --pretty=format:%ct -- .) x86_64-w64-mingw32-gcc -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" -shared -o $@ serial.c
$(OS_DIR)/linux/x86_64/libserial.so: serial.c
mkdir -p $(dir $@)
- gcc -m64 $(CFLAGS) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
+ gcc -m64 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
$(OS_DIR)/linux/aarch64/libserial.so: serial.c
mkdir -p $(dir $@)
- aarch64-linux-gnu-gcc $(CFLAGS) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
+ aarch64-linux-gnu-gcc $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
$(OS_DIR)/linux/ppc64le/libserial.so: serial.c
mkdir -p $(dir $@)
- gcc -m64 -mcpu=power8 $(CFLAGS) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
+ gcc -m64 -mcpu=power8 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
$(OS_DIR)/macosx/x86_64/libserial.jnilib: serial.c
mkdir -p $(dir $@)
- x86_64-apple-darwin17-clang $(CFLAGS) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(LDFLAGS) -dynamiclib -o $@ serial.c
+ x86_64-apple-darwin17-clang $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(LDFLAGS) -dynamiclib -o $@ serial.c
diff --git a/native/org.eclipse.cdt.native.serial/native_src/include/org_eclipse_cdt_serial_SerialPort.h b/native/org.eclipse.cdt.native.serial/native_src/include/org_eclipse_cdt_serial_SerialPort.h
new file mode 100644
index 00000000000..2ada4771739
--- /dev/null
+++ b/native/org.eclipse.cdt.native.serial/native_src/include/org_eclipse_cdt_serial_SerialPort.h
@@ -0,0 +1,69 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_eclipse_cdt_serial_SerialPort */
+
+#ifndef _Included_org_eclipse_cdt_serial_SerialPort
+#define _Included_org_eclipse_cdt_serial_SerialPort
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_eclipse_cdt_serial_SerialPort
+ * Method: open0
+ * Signature: (Ljava/lang/String;IIII)J
+ */
+JNIEXPORT jlong JNICALL Java_org_eclipse_cdt_serial_SerialPort_open0
+ (JNIEnv *, jobject, jstring, jint, jint, jint, jint);
+
+/*
+ * Class: org_eclipse_cdt_serial_SerialPort
+ * Method: close0
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_close0
+ (JNIEnv *, jobject, jlong);
+
+/*
+ * Class: org_eclipse_cdt_serial_SerialPort
+ * Method: read1
+ * Signature: (J[BII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_serial_SerialPort_read1
+ (JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
+
+/*
+ * Class: org_eclipse_cdt_serial_SerialPort
+ * Method: available0
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_serial_SerialPort_available0
+ (JNIEnv *, jobject, jlong);
+
+/*
+ * Class: org_eclipse_cdt_serial_SerialPort
+ * Method: write0
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_write0
+ (JNIEnv *, jobject, jlong, jint);
+
+/*
+ * Class: org_eclipse_cdt_serial_SerialPort
+ * Method: write1
+ * Signature: (J[BII)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_cdt_serial_SerialPort_write1
+ (JNIEnv *, jobject, jlong, jbyteArray, jint, jint);
+
+/*
+ * Class: org_eclipse_cdt_serial_SerialPort
+ * Method: getPortName
+ * Signature: (I)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_serial_SerialPort_getPortName
+ (JNIEnv *, jclass, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/native/org.eclipse.cdt.native.serial/native_src/serial.c b/native/org.eclipse.cdt.native.serial/native_src/serial.c
index bd77e74bffc..37a2fbc1e04 100644
--- a/native/org.eclipse.cdt.native.serial/native_src/serial.c
+++ b/native/org.eclipse.cdt.native.serial/native_src/serial.c
@@ -36,6 +36,7 @@
#include <windows.h>
#endif
#include <jni.h>
+#include <org_eclipse_cdt_serial_SerialPort.h>
#define FUNC(x) Java_org_eclipse_cdt_serial_SerialPort_ ## x
diff --git a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
index abdce78fcc3..8e377a4dbcf 100755
--- a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
+++ b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
Binary files differ
diff --git a/native/org.eclipse.cdt.native.serial/pom.xml b/native/org.eclipse.cdt.native.serial/pom.xml
index 783bad37431..2fa96300bfa 100644
--- a/native/org.eclipse.cdt.native.serial/pom.xml
+++ b/native/org.eclipse.cdt.native.serial/pom.xml
@@ -198,5 +198,34 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>jniheaders</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <executions>
+ <execution>
+ <id>headers</id>
+ <phase>process-resources</phase>
+ <configuration>
+ <compilerArgs>
+ <arg>-h</arg>
+ <arg>${project.basedir}/native_src/include</arg>
+ </compilerArgs>
+ <source>11</source>
+ <target>11</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>

Back to the top