Merge pull request #246 from zerotier/brenton/jni-work
Fix fatal error: jni_md.h: No such file or directory
This commit is contained in:
@@ -82,8 +82,6 @@ endif()
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# | INCLUDE DIRECTORIES |
|
# | INCLUDE DIRECTORIES |
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Temporary measure to test GitHub workflow on Ubuntu
|
|
||||||
include_directories(/usr/lib/jvm/java-11-openjdk-amd64/include/linux/)
|
|
||||||
# ZeroTier
|
# ZeroTier
|
||||||
include_directories(${ZTO_SRC_DIR})
|
include_directories(${ZTO_SRC_DIR})
|
||||||
include_directories(${ZTO_SRC_DIR}/include)
|
include_directories(${ZTO_SRC_DIR}/include)
|
||||||
@@ -471,37 +469,40 @@ endif()
|
|||||||
|
|
||||||
if(ZTS_ENABLE_JAVA OR (BUILD_ANDROID AND NOT ZTS_NDK_ONLY))
|
if(ZTS_ENABLE_JAVA OR (BUILD_ANDROID AND NOT ZTS_NDK_ONLY))
|
||||||
message(STATUS "Looking for JNI")
|
message(STATUS "Looking for JNI")
|
||||||
|
message(STATUS "Ignore seeing \"Found JNI: NotNeeded\" below; check that JNI_INCLUDE_DIRS is valid")
|
||||||
|
|
||||||
if(BUILD_WIN)
|
#
|
||||||
# We are only interested in finding jni.h: we do not care about extended JVM
|
# "trick" CMake into thinking that we have already found these
|
||||||
# functionality or the AWT library. set(JAVA_AWT_LIBRARY NotNeeded)
|
# https://stackoverflow.com/a/51764145
|
||||||
# set(JAVA_JVM_LIBRARY NotNeeded) set(JAVA_INCLUDE_PATH2 NotNeeded)
|
#
|
||||||
# set(JAVA_AWT_INCLUDE_PATH NotNeeded)
|
# These may be missing, but we do not need them
|
||||||
set(JAVA_INCLUDE_PATH "C:\\Program Files\\Java\\jdk-10.0.2\\include")
|
#
|
||||||
endif()
|
# There is no official way of telling CMake: "skip looking for AWT, etc."
|
||||||
|
#
|
||||||
set(JAVA_AWT_LIBRARY NotNeeded)
|
set(JAVA_AWT_LIBRARY NotNeeded)
|
||||||
set(JAVA_JVM_LIBRARY NotNeeded)
|
set(JAVA_JVM_LIBRARY NotNeeded)
|
||||||
set(JAVA_INCLUDE_PATH2 NotNeeded)
|
|
||||||
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
|
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
|
||||||
find_package(JNI REQUIRED)
|
|
||||||
|
|
||||||
if(JNI_FOUND)
|
#
|
||||||
message(STATUS "JNI_INCLUDE_DIR=${JNI_INCLUDE_DIRS}")
|
# Do NOT make REQUIRED
|
||||||
message(STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
|
# Until there is an official way of telling CMake to skip AWT, etc.,
|
||||||
list(GET JNI_INCLUDE_DIRS 0 JNI_INCLUDE_DIR)
|
# then JNI will be considered as "not found"
|
||||||
message(STATUS "jni path=${JNI_INCLUDE_DIR}")
|
#
|
||||||
include_directories("${JNI_INCLUDE_DIR}")
|
find_package(JNI)
|
||||||
# include_directories ("${JNI_INCLUDE_DIRS}")
|
|
||||||
if(BUILD_WIN)
|
list(FILTER JNI_INCLUDE_DIRS EXCLUDE REGEX NotNeeded)
|
||||||
include_directories("${JNI_INCLUDE_DIR}\\win32")
|
list(FILTER JNI_LIBRARIES EXCLUDE REGEX NotNeeded)
|
||||||
endif()
|
|
||||||
if(BUILD_MACOS)
|
#
|
||||||
include_directories("${JNI_INCLUDE_DIR}/darwin")
|
# Do NOT check JNI_FOUND here, check JNI_INCLUDE_DIRS instead
|
||||||
endif()
|
# because of setting the above variables to NotNeeded,
|
||||||
if(BUILD_LINUX)
|
# the variable JNI_FOUND is now set to NotNeeded, which is annoying
|
||||||
include_directories("${JNI_INCLUDE_DIR}/linux")
|
#
|
||||||
endif()
|
# We only care about JNI_INCLUDE_DIRS
|
||||||
|
#
|
||||||
|
if(JNI_INCLUDE_DIRS)
|
||||||
|
message(STATUS "JNI_INCLUDE_DIRS: ${JNI_INCLUDE_DIRS}")
|
||||||
|
include_directories("${JNI_INCLUDE_DIRS}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "JNI not found")
|
message(STATUS "JNI not found")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user