Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 2 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
35 changes: 23 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
option(PARQUET_RPATH_ORIGIN
"Build Parquet libraries with RATH set to \$ORIGIN"
OFF)
option(PARQUET_MINIMAL_DEPENDENCY
"Depend only on Thirdparty headers to build libparquet. Always OFF if building binaries"
OFF)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also implicitly set this value to OFF by default and set it to ON if PARQUET_BUILD_TESTS and PARQUET_BUILD_EXECUTABLES and PARQUET_BUILD_BENCHMARKS are all OFF

endif()

if (PARQUET_BUILD_TESTS OR PARQUET_BUILD_EXECUTABLES OR PARQUET_BUILD_BENCHMARKS)
set(PARQUET_BUILD_STATIC ON)
set(PARQUET_MINIMAL_DEPENDENCY OFF)
endif()

# If build in-source, create the latest symlink. If build out-of-source, which is
Expand Down Expand Up @@ -305,6 +309,12 @@ enable_testing()
# Dependencies
############################################################

if (PARQUET_MINIMAL_DEPENDENCY)
set(IGNORE_OPTIONAL_PACKAGES ON)
message(STATUS "Build using minimal dependencies")
else()
set(IGNORE_OPTIONAL_PACKAGES OFF)
endif()
include(ThirdpartyToolchain)

# Thrift requires these definitions for some types that we use
Expand Down Expand Up @@ -564,16 +574,6 @@ set(BUNDLED_STATIC_LIBS
zlibstatic
)

# These are libraries that we will link privately with parquet_shared (as they
# do not need to be linked transitively by other linkers), but publicly with
# parquet_static (because internal users need to transitively link all
# dependencies)
set(LIBPARQUET_INTERFACE_LINK_LIBS
${ARROW_LINK_LIBS}
${BOOST_LINK_LIBS}
${BUNDLED_STATIC_LIBS}
)

add_library(parquet_objlib OBJECT
${LIBPARQUET_SRCS}
)
Expand All @@ -584,10 +584,21 @@ add_custom_target(thrift-deps ALL
DEPENDS ${THRIFT_OUTPUT_FILES})
add_dependencies(parquet_objlib thrift-deps)

if (NOT PARQUET_MINIMAL_DEPENDENCY)
# These are libraries that we will link privately with parquet_shared (as they
# do not need to be linked transitively by other linkers), but publicly with
# parquet_static (because internal users need to transitively link all
# dependencies)
set(LIBPARQUET_INTERFACE_LINK_LIBS
${ARROW_LINK_LIBS}
${BOOST_LINK_LIBS}
${BUNDLED_STATIC_LIBS}
)
# Although we don't link parquet_objlib against anything, we need it to depend
# on these libs as we may generate their headers via ExternalProject_Add
add_dependencies(parquet_objlib
${LIBPARQUET_INTERFACE_LINK_LIBS})
add_dependencies(parquet_objlib
${LIBPARQUET_INTERFACE_LINK_LIBS})
endif()

set_property(TARGET parquet_objlib PROPERTY POSITION_INDEPENDENT_CODE 1)

Expand Down
12 changes: 9 additions & 3 deletions cmake_modules/FindArrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ find_library(ARROW_IO_LIB_PATH NAMES arrow_io
${ARROW_SEARCH_LIB_PATH}
NO_DEFAULT_PATH)

if (ARROW_INCLUDE_DIR AND ARROW_LIB_PATH)
if (ARROW_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR ARROW_LIB_PATH))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so I understand, you have a build environment where only the headers are available, and no libraries?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct.

set(ARROW_FOUND TRUE)
set(ARROW_HEADER_NAME arrow/arrow.h)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's called arrow/api.h

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

set(ARROW_HEADER ${ARROW_INCLUDE_DIR}/${ARROW_HEADER_NAME})
set(ARROW_LIB_NAME libarrow)
set(ARROW_IO_LIB_NAME libarrow_io)

Expand All @@ -63,8 +65,12 @@ if (ARROW_INCLUDE_DIR AND ARROW_LIB_PATH)
set(ARROW_IO_STATIC_LIB ${ARROW_LIBS}/${ARROW_IO_LIB_NAME}.a)
set(ARROW_IO_SHARED_LIB ${ARROW_LIBS}/${ARROW_IO_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
if (NOT Arrow_FIND_QUIETLY)
message(STATUS "Found the Arrow core library: ${ARROW_LIB_PATH}")
message(STATUS "Found the Arrow IO library: ${ARROW_IO_LIB_PATH}")
if (PARQUET_MINIMAL_DEPENDENCY)
message(STATUS "Found the Arrow core and IO header: ${ARROW_HEADER}")
else ()
message(STATUS "Found the Arrow core library: ${ARROW_LIB_PATH}")
message(STATUS "Found the Arrow IO library: ${ARROW_IO_LIB_PATH}")
endif ()
endif ()
else ()
if (NOT Arrow_FIND_QUIETLY)
Expand Down
10 changes: 8 additions & 2 deletions cmake_modules/FindBrotli.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ endif ()
set(BROTLI_LIBRARIES ${BROTLI_LIBRARY_ENC} ${BROTLI_LIBRARY_DEC}
${BROTLI_LIBRARY_COMMON})

if (BROTLI_INCLUDE_DIR AND BROTLI_LIBRARIES)
if (BROTLI_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR BROTLI_LIBRARIES))
set(BROTLI_FOUND TRUE)
get_filename_component( BROTLI_LIBS ${BROTLI_LIBRARY_ENC} PATH )
set(BROTLI_HEADER_NAME brotli.h)
set(BROTLI_HEADER ${BROTLI_INCLUDE_DIR}/${BROTLI_HEADER_NAME})
set(BROTLI_LIB_NAME libbrotli)
set(BROTLI_STATIC_LIB
${BROTLI_LIBS}/${BROTLI_LIB_NAME}enc.a
Expand All @@ -78,7 +80,11 @@ endif ()

if (BROTLI_FOUND)
if (NOT Brotli_FIND_QUIETLY)
message(STATUS "Found the Brotli library: ${BROTLI_LIBRARIES}")
if (PARQUET_MINIMAL_DEPENDENCY)
message(STATUS "Found the Brotli header: ${BROTLI_HEADER}")
else ()
message(STATUS "Found the Brotli library: ${BROTLI_LIBRARIES}")
endif ()
endif ()
else ()
if (NOT Brotli_FIND_QUIETLY)
Expand Down
10 changes: 8 additions & 2 deletions cmake_modules/FindSnappy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ find_library( SNAPPY_LIBRARIES NAMES snappy PATHS
NO_DEFAULT_PATH
PATH_SUFFIXES "lib")

if (SNAPPY_INCLUDE_DIR AND SNAPPY_LIBRARIES)
if (SNAPPY_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR SNAPPY_LIBRARIES))
set(SNAPPY_FOUND TRUE)
get_filename_component( SNAPPY_LIBS ${SNAPPY_LIBRARIES} PATH )
set(SNAPPY_HEADER_NAME snappy.h)
set(SNAPPY_HEADER ${SNAPPY_INCLUDE_DIR}/${SNAPPY_HEADER_NAME})
set(SNAPPY_LIB_NAME libsnappy)
set(SNAPPY_STATIC_LIB ${SNAPPY_LIBS}/${SNAPPY_LIB_NAME}.a)
set(SNAPPY_SHARED_LIB ${SNAPPY_LIBS}/${SNAPPY_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
Expand All @@ -61,7 +63,11 @@ endif ()

if (SNAPPY_FOUND)
if (NOT Snappy_FIND_QUIETLY)
message(STATUS "Found the Snappy library: ${SNAPPY_LIBRARIES}")
if (PARQUET_MINIMAL_DEPENDENCY)
message(STATUS "Found the Snappy header: ${SNAPPY_HEADER}")
else ()
message(STATUS "Found the Snappy library: ${SNAPPY_LIBRARIES}")
endif ()
endif ()
else ()
if (NOT Snappy_FIND_QUIETLY)
Expand Down
12 changes: 9 additions & 3 deletions cmake_modules/FindZLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#
# ZLIB_HOME - When set, this path is inspected instead of standard library
# locations as the root of the ZLIB installation.
# The environment variable ZLIB_HOME overrides this veriable.
# The environment variable ZLIB_HOME overrides this variable.
#
# - Find ZLIB (zlib.h, libz.a, libz.so, and libz.so.1)
# This module defines
Expand Down Expand Up @@ -54,9 +54,11 @@ else ()
endif ()


if (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARIES)
if (ZLIB_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR ZLIB_LIBRARIES))
set(ZLIB_FOUND TRUE)
get_filename_component( ZLIB_LIBS ${ZLIB_LIBRARIES} PATH )
set(ZLIB_HEADER_NAME zlib.h)
set(ZLIB_HEADER ${ZLIB_INCLUDE_DIR}/${ZLIB_HEADER_NAME})
set(ZLIB_LIB_NAME libz)
set(ZLIB_STATIC_LIB ${ZLIB_LIBS}/${ZLIB_LIB_NAME}.a)
set(ZLIB_SHARED_LIB ${ZLIB_LIBS}/${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
Expand All @@ -66,7 +68,11 @@ endif ()

if (ZLIB_FOUND)
if (NOT ZLIB_FIND_QUIETLY)
message(STATUS "Found the ZLIB library: ${ZLIB_LIBRARIES}")
if (PARQUET_MINIMAL_DEPENDENCY)
message(STATUS "Found the ZLIB header: ${ZLIB_HEADER}")
else()
message(STATUS "Found the ZLIB library: ${ZLIB_LIBRARIES}")
endif ()
endif ()
else ()
if (NOT ZLIB_FIND_QUIETLY)
Expand Down
4 changes: 2 additions & 2 deletions cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ if (ZLIB_VENDORED)
endif()

## GTest
if(PARQUET_BUILD_TESTS)
if(PARQUET_BUILD_TESTS AND NOT IGNORE_OPTIONAL_PACKAGES)
add_custom_target(unittest ctest -L unittest)

if("$ENV{GTEST_HOME}" STREQUAL "")
Expand Down Expand Up @@ -308,7 +308,7 @@ if ("$ENV{GBENCHMARK_HOME}" STREQUAL "")
set(GBENCHMARK_HOME ${THIRDPARTY_DIR}/installed)
endif()

if(PARQUET_BUILD_BENCHMARKS)
if(PARQUET_BUILD_BENCHMARKS AND NOT IGNORE_OPTIONAL_PACKAGES)
add_custom_target(runbenchmark ctest -L benchmark)

if("$ENV{GBENCHMARK_HOME}" STREQUAL "")
Expand Down