Skip to content

Commit

Permalink
Create utility dir arrow/jniutil (apache#27)
Browse files Browse the repository at this point in the history
* Create utility dir arrow/jniutil

* fix
  • Loading branch information
zhztheplayer committed Feb 8, 2022
1 parent d7c47ee commit 2a8a28c
Show file tree
Hide file tree
Showing 15 changed files with 840 additions and 503 deletions.
2 changes: 2 additions & 0 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")

define_option(ARROW_JNI "Build the Arrow JNI lib" OFF)

define_option(ARROW_JNIUTIL "Build Arrow JNI utilities" ON)

define_option(ARROW_JSON "Build Arrow with JSON support (requires RapidJSON)" OFF)

define_option(ARROW_MIMALLOC "Build the Arrow mimalloc-based allocator" OFF)
Expand Down
16 changes: 15 additions & 1 deletion cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,14 @@ if(ARROW_FILESYSTEM)
list(APPEND ARROW_TESTING_SRCS filesystem/test_util.cc)
endif()

if(ARROW_JNIUTIL)
find_package(JNI REQUIRED)
list(APPEND ARROW_SRCS
jniutil/jni_util.cc)

set(ARROW_PRIVATE_INCLUDES ${ARROW_PRIVATE_INCLUDES} ${JNI_INCLUDE_DIRS})
endif()

if(ARROW_IPC)
list(APPEND
ARROW_SRCS
Expand Down Expand Up @@ -572,7 +580,9 @@ add_arrow_lib(arrow
SHARED_INSTALL_INTERFACE_LIBS
${ARROW_SHARED_INSTALL_INTERFACE_LIBS}
STATIC_INSTALL_INTERFACE_LIBS
${ARROW_STATIC_INSTALL_INTERFACE_LIBS})
${ARROW_STATIC_INSTALL_INTERFACE_LIBS}
PRIVATE_INCLUDES
${JNI_INCLUDE_DIRS})

add_dependencies(arrow ${ARROW_LIBRARIES})

Expand Down Expand Up @@ -765,6 +775,10 @@ if(ARROW_IPC)
add_subdirectory(ipc)
endif()

if(ARROW_JNIUTIL)
add_subdirectory(jniutil)
endif()

if(ARROW_JSON)
add_subdirectory(json)
endif()
Expand Down
31 changes: 31 additions & 0 deletions cpp/src/arrow/jniutil/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitationsn
# under the License.

#
# arrow_dataset_jni
#

arrow_install_all_headers("arrow/jniutil")

find_package(JNI REQUIRED)

add_arrow_test(arrow_jniutil_test
SOURCES
jni_util_test.cc
jni_util.cc
EXTRA_INCLUDES
${JNI_INCLUDE_DIRS})
Loading

0 comments on commit 2a8a28c

Please sign in to comment.