Added JNI detection to CMakeLists
This commit is contained in:
@@ -35,7 +35,6 @@ set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
|
||||
# ---include dirs ---
|
||||
|
||||
# lwip
|
||||
@@ -63,13 +62,18 @@ set(LIBZT_SRC_DIR ${PROJ_DIR}/src)
|
||||
include_directories("${LIBZT_SRC_DIR}")
|
||||
include_directories("${PROJ_DIR}/include")
|
||||
file(GLOB libzt_src_glob ${LIBZT_SRC_DIR}/*.cpp)
|
||||
add_library(zt ${libzt_src_glob})
|
||||
add_library(zt STATIC ${libzt_src_glob})
|
||||
target_compile_options(zt PRIVATE -std=c++11 -DZT_SDK=1 -DLIBZT_TRACE=1)
|
||||
target_link_libraries(zt zto)
|
||||
target_link_libraries(zt lwip)
|
||||
set_target_properties(zt PROPERTIES OUTPUT_NAME zt)
|
||||
|
||||
# libzt shared
|
||||
#add_library(zt ${libzt_src_glob})
|
||||
add_library(ztshared SHARED ${libzt_src_glob})
|
||||
target_compile_options(ztshared PRIVATE -std=c++11 -DZT_SDK=1 -DLIBZT_TRACE=1)
|
||||
target_link_libraries(ztshared zto)
|
||||
target_link_libraries(ztshared lwip)
|
||||
set_target_properties(ztshared PROPERTIES OUTPUT_NAME zt)
|
||||
|
||||
|
||||
# --- executables ---
|
||||
@@ -80,7 +84,19 @@ target_link_libraries(ipv4simple lwip zto zt pthread)
|
||||
target_compile_options(ipv4simple PRIVATE -std=c++11 -DLIBZT_TRACE=1)
|
||||
|
||||
if (JNI EQUAL 1)
|
||||
MESSAGE(STATUS "WITH_FEATURE_C")
|
||||
MESSAGE(STATUS "Looking for JNI headers")
|
||||
# --- Locate JNI headers
|
||||
find_package(JNI)
|
||||
if (JNI_FOUND)
|
||||
message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
|
||||
message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
|
||||
list(GET JNI_INCLUDE_DIRS 0 JNI_INCLUDE_DIR)
|
||||
message (STATUS "chosen=${JNI_INCLUDE_DIR}")
|
||||
include_directories("${JNI_INCLUDE_DIR}")
|
||||
else()
|
||||
message (STATUS "JNI not found")
|
||||
endif()
|
||||
target_compile_options(ztshared PRIVATE -std=c++11 -DZT_SDK=1 -DLIBZT_TRACE=1 -DSDK_JNI=1)
|
||||
# JNI
|
||||
option (USE_JNI
|
||||
"Use Java JNI for shared/dynamic libraries" ON)
|
||||
|
||||
Reference in New Issue
Block a user