Skip to content

Commit

Permalink
ARROW-17560: [Java][Gandiva] Move JNI build configuration from cpp/ t…
Browse files Browse the repository at this point in the history
…o java/ (#14159)

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
kou committed Sep 18, 2022
1 parent 80676df commit 9917960
Show file tree
Hide file tree
Showing 30 changed files with 160 additions and 317 deletions.
1 change: 0 additions & 1 deletion ci/docker/fedora-35-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ ENV absl_SOURCE=BUNDLED \
ARROW_DEPENDENCY_SOURCE=SYSTEM \
ARROW_DATASET=ON \
ARROW_FLIGHT=ON \
ARROW_GANDIVA_JAVA=ON \
ARROW_GANDIVA=ON \
ARROW_GCS=ON \
ARROW_HOME=/usr/local \
Expand Down
3 changes: 1 addition & 2 deletions ci/docker/java-jni-manylinux-201x.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ RUN yum install -y java-$java-openjdk-devel rh-maven35 && yum clean all
ENV JAVA_HOME=/usr/lib/jvm/java-$java-openjdk/

# For ci/scripts/{cpp,java}_*.sh
ENV ARROW_GANDIVA_JAVA=ON \
ARROW_HOME=/tmp/local \
ENV ARROW_HOME=/tmp/local \
ARROW_JAVA_CDATA=ON \
ARROW_JNI=ON \
ARROW_PLASMA=ON \
Expand Down
1 change: 0 additions & 1 deletion ci/docker/linux-apt-jni.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ ENV PATH=/opt/cmake-${cmake}-Linux-x86_64/bin:$PATH
ENV ARROW_BUILD_TESTS=ON \
ARROW_DATASET=ON \
ARROW_FLIGHT=OFF \
ARROW_GANDIVA_JAVA=ON \
ARROW_GANDIVA=ON \
ARROW_HOME=/usr/local \
ARROW_JAVA_CDATA=ON \
Expand Down
1 change: 0 additions & 1 deletion ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ cmake \
-DARROW_FLIGHT=${ARROW_FLIGHT:-OFF} \
-DARROW_FLIGHT_SQL=${ARROW_FLIGHT_SQL:-OFF} \
-DARROW_FUZZING=${ARROW_FUZZING:-OFF} \
-DARROW_GANDIVA_JAVA=${ARROW_GANDIVA_JAVA:-OFF} \
-DARROW_GANDIVA_PC_CXX_FLAGS=${ARROW_GANDIVA_PC_CXX_FLAGS:-} \
-DARROW_GANDIVA=${ARROW_GANDIVA:-OFF} \
-DARROW_GCS=${ARROW_GCS:-OFF} \
Expand Down
2 changes: 1 addition & 1 deletion ci/scripts/java_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if [ "${ARROW_JAVA_CDATA}" = "ON" ]; then
${mvn} -Darrow.c.jni.dist.dir=${java_jni_dist_dir} -Parrow-c-data install
fi

if [ "${ARROW_GANDIVA_JAVA}" = "ON" ]; then
if [ "${ARROW_JNI}" = "ON" ]; then
${mvn} -Darrow.cpp.build.dir=${java_jni_dist_dir} -Parrow-jni install
fi

Expand Down
1 change: 1 addition & 0 deletions ci/scripts/java_jni_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ esac
: ${CMAKE_BUILD_TYPE:=release}
cmake \
-DARROW_JAVA_JNI_ENABLE_DATASET=${ARROW_DATASET:-ON} \
-DARROW_JAVA_JNI_ENABLE_GANDIVA=${ARROW_GANDIVA:-ON} \
-DBUILD_TESTING=${ARROW_JAVA_BUILD_TESTS} \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DCMAKE_PREFIX_PATH=${arrow_install_dir} \
Expand Down
3 changes: 0 additions & 3 deletions ci/scripts/java_jni_macos_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ install_dir=${build_dir}/cpp-install
: ${ARROW_BUILD_TESTS:=ON}
: ${ARROW_DATASET:=ON}
: ${ARROW_FILESYSTEM:=ON}
: ${ARROW_GANDIVA_JAVA:=ON}
: ${ARROW_GANDIVA:=ON}
: ${ARROW_ORC:=ON}
: ${ARROW_PARQUET:=ON}
Expand Down Expand Up @@ -65,7 +64,6 @@ cmake \
-DARROW_DEPENDENCY_USE_SHARED=OFF \
-DARROW_FILESYSTEM=${ARROW_FILESYSTEM} \
-DARROW_GANDIVA=${ARROW_GANDIVA} \
-DARROW_GANDIVA_JAVA=${ARROW_GANDIVA_JAVA} \
-DARROW_GANDIVA_STATIC_LIBSTDCPP=ON \
-DARROW_JNI=ON \
-DARROW_ORC=${ARROW_ORC} \
Expand Down Expand Up @@ -117,7 +115,6 @@ fi
echo "=== Copying libraries to the distribution folder ==="
mkdir -p "${dist_dir}"
cp -L ${install_dir}/lib/libarrow_orc_jni.dylib ${dist_dir}
cp -L ${install_dir}/lib/libgandiva_jni.dylib ${dist_dir}
cp -L ${build_dir}/cpp/*/libplasma_java.dylib ${dist_dir}

echo "=== Checking shared dependencies for libraries ==="
Expand Down
3 changes: 0 additions & 3 deletions ci/scripts/java_jni_manylinux_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ devtoolset_include_cpp="/opt/rh/devtoolset-${devtoolset_version}/root/usr/includ
: ${ARROW_BUILD_TESTS:=ON}
: ${ARROW_DATASET:=ON}
: ${ARROW_GANDIVA:=ON}
: ${ARROW_GANDIVA_JAVA:=ON}
: ${ARROW_FILESYSTEM:=ON}
: ${ARROW_JEMALLOC:=ON}
: ${ARROW_RPATH_ORIGIN:=ON}
Expand Down Expand Up @@ -73,7 +72,6 @@ cmake \
-DARROW_DEPENDENCY_SOURCE="VCPKG" \
-DARROW_DEPENDENCY_USE_SHARED=OFF \
-DARROW_FILESYSTEM=${ARROW_FILESYSTEM} \
-DARROW_GANDIVA_JAVA=${ARROW_GANDIVA_JAVA} \
-DARROW_GANDIVA_PC_CXX_FLAGS=${GANDIVA_CXX_FLAGS} \
-DARROW_GANDIVA=${ARROW_GANDIVA} \
-DARROW_JEMALLOC=${ARROW_JEMALLOC} \
Expand Down Expand Up @@ -137,7 +135,6 @@ fi

echo "=== Copying libraries to the distribution folder ==="
cp -L ${ARROW_HOME}/lib/libarrow_orc_jni.so ${dist_dir}
cp -L ${ARROW_HOME}/lib/libgandiva_jni.so ${dist_dir}
cp -L ${build_dir}/cpp/*/libplasma_java.so ${dist_dir}

echo "=== Checking shared dependencies for libraries ==="
Expand Down
5 changes: 3 additions & 2 deletions cpp/build-support/lint_exclusions.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
*_generated*
*.grpc.fb.*
*.pb.*
*RcppExports.cpp*
*_generated*
*arrowExports.cpp*
*parquet_constants.*
*parquet_types.*
*pyarrow_api.h
*pyarrow_lib.h
*python/config.h
*python/platform.h
*RcppExports.cpp*
*thirdparty/*
*vendored/*
*windows_compatibility.h
2 changes: 0 additions & 2 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,6 @@ Always OFF if building binaries" OFF)
#----------------------------------------------------------------------
set_option_category("Gandiva")

define_option(ARROW_GANDIVA_JAVA "Build the Gandiva JNI wrappers" OFF)

# ARROW-3860: Temporary workaround
define_option(ARROW_GANDIVA_STATIC_LIBSTDCPP
"Include -static-libstdc++ -static-libgcc when linking with;Gandiva static libraries"
Expand Down
10 changes: 6 additions & 4 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,13 @@ endmacro()

# Find modules are needed by the consumer in case of a static build, or if the
# linkage is PUBLIC or INTERFACE.
macro(provide_find_module PACKAGE_NAME)
macro(provide_find_module PACKAGE_NAME ARROW_CMAKE_PACKAGE_NAME)
set(module_ "${CMAKE_SOURCE_DIR}/cmake_modules/Find${PACKAGE_NAME}.cmake")
if(EXISTS "${module_}")
message(STATUS "Providing CMake module for ${PACKAGE_NAME}")
install(FILES "${module_}" DESTINATION "${ARROW_CMAKE_DIR}/Arrow")
message(STATUS "Providing CMake module for ${PACKAGE_NAME} as part of ${ARROW_CMAKE_PACKAGE_NAME} CMake package"
)
install(FILES "${module_}"
DESTINATION "${ARROW_CMAKE_DIR}/${ARROW_CMAKE_PACKAGE_NAME}")
endif()
unset(module_)
endmacro()
Expand Down Expand Up @@ -283,7 +285,7 @@ macro(resolve_dependency DEPENDENCY_NAME)
endif()
endif()
if(${DEPENDENCY_NAME}_SOURCE STREQUAL "SYSTEM" AND ARG_IS_RUNTIME_DEPENDENCY)
provide_find_module(${PACKAGE_NAME})
provide_find_module(${PACKAGE_NAME} "Arrow")
list(APPEND ARROW_SYSTEM_DEPENDENCIES ${PACKAGE_NAME})
find_package(PkgConfig QUIET)
foreach(ARG_PC_PACKAGE_NAME ${ARG_PC_PACKAGE_NAMES})
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/arrow/ArrowConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ set(ARROW_FULL_SO_VERSION "@ARROW_FULL_SO_VERSION@")
set(ARROW_BUNDLED_STATIC_LIBS "@ARROW_BUNDLED_STATIC_LIBS@")
set(ARROW_INCLUDE_PATH_SUFFIXES "@ARROW_INCLUDE_PATH_SUFFIXES@")
set(ARROW_LIBRARY_PATH_SUFFIXES "@ARROW_LIBRARY_PATH_SUFFIXES@")
set(ARROW_LLVM_VERSIONS "@ARROW_LLVM_VERSIONS@")
set(ARROW_LLVM_VERSION_PRIMARY_MAJOR "@ARROW_LLVM_VERSION_PRIMARY_MAJOR@")
set(ARROW_SYSTEM_DEPENDENCIES "@ARROW_SYSTEM_DEPENDENCIES@")

include("${CMAKE_CURRENT_LIST_DIR}/ArrowOptions.cmake")
Expand All @@ -51,7 +49,9 @@ if(ARROW_BUILD_STATIC)
find_dependency(Threads)

if(DEFINED CMAKE_MODULE_PATH)
set(_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
set(ARROW_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
else()
unset(ARROW_CMAKE_MODULE_PATH_OLD)
endif()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

Expand Down Expand Up @@ -84,9 +84,9 @@ if(ARROW_BUILD_STATIC)
endif()
endforeach()

if(DEFINED _CMAKE_MODULE_PATH_OLD)
set(CMAKE_MODULE_PATH ${_CMAKE_MODULE_PATH_OLD})
unset(_CMAKE_MODULE_PATH_OLD)
if(DEFINED ARROW_CMAKE_MODULE_PATH_OLD)
set(CMAKE_MODULE_PATH ${ARROW_CMAKE_MODULE_PATH_OLD})
unset(ARROW_CMAKE_MODULE_PATH_OLD)
else()
unset(CMAKE_MODULE_PATH)
endif()
Expand Down
8 changes: 3 additions & 5 deletions cpp/src/gandiva/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ add_custom_target(gandiva-benchmarks)
add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks)

find_package(LLVMAlt REQUIRED)
provide_find_module(LLVMAlt "Gandiva")

add_definitions(-DGANDIVA_LLVM_VERSION=${LLVM_VERSION_MAJOR})

Expand Down Expand Up @@ -155,7 +156,8 @@ add_arrow_lib(gandiva
${GANDIVA_STATIC_LINK_LIBS}
STATIC_INSTALL_INTERFACE_LIBS
Arrow::arrow_static
LLVM::LLVM_HEADERS)
LLVM::LLVM_HEADERS
LLVM::LLVM_LIBS)

foreach(LIB_TARGET ${GANDIVA_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE GANDIVA_EXPORTING)
Expand Down Expand Up @@ -246,9 +248,5 @@ add_gandiva_test(internals-test
gdv_function_stubs_test.cc
interval_holder_test.cc)

if(ARROW_GANDIVA_JAVA)
add_subdirectory(jni)
endif()

add_subdirectory(precompiled)
add_subdirectory(tests)
15 changes: 15 additions & 0 deletions cpp/src/gandiva/GandivaConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,24 @@

@PACKAGE_INIT@

set(ARROW_LLVM_VERSIONS "@ARROW_LLVM_VERSIONS@")
set(ARROW_LLVM_VERSION_PRIMARY_MAJOR "@ARROW_LLVM_VERSION_PRIMARY_MAJOR@")

include(CMakeFindDependencyMacro)
find_dependency(Arrow)
if(DEFINED CMAKE_MODULE_PATH)
set(GANDIVA_CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
else()
unset(GANDIVA_CMAKE_MODULE_PATH_OLD)
endif()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
find_dependency(LLVMAlt)
if(DEFINED GANDIVA_CMAKE_MODULE_PATH_OLD)
set(CMAKE_MODULE_PATH ${GANDIVA_CMAKE_MODULE_PATH_OLD})
unset(GANDIVA_CMAKE_MODULE_PATH_OLD)
else()
unset(CMAKE_MODULE_PATH)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/GandivaTargets.cmake")

Expand Down
109 changes: 0 additions & 109 deletions cpp/src/gandiva/jni/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 9917960

Please sign in to comment.