You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@parquet.apache.org by we...@apache.org on 2017/04/01 18:55:23 UTC
parquet-cpp git commit: PARQUET-932: Add option to build parquet
library with minimal dependency
Repository: parquet-cpp
Updated Branches:
refs/heads/master 3cf1eb249 -> 323ffe656
PARQUET-932: Add option to build parquet library with minimal dependency
If users want to build only the parquet library, thirdparty headers are sufficient and GTEST and GBENCHMARK are not required.
Author: Deepak Majeti <de...@hpe.com>
Closes #279 from majetideepak/ParquetMinimal and squashes the following commits:
cdb4135 [Deepak Majeti] correct arrow.h with api.h
100a47a [Deepak Majeti] add to README
dacc908 [Deepak Majeti] add message
016d055 [Deepak Majeti] Support minimal dependency build
Project: http://git-wip-us.apache.org/repos/asf/parquet-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/parquet-cpp/commit/323ffe65
Tree: http://git-wip-us.apache.org/repos/asf/parquet-cpp/tree/323ffe65
Diff: http://git-wip-us.apache.org/repos/asf/parquet-cpp/diff/323ffe65
Branch: refs/heads/master
Commit: 323ffe656da0f14234d260646e022752bfbe5551
Parents: 3cf1eb2
Author: Deepak Majeti <de...@hpe.com>
Authored: Sat Apr 1 14:55:17 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Sat Apr 1 14:55:17 2017 -0400
----------------------------------------------------------------------
CMakeLists.txt | 35 ++++++++++++++++++----------
README.md | 4 ++++
cmake_modules/FindArrow.cmake | 12 +++++++---
cmake_modules/FindBrotli.cmake | 10 ++++++--
cmake_modules/FindSnappy.cmake | 10 ++++++--
cmake_modules/FindZLIB.cmake | 12 +++++++---
cmake_modules/ThirdpartyToolchain.cmake | 4 ++--
7 files changed, 63 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/323ffe65/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11b8d5d..ee31424 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,10 +113,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)
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
@@ -315,6 +319,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
@@ -574,16 +584,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}
)
@@ -594,10 +594,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)
http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/323ffe65/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 6086fc8..3b723f6 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,10 @@ To disable the testing (which requires `googletest`), pass
For release-level builds (enable optimizations and disable debugging), pass
`-DCMAKE_BUILD_TYPE=Release` to `cmake`.
+To build only the library with minimal dependencies, pass
+`-DPARQUET_MINIMAL_DEPENDENCY=ON` to `cmake`.
+Note that the executables, tests, and benchmarks should be disabled as well.
+
Incremental builds can be done afterwords with just `make`.
## Using with Apache Arrow
http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/323ffe65/cmake_modules/FindArrow.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/FindArrow.cmake b/cmake_modules/FindArrow.cmake
index b98c688..0a3e7e2 100644
--- a/cmake_modules/FindArrow.cmake
+++ b/cmake_modules/FindArrow.cmake
@@ -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))
set(ARROW_FOUND TRUE)
+ set(ARROW_HEADER_NAME arrow/api.h)
+ set(ARROW_HEADER ${ARROW_INCLUDE_DIR}/${ARROW_HEADER_NAME})
set(ARROW_LIB_NAME libarrow)
set(ARROW_IO_LIB_NAME libarrow_io)
@@ -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)
http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/323ffe65/cmake_modules/FindBrotli.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/FindBrotli.cmake b/cmake_modules/FindBrotli.cmake
index c6524de..6c01bd8 100644
--- a/cmake_modules/FindBrotli.cmake
+++ b/cmake_modules/FindBrotli.cmake
@@ -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
@@ -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)
http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/323ffe65/cmake_modules/FindSnappy.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/FindSnappy.cmake b/cmake_modules/FindSnappy.cmake
index 304b4c8..6c164d2 100644
--- a/cmake_modules/FindSnappy.cmake
+++ b/cmake_modules/FindSnappy.cmake
@@ -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})
@@ -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)
http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/323ffe65/cmake_modules/FindZLIB.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/FindZLIB.cmake b/cmake_modules/FindZLIB.cmake
index 6653046..ccbda04 100644
--- a/cmake_modules/FindZLIB.cmake
+++ b/cmake_modules/FindZLIB.cmake
@@ -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
@@ -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})
@@ -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)
http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/323ffe65/cmake_modules/ThirdpartyToolchain.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index ecd9bca..3344075 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -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 "")
@@ -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)