Repository: parquet-cpp Updated Branches: refs/heads/master 5830482f7 -> f76dc4432
PARQUET-957: Add PARQUET_BUILD_TOOLCHAIN env variable option to simplify setting build environment See also ARROW-849 Author: Wes McKinney <[email protected]> Closes #304 from wesm/PARQUET-957 and squashes the following commits: 476d4a9 [Wes McKinney] Update per comments in ARROW-849 9bdeccd [Wes McKinney] Add PARQUET_BUILD_TOOLCHAIN env variable option to simplify setting build environment Project: http://git-wip-us.apache.org/repos/asf/parquet-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/parquet-cpp/commit/f76dc443 Tree: http://git-wip-us.apache.org/repos/asf/parquet-cpp/tree/f76dc443 Diff: http://git-wip-us.apache.org/repos/asf/parquet-cpp/diff/f76dc443 Branch: refs/heads/master Commit: f76dc44323765b9d4ed00b1b9088a7b3e3780ed3 Parents: 5830482 Author: Wes McKinney <[email protected]> Authored: Thu Apr 20 21:17:02 2017 -0400 Committer: Wes McKinney <[email protected]> Committed: Thu Apr 20 21:17:02 2017 -0400 ---------------------------------------------------------------------- cmake_modules/FindArrow.cmake | 4 +- cmake_modules/FindBrotli.cmake | 4 +- cmake_modules/FindSnappy.cmake | 6 +-- cmake_modules/FindThrift.cmake | 6 +-- cmake_modules/FindZLIB.cmake | 4 +- cmake_modules/ThirdpartyToolchain.cmake | 67 ++++++++++++++++++++++++---- 6 files changed, 71 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/f76dc443/cmake_modules/FindArrow.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/FindArrow.cmake b/cmake_modules/FindArrow.cmake index d5e11d1..ad47513 100644 --- a/cmake_modules/FindArrow.cmake +++ b/cmake_modules/FindArrow.cmake @@ -22,7 +22,7 @@ # ARROW_SHARED_LIB, path to libarrow's shared library # ARROW_FOUND, whether arrow has been found -if ("$ENV{ARROW_HOME}" STREQUAL "") +if ("${ARROW_HOME}" STREQUAL "") # PARQUET-955. If the user has set $ARROW_HOME in the environment, we respect # this, otherwise try to locate the pkgconfig in the system environment pkg_check_modules(ARROW arrow) @@ -47,7 +47,7 @@ if ("$ENV{ARROW_HOME}" STREQUAL "") set(ARROW_STATIC_LIB ${ARROW_LIBDIR}/${ARROW_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}) endif() else() - set(ARROW_HOME "$ENV{ARROW_HOME}") + set(ARROW_HOME "${ARROW_HOME}") set(ARROW_SEARCH_HEADER_PATHS ${ARROW_HOME}/include http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/f76dc443/cmake_modules/FindBrotli.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/FindBrotli.cmake b/cmake_modules/FindBrotli.cmake index 6c01bd8..40d58ac 100644 --- a/cmake_modules/FindBrotli.cmake +++ b/cmake_modules/FindBrotli.cmake @@ -31,8 +31,8 @@ # BROTLI_SHARED_LIB, path to libbrotli's shared library # BROTLI_FOUND, whether brotli has been found -if( NOT "$ENV{BROTLI_HOME}" STREQUAL "") - file( TO_CMAKE_PATH "$ENV{BROTLI_HOME}" _native_path ) +if( NOT "${BROTLI_HOME}" STREQUAL "") + file( TO_CMAKE_PATH "${BROTLI_HOME}" _native_path ) list( APPEND _brotli_roots ${_native_path} ) elseif ( Brotli_HOME ) list( APPEND _brotli_roots ${Brotli_HOME} ) http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/f76dc443/cmake_modules/FindSnappy.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/FindSnappy.cmake b/cmake_modules/FindSnappy.cmake index 4c7ae71..d2825c0 100644 --- a/cmake_modules/FindSnappy.cmake +++ b/cmake_modules/FindSnappy.cmake @@ -31,14 +31,14 @@ # SNAPPY_SHARED_LIB, path to libsnappy's shared library # SNAPPY_FOUND, whether snappy has been found -if( NOT "$ENV{SNAPPY_HOME}" STREQUAL "") - file( TO_CMAKE_PATH "$ENV{SNAPPY_HOME}" _native_path ) +if( NOT "${SNAPPY_HOME}" STREQUAL "") + file( TO_CMAKE_PATH "${SNAPPY_HOME}" _native_path ) list( APPEND _snappy_roots ${_native_path} ) elseif ( Snappy_HOME ) list( APPEND _snappy_roots ${Snappy_HOME} ) endif() -message(STATUS "SNAPPY_HOME: $ENV{SNAPPY_HOME}") +message(STATUS "SNAPPY_HOME: ${SNAPPY_HOME}") find_path(SNAPPY_INCLUDE_DIR snappy.h HINTS ${_snappy_roots} NO_DEFAULT_PATH http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/f76dc443/cmake_modules/FindThrift.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/FindThrift.cmake b/cmake_modules/FindThrift.cmake index 43766e5..39432e9 100644 --- a/cmake_modules/FindThrift.cmake +++ b/cmake_modules/FindThrift.cmake @@ -29,14 +29,14 @@ # THRIFT_FOUND, If false, do not try to use ant # prefer the thrift version supplied in THRIFT_HOME -if( NOT "$ENV{THRIFT_HOME}" STREQUAL "") - file( TO_CMAKE_PATH "$ENV{THRIFT_HOME}" _native_path ) +if( NOT "${THRIFT_HOME}" STREQUAL "") + file( TO_CMAKE_PATH "${THRIFT_HOME}" _native_path ) list( APPEND _thrift_roots ${_native_path} ) elseif ( Thrift_HOME ) list( APPEND _thrift_roots ${Thrift_HOME} ) endif() -message(STATUS "THRIFT_HOME: $ENV{THRIFT_HOME}") +message(STATUS "THRIFT_HOME: ${THRIFT_HOME}") find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h HINTS ${_thrift_roots} NO_DEFAULT_PATH http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/f76dc443/cmake_modules/FindZLIB.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/FindZLIB.cmake b/cmake_modules/FindZLIB.cmake index ccbda04..1cae74a 100644 --- a/cmake_modules/FindZLIB.cmake +++ b/cmake_modules/FindZLIB.cmake @@ -32,8 +32,8 @@ # ZLIB_SHARED_LIB, path to libz's shared library # ZLIB_FOUND, whether zlib has been found -if( NOT "$ENV{ZLIB_HOME}" STREQUAL "") - file( TO_CMAKE_PATH "$ENV{ZLIB_HOME}" _native_path ) +if( NOT "${ZLIB_HOME}" STREQUAL "") + file( TO_CMAKE_PATH "${ZLIB_HOME}" _native_path ) list( APPEND _zlib_roots ${_native_path} ) elseif ( ZLIB_HOME ) list( APPEND _zlib_roots ${ZLIB_HOME} ) http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/f76dc443/cmake_modules/ThirdpartyToolchain.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake index 967c3c4..0e7e24d 100644 --- a/cmake_modules/ThirdpartyToolchain.cmake +++ b/cmake_modules/ThirdpartyToolchain.cmake @@ -19,9 +19,53 @@ set(GTEST_VERSION "1.8.0") set(GBENCHMARK_VERSION "1.1.0") set(SNAPPY_VERSION "1.1.3") set(THRIFT_VERSION "0.10.0") - set(BROTLI_VERSION "v0.6.0") +string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_BUILD_TYPE) +# Set -fPIC on all external projects and include the main CXX_FLAGS +set(EP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}} -fPIC") +set(EP_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}} -fPIC") + +# ---------------------------------------------------------------------- +# Configure toolchain with environment variables, if the exist + +if (NOT "$ENV{PARQUET_BUILD_TOOLCHAIN}" STREQUAL "") + set(THRIFT_HOME "$ENV{PARQUET_BUILD_TOOLCHAIN}") + set(SNAPPY_HOME "$ENV{PARQUET_BUILD_TOOLCHAIN}") + set(ZLIB_HOME "$ENV{PARQUET_BUILD_TOOLCHAIN}") + set(BROTLI_HOME "$ENV{PARQUET_BUILD_TOOLCHAIN}") + set(ARROW_HOME "$ENV{PARQUET_BUILD_TOOLCHAIN}") + + if (NOT DEFINED ENV{BOOST_ROOT}) + # Since we have to set this in the environment, we check whether + # $BOOST_ROOT is defined inside here + set(ENV{BOOST_ROOT} "$ENV{ARROW_BUILD_TOOLCHAIN}") + endif() +endif() + +if (DEFINED ENV{THRIFT_HOME}) + set(THRIFT_HOME "$ENV{THRIFT_HOME}") +endif() + +if (DEFINED ENV{SNAPPY_HOME}) + set(SNAPPY_HOME "$ENV{SNAPPY_HOME}") +endif() + +if (DEFINED ENV{ZLIB_HOME}) + set(ZLIB_HOME "$ENV{ZLIB_HOME}") +endif() + +if (DEFINED ENV{BROTLI_HOME}) + set(BROTLI_HOME "$ENV{BROTLI_HOME}") +endif() + +if (DEFINED ENV{ARROW_HOME}) + set(ARROW_HOME "$ENV{ARROW_HOME}") +endif() + +# ---------------------------------------------------------------------- +# Boost + # find boost headers and libs set(Boost_DEBUG TRUE) set(Boost_USE_MULTITHREADED ON) @@ -58,10 +102,8 @@ endif() include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) set(LIBS ${LIBS} ${Boost_LIBRARIES}) -string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_BUILD_TYPE) -# Set -fPIC on all external projects and include the main CXX_FLAGS -set(EP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}} -fPIC") -set(EP_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}} -fPIC") +# ---------------------------------------------------------------------- +# Thrift # find thrift headers and libs find_package(Thrift) @@ -120,6 +162,9 @@ if (THRIFT_VENDORED) add_dependencies(thriftstatic thrift_ep) endif() +# ---------------------------------------------------------------------- +# Snappy + ## Snappy find_package(Snappy) if (NOT SNAPPY_FOUND) @@ -168,7 +213,9 @@ if (SNAPPY_VENDORED) add_dependencies(snappystatic snappy_ep) endif() -## Brotli +# ---------------------------------------------------------------------- +# Brotli + find_package(Brotli) if (NOT BROTLI_FOUND) set(BROTLI_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/brotli_ep/src/brotli_ep-install") @@ -214,7 +261,9 @@ if (BROTLI_VENDORED) add_dependencies(brotlistatic_common brotli_ep) endif() -## ZLIB +# ---------------------------------------------------------------------- +# ZLIB + if (NOT PARQUET_ZLIB_VENDORED) find_package(ZLIB) endif() @@ -359,7 +408,9 @@ if(PARQUET_BUILD_BENCHMARKS AND NOT IGNORE_OPTIONAL_PACKAGES) endif() endif() -## Apache Arrow +# ---------------------------------------------------------------------- +# Apache Arrow + find_package(Arrow) if (NOT ARROW_FOUND) set(ARROW_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/arrow_ep/src/arrow_ep-install")
