diff options
author | Xerxes Rånby <[email protected]> | 2020-02-17 11:26:30 +0100 |
---|---|---|
committer | Xerxes Rånby <[email protected]> | 2020-02-17 11:26:30 +0100 |
commit | c27efe67d7e0434ee7a621856615c0911ceaefa3 (patch) | |
tree | 19b0302e8ebb8776203cc278ab135350a507d702 | |
parent | 80f01e4fa99aea53d7f122cbd8876726bb3813f9 (diff) |
java: CMakeLists.txt replace depricated javah with javac -htinyb
javac -h generates jni headers by directly parsing java source files
This enable java compilation using OpenJDK 10 and later
-rw-r--r-- | java/CMakeLists.txt | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 867525b4..1f3b1771 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -10,12 +10,6 @@ else () set (JAR $ENV{JAVA_HOME_NATIVE}/bin/jar) endif () - -# Check that we can use javah -if(NOT Java_JAVAH_EXECUTABLE) - message(FATAL_ERROR "Cannot locate javah executable.") -endif(NOT Java_JAVAH_EXECUTABLE) - set(CMAKE_JNI_TARGET TRUE) file(GLOB_RECURSE JAVA_SOURCES "*.java") add_jar(tinybjar ${JAVA_SOURCES} @@ -23,41 +17,11 @@ add_jar(tinybjar ${JAVA_SOURCES} OUTPUT_NAME tinyb2 ) -set(JAVA_CLASSES org.tinyb.BluetoothAdapter - org.tinyb.BluetoothCallback - org.tinyb.BluetoothDevice - org.tinyb.BluetoothEvent - org.tinyb.BluetoothFactory - org.tinyb.BluetoothGattCharacteristic - org.tinyb.BluetoothGattService - org.tinyb.BluetoothGattDescriptor - org.tinyb.BluetoothManager - org.tinyb.BluetoothObject - org.tinyb.BluetoothType - org.tinyb.BluetoothException - org.tinyb.ObjectArgCallback - org.tinyb.ObjectArrayArgCallback - tinyb.dbus.DBusAdapter - tinyb.dbus.DBusDevice - tinyb.dbus.DBusEvent - tinyb.dbus.DBusGattCharacteristic - tinyb.dbus.DBusGattDescriptor - tinyb.dbus.DBusGattService - tinyb.dbus.DBusManager - tinyb.dbus.DBusObject - tinyb.hci.HCIAdapter - tinyb.hci.HCIDevice - tinyb.hci.HCIEvent - tinyb.hci.HCIGattCharacteristic - tinyb.hci.HCIGattDescriptor - tinyb.hci.HCIGattService - tinyb.hci.HCIManager - tinyb.hci.HCIObject) add_custom_command (TARGET tinybjar POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo "Generating JNI headers.." WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/tinybjar.dir" - COMMAND ${Java_JAVAH_EXECUTABLE} -d jni/ -jni ${JAVA_CLASSES} + COMMAND ${JAVAC} -h jni/ ${JAVA_SOURCES} ) set(JNI_HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/tinybjar.dir/jni") |