Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions ci/scripts/conan_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ fi
if [ -n "${ARROW_CONAN_WITH_LZ4:-}" ]; then
conan_args+=(--options arrow:with_lz4=${ARROW_CONAN_WITH_LZ4})
fi
if [ -n "${ARROW_CONAN_WITH_SNAPPY:-}" ]; then
conan_args+=(--options arrow:with_snappy=${ARROW_CONAN_WITH_SNAPPY})
fi

version=$(grep '^set(ARROW_VERSION ' ${ARROW_HOME}/cpp/CMakeLists.txt | \
grep -E -o '([0-9.]*)')
Expand Down
4 changes: 2 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,9 @@ if(ARROW_WITH_LZ4)
endif()

if(ARROW_WITH_SNAPPY)
list(APPEND ARROW_STATIC_LINK_LIBS Snappy::snappy)
list(APPEND ARROW_STATIC_LINK_LIBS ${Snappy_TARGET})
if(Snappy_SOURCE STREQUAL "SYSTEM")
list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS Snappy::snappy)
list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${Snappy_TARGET})
endif()
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@
# specific language governing permissions and limitations
# under the License.

set(find_package_args)
if(SnappyAlt_FIND_VERSION)
list(APPEND find_package_args ${SnappyAlt_FIND_VERSION})
endif()
if(SnappyAlt_FIND_QUIETLY)
list(APPEND find_package_args QUIET)
endif()
find_package(Snappy ${find_package_args})
if(Snappy_FOUND)
if(ARROW_SNAPPY_USE_SHARED)
set(Snappy_TARGET Snappy::snappy)
set(SnappyAlt_FOUND TRUE)
return()
else()
if(TARGET Snappy::snappy-static)
# The official SnappyTargets.cmake uses Snappy::snappy-static for
# static version.
set(Snappy_TARGET Snappy::snappy-static)
set(SnappyAlt_FOUND TRUE)
return()
else()
# The Conan's Snappy package always uses Snappy::snappy and it's
# an INTERFACE_LIBRARY.
get_target_property(Snappy Snappy::snappy TYPE)
if(Snappy_TYPE STREQUAL "STATIC_LIBRARY" OR Snappy_TYPE STREQUAL
"INTERFACE_LIBRARY")
set(Snappy_TARGET Snappy::snappy)
set(SnappyAlt_FOUND TRUE)
return()
endif()
endif()
endif()
endif()

if(ARROW_SNAPPY_USE_SHARED)
set(SNAPPY_LIB_NAMES)
if(CMAKE_IMPORT_LIBRARY_SUFFIX)
Expand Down Expand Up @@ -52,11 +86,18 @@ else()
PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES})
endif()

find_package_handle_standard_args(Snappy REQUIRED_VARS Snappy_LIB Snappy_INCLUDE_DIR)
find_package_handle_standard_args(SnappyAlt REQUIRED_VARS Snappy_LIB Snappy_INCLUDE_DIR)

if(Snappy_FOUND)
add_library(Snappy::snappy UNKNOWN IMPORTED)
set_target_properties(Snappy::snappy
if(SnappyAlt_FOUND)
if(ARROW_SNAPPY_USE_SHARED)
set(Snappy_TARGET Snappy::snappy)
set(Snappy_TARGET_TYPE SHARED)
else()
set(Snappy_TARGET Snappy::snappy-static)
set(Snappy_TARGET_TYPE STATIC)
endif()
add_library(${Snappy_TARGET} ${Snappy_TARGET_TYPE} IMPORTED)
set_target_properties(${Snappy_TARGET}
PROPERTIES IMPORTED_LOCATION "${Snappy_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${Snappy_INCLUDE_DIR}")
endif()
4 changes: 2 additions & 2 deletions cpp/cmake_modules/Findre2Alt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ if(re2_FOUND)
return()
endif()

if(RE2_ROOT)
if(re2_ROOT)
find_library(RE2_LIB
NAMES re2_static
re2
"${CMAKE_STATIC_LIBRARY_PREFIX}re2${RE2_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${CMAKE_SHARED_LIBRARY_PREFIX}re2${CMAKE_SHARED_LIBRARY_SUFFIX}"
PATHS ${RE2_ROOT}
PATHS ${re2_ROOT}
PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}
NO_DEFAULT_PATH)
find_path(RE2_INCLUDE_DIR
Expand Down
40 changes: 31 additions & 9 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ if("${re2_SOURCE}" STREQUAL "" AND NOT "${RE2_SOURCE}" STREQUAL "")
set(re2_SOURCE ${RE2_SOURCE})
endif()

# For backward compatibility. We use "RE2_ROOT" if "re2_ROOT"
# isn't specified and "RE2_ROOT" is specified.
if("${re2_ROOT}" STREQUAL "" AND NOT "${RE2_ROOT}" STREQUAL "")
set(re2_ROOT ${RE2_ROOT})
endif()

# For backward compatibility. We use "Lz4_SOURCE" if "lz4_SOURCE"
# isn't specified and "lz4_SOURCE" is specified.
# We renamed "Lz4" dependency name to "lz4" in 9.0.0 because
Expand Down Expand Up @@ -1107,22 +1113,37 @@ macro(build_snappy)

file(MAKE_DIRECTORY "${SNAPPY_PREFIX}/include")

add_library(Snappy::snappy STATIC IMPORTED)
set_target_properties(Snappy::snappy
set(Snappy_TARGET Snappy::snappy-static)
add_library(${Snappy_TARGET} STATIC IMPORTED)
set_target_properties(${Snappy_TARGET}
PROPERTIES IMPORTED_LOCATION "${SNAPPY_STATIC_LIB}"
INTERFACE_INCLUDE_DIRECTORIES
"${SNAPPY_PREFIX}/include")
add_dependencies(toolchain snappy_ep)
add_dependencies(Snappy::snappy snappy_ep)
add_dependencies(${Snappy_TARGET} snappy_ep)

list(APPEND ARROW_BUNDLED_STATIC_LIBS Snappy::snappy)
list(APPEND ARROW_BUNDLED_STATIC_LIBS ${Snappy_TARGET})
endmacro()

if(ARROW_WITH_SNAPPY)
resolve_dependency(Snappy PC_PACKAGE_NAMES snappy)
resolve_dependency(Snappy
HAVE_ALT
TRUE
PC_PACKAGE_NAMES
snappy)
if(${Snappy_SOURCE} STREQUAL "SYSTEM" AND NOT snappy_PC_FOUND)
get_target_property(SNAPPY_LIB Snappy::snappy IMPORTED_LOCATION)
string(APPEND ARROW_PC_LIBS_PRIVATE " ${SNAPPY_LIB}")
get_target_property(SNAPPY_TYPE ${Snappy_TARGET} TYPE)
if(NOT SNAPPY_TYPE STREQUAL "INTERFACE_LIBRARY")
get_target_property(SNAPPY_LIB ${Snappy_TARGET}
IMPORTED_LOCATION_${UPPERCASE_BUILD_TYPE})
if(NOT SNAPPY_LIB)
get_target_property(SNAPPY_LIB ${Snappy_TARGET} IMPORTED_LOCATION_RELEASE)
endif()
if(NOT SNAPPY_LIB)
get_target_property(SNAPPY_LIB ${Snappy_TARGET} IMPORTED_LOCATION)
endif()
string(APPEND ARROW_PC_LIBS_PRIVATE " ${SNAPPY_LIB}")
endif()
endif()
endif()

Expand Down Expand Up @@ -4224,7 +4245,8 @@ macro(build_orc)
get_target_property(ORC_PROTOBUF_LIBRARY ${ARROW_PROTOBUF_LIBPROTOBUF}
IMPORTED_LOCATION)

get_target_property(ORC_SNAPPY_INCLUDE_DIR Snappy::snappy INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(ORC_SNAPPY_INCLUDE_DIR ${Snappy_TARGET}
INTERFACE_INCLUDE_DIRECTORIES)
get_filename_component(ORC_SNAPPY_ROOT "${ORC_SNAPPY_INCLUDE_DIR}" DIRECTORY)

get_target_property(ORC_LZ4_ROOT lz4::lz4 INTERFACE_INCLUDE_DIRECTORIES)
Expand Down Expand Up @@ -4272,7 +4294,7 @@ macro(build_orc)
set(ORC_VENDORED 1)
add_dependencies(orc_ep ZLIB::ZLIB)
add_dependencies(orc_ep lz4::lz4)
add_dependencies(orc_ep Snappy::snappy)
add_dependencies(orc_ep ${Snappy_TARGET})
add_dependencies(orc_ep ${ARROW_PROTOBUF_LIBPROTOBUF})

add_library(orc::liborc STATIC IMPORTED)
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/adapters/orc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ arrow_add_pkg_config("arrow-orc")
set(ORC_MIN_TEST_LIBS
GTest::gtest_main
GTest::gtest
Snappy::snappy
${Snappy_TARGET}
lz4::lz4
ZLIB::ZLIB)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ usr/lib/*/cmake/arrow/ArrowOptions.cmake
usr/lib/*/cmake/arrow/ArrowTargets*.cmake
usr/lib/*/cmake/arrow/Find*Alt.cmake
usr/lib/*/cmake/arrow/FindArrow.cmake
usr/lib/*/cmake/arrow/FindBrotli.cmake
usr/lib/*/cmake/arrow/Findjemalloc.cmake
usr/lib/*/cmake/arrow/Find[STuz]*.cmake
usr/lib/*/cmake/arrow/Find[BTuz]*.cmake
usr/lib/*/cmake/arrow/arrow-config.cmake
usr/lib/*/libarrow.a
usr/lib/*/libarrow.so
Expand Down
2 changes: 1 addition & 1 deletion dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ Libraries and header files for Apache Arrow C++.
%{_libdir}/cmake/arrow/ArrowTargets*.cmake
%{_libdir}/cmake/arrow/FindArrow.cmake
%{_libdir}/cmake/arrow/FindBrotli.cmake
%{_libdir}/cmake/arrow/FindSnappy.cmake
%{_libdir}/cmake/arrow/FindSnappyAlt.cmake
%if %{have_thrift}
%{_libdir}/cmake/arrow/FindThrift.cmake
%endif
Expand Down
3 changes: 2 additions & 1 deletion dev/tasks/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,9 @@ tasks:
params:
flags: >-
-e ARROW_CONAN_PARQUET=True
-e ARROW_CONAN_WITH_LZ4=True
-e ARROW_CONAN_WITH_JEMALLOC=True
-e ARROW_CONAN_WITH_LZ4=True
-e ARROW_CONAN_WITH_SNAPPY=True
image: conan

########################### Python Minimal ############################
Expand Down