Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable JAVA SDK (with a warning) when JNI not found #2937

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 32 additions & 27 deletions analytical_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ option(LET_IT_CRASH_ON_EXCEPTION "Disable boost leaf's error handling and let it
execute_process(COMMAND uname -m OUTPUT_VARIABLE SYSTEM_PROCESSOR)
string(REGEX REPLACE "\n$" "" SYSTEM_PROCESSOR "${SYSTEM_PROCESSOR}")

# find jni ---------------------------------------------------------------------
if (ENABLE_JAVA_SDK)
find_package(JNI QUIET)
if (JNI_FOUND)
include_directories(SYSTEM ${JAVA_INCLUDE_PATH})
include_directories(SYSTEM ${JAVA_INCLUDE_PATH2})
else()
message(WARNING "Disable Java SDK because JNI libraries not found")
set(ENABLE_JAVA_SDK OFF)
endif()
endif()

if (ENABLE_JAVA_SDK)
#check whether we are using clang.
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down Expand Up @@ -229,13 +241,6 @@ if (NOT Protobuf_FOUND)
endif()
include_directories(${Protobuf_INCLUDE_DIRS})

if (ENABLE_JAVA_SDK)
# find jni---------------------------------------------------------------------
find_package(JNI REQUIRED)
include_directories(SYSTEM ${JAVA_INCLUDE_PATH})
include_directories(SYSTEM ${JAVA_INCLUDE_PATH2})
endif()

find_package(gRPC QUIET)
if(gRPC_FOUND)
set(GRPC_LIBRARIES gRPC::gpr gRPC::grpc gRPC::grpc++)
Expand Down Expand Up @@ -290,19 +295,19 @@ target_link_libraries(gs_proto PUBLIC

add_library(gs_util SHARED "core/flags.cc" "core/launcher.cc")
target_link_libraries(gs_util PRIVATE
${LIBGRAPELITE_LIBRARIES}
${GFLAGS_LIBRARIES}
${VINEYARD_LIBRARIES}
${Boost_LIBRARIES}
)
${LIBGRAPELITE_LIBRARIES}
${GFLAGS_LIBRARIES}
${VINEYARD_LIBRARIES}
${Boost_LIBRARIES}
)

if (ENABLE_JAVA_SDK)
target_sources(gs_util PRIVATE "core/java/javasdk.cc")
target_compile_definitions(gs_util PUBLIC ENABLE_JAVA_SDK)
target_link_libraries(gs_util PRIVATE
${JAVA_JVM_LIBRARY}
${JNI_LIBRARIES}
)
${JAVA_JVM_LIBRARY}
${JNI_LIBRARIES}
)
endif()

add_executable(grape_engine
Expand All @@ -313,14 +318,14 @@ add_executable(grape_engine
)
target_include_directories(grape_engine PRIVATE proto utils)
target_link_libraries(grape_engine PRIVATE
gs_proto
gs_util
${LIBGRAPELITE_LIBRARIES}
${GFLAGS_LIBRARIES}
${CMAKE_DL_LIBS}
${Boost_LIBRARIES}
${VINEYARD_LIBRARIES}
)
gs_proto
gs_util
${LIBGRAPELITE_LIBRARIES}
${GFLAGS_LIBRARIES}
${CMAKE_DL_LIBS}
${Boost_LIBRARIES}
${VINEYARD_LIBRARIES}
)

if (ENABLE_JAVA_SDK)
target_compile_definitions(grape_engine PUBLIC ENABLE_JAVA_SDK)
Expand Down Expand Up @@ -571,15 +576,15 @@ install_gsa_dependency_modules("${PROJECT_SOURCE_DIR}/cmake")

configure_file(graphscope-analytical-config.in.cmake
"${PROJECT_BINARY_DIR}/graphscope-analytical-config.cmake" @ONLY
)
)
configure_file(graphscope-analytical-config-version.in.cmake
"${PROJECT_BINARY_DIR}/graphscope-analytical-config-version.cmake" @ONLY
)
)
install(FILES "${PROJECT_BINARY_DIR}/graphscope-analytical-config.cmake"
"${PROJECT_BINARY_DIR}/graphscope-analytical-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/graphscope-analytical
)
)
install(EXPORT graphscope-analytical-targets
FILE graphscope-analytical-targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/graphscope-analytical
)
)