Skip to content

Commit

Permalink
Modify the CMakeLists.txt of building jni (#2324)
Browse files Browse the repository at this point in the history
  • Loading branch information
laura-ding authored Sep 1, 2020
1 parent 87208af commit b548c74
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
17 changes: 11 additions & 6 deletions src/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
# CMAKE_C_COMPILER -- Specify the compiler for C language
# CMAKE_CXX_COMPILER -- Specify the compiler for C++ language
#
# NEBULA_HOME -- Specify the root directory for nebula project
# NEBULA_THIRDPARTY_ROOT -- Specify the third-party root dir.
# ENABLE_TESTING -- Build unit test
#
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.0.0)

project("Nebula Graph codec" C CXX)

Expand All @@ -24,15 +23,14 @@ option(ENABLE_TESTING "Whether to compile unit test ON or OFF" OFF)

message(STATUS "CMAKE_CURRENT_BINARY_DIR:" ${CMAKE_CURRENT_BINARY_DIR})
message(STATUS "CMAKE_CURRENT_SOURCE_DIR:" ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "NEBULA_HOME:" ${NEBULA_HOME})
message(STATUS "NEBULA_THIRDPARTY_ROOT:" ${NEBULA_THIRDPARTY_ROOT})

# locate jni header
include_directories($ENV{JAVA_HOME}/include
$ENV{JAVA_HOME}/include/linux)
include_directories(AFTER ${NEBULA_HOME}/src)
include_directories(AFTER ${NEBULA_HOME}/src/common)
include_directories(AFTER ${NEBULA_HOME}/src/jni/src)
include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/../)
include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/../common)
include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/src)

include_directories(SYSTEM ${NEBULA_THIRDPARTY_ROOT}/include)
link_directories(
Expand All @@ -56,3 +54,10 @@ add_compile_options(-Wunused-parameter)

add_subdirectory(src)

add_custom_target(
java_lib
COMMAND mvn clean package
COMMAND mv target ${CMAKE_CURRENT_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/java
DEPENDS nebula_codec
)
7 changes: 3 additions & 4 deletions src/jni/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ To build this project, you must have:

## Steps
* mkdir build && cd build
* cmake .. -DNEBULA_HOME=${nebula project root dir} -DNEBULA_THIRDPARTY_ROOT=${dependencies root dir}
* make
* cd ../java && mvn clean package
* cmake ..
* make java_lib

You could find the jni java package nebula-utils-1.0.0-beta.jar under java/target dir
You could find the jni java package nebula-utils-1.0.0-beta.jar under build/target dir
2 changes: 1 addition & 1 deletion src/jni/src/datamanlite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

add_library(nebula_codec_obj
OBJECT
${NEBULA_HOME}/src/common/base/Cord.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../common/base/Cord.cpp
Slice.cpp
DataCommon.cpp
SchemaProviderIf.cpp
Expand Down

0 comments on commit b548c74

Please sign in to comment.