You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/04/22 14:52:13 UTC

arrow git commit: ARROW-849: [C++] Support setting production build dependencies with ARROW_BUILD_TOOLCHAIN

Repository: arrow
Updated Branches:
  refs/heads/master 578b0ff15 -> 07c6ade9b


ARROW-849: [C++] Support setting production build dependencies with ARROW_BUILD_TOOLCHAIN

Opening this for comment. If we like this, we can do the same thing in parquet-cpp. Will need to be documented in the README.

I did not use the environment variable for gflags/gtest/gbenchmark, since this are test/benchmark-only dependencies, and they build automatically when needed.

Author: Wes McKinney <we...@twosigma.com>

Closes #565 from wesm/ARROW-849 and squashes the following commits:

4507712 [Wes McKinney] Fix use of RAPIDJSON_HOME
e9fa400 [Wes McKinney] Use ARROW_BUILD_TOOLCHAIN if it's defined, but override with environment variables
d056a83 [Wes McKinney] Pull environment variables by default, override if toolchain variable is present
ec003c6 [Wes McKinney] Support setting production build dependencies with ARROW_BUILD_TOOLCHAIN environment variable


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/07c6ade9
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/07c6ade9
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/07c6ade9

Branch: refs/heads/master
Commit: 07c6ade9b8362ba30c5d784986aedcb3cfb6483a
Parents: 578b0ff
Author: Wes McKinney <we...@twosigma.com>
Authored: Sat Apr 22 10:52:08 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Sat Apr 22 10:52:08 2017 -0400

----------------------------------------------------------------------
 cpp/CMakeLists.txt                      | 50 ++++++++++++++++++++--------
 cpp/cmake_modules/FindFlatbuffers.cmake |  6 ++--
 cpp/cmake_modules/Findjemalloc.cmake    |  4 +--
 3 files changed, 42 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/07c6ade9/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 81e4c90..978f70a 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -46,13 +46,6 @@ set(ARROW_SO_VERSION "0")
 set(ARROW_ABI_VERSION "${ARROW_SO_VERSION}.0.0")
 
 set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support")
-set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty")
-
-set(GFLAGS_VERSION "2.1.2")
-set(GTEST_VERSION "1.8.0")
-set(GBENCHMARK_VERSION "1.1.0")
-set(FLATBUFFERS_VERSION "1.6.0")
-set(JEMALLOC_VERSION "4.4.0")
 
 find_package(ClangTools)
 if ("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND)
@@ -388,6 +381,40 @@ enable_testing()
 ############################################################
 
 # ----------------------------------------------------------------------
+# Thirdparty toolchain
+
+set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty")
+set(GFLAGS_VERSION "2.1.2")
+set(GTEST_VERSION "1.8.0")
+set(GBENCHMARK_VERSION "1.1.0")
+set(FLATBUFFERS_VERSION "1.6.0")
+set(JEMALLOC_VERSION "4.4.0")
+
+if (NOT "$ENV{ARROW_BUILD_TOOLCHAIN}" STREQUAL "")
+  set(FLATBUFFERS_HOME "$ENV{ARROW_BUILD_TOOLCHAIN}")
+  set(RAPIDJSON_HOME "$ENV{ARROW_BUILD_TOOLCHAIN}")
+  set(JEMALLOC_HOME "$ENV{ARROW_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{FLATBUFFERS_HOME})
+  set(FLATBUFFERS_HOME "$ENV{FLATBUFFERS_HOME}")
+endif()
+
+if (DEFINED ENV{RAPIDJSON_HOME})
+  set(RAPIDJSON_HOME "$ENV{RAPIDJSON_HOME}")
+endif()
+
+if (DEFINED ENV{JEMALLOC_HOME})
+  set(JEMALLOC_HOME "$ENV{JEMALLOC_HOME}")
+endif()
+
+# ----------------------------------------------------------------------
 # Add Boost dependencies (code adapted from Apache Kudu (incubating))
 
 set(Boost_DEBUG TRUE)
@@ -451,9 +478,6 @@ SET(ARROW_BOOST_LIBS boost_system boost_filesystem)
 
 include_directories(SYSTEM ${Boost_INCLUDE_DIR})
 
-# ----------------------------------------------------------------------
-# Enable / disable tests and benchmarks
-
 if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS)
   add_custom_target(unittest ctest -L unittest)
 
@@ -616,7 +640,7 @@ endif()
 
 if (ARROW_IPC)
   # RapidJSON, header only dependency
-  if("$ENV{RAPIDJSON_HOME}" STREQUAL "")
+  if("${RAPIDJSON_HOME}" STREQUAL "")
     ExternalProject_Add(rapidjson_ep
       PREFIX "${CMAKE_BINARY_DIR}"
       URL "https://github.com/miloyip/rapidjson/archive/v1.1.0.tar.gz"
@@ -630,14 +654,14 @@ if (ARROW_IPC)
     set(RAPIDJSON_INCLUDE_DIR "${SOURCE_DIR}/include")
     set(RAPIDJSON_VENDORED 1)
   else()
-    set(RAPIDJSON_INCLUDE_DIR "$ENV{RAPIDJSON_HOME}/include")
+    set(RAPIDJSON_INCLUDE_DIR "${RAPIDJSON_HOME}/include")
     set(RAPIDJSON_VENDORED 0)
   endif()
   message(STATUS "RapidJSON include dir: ${RAPIDJSON_INCLUDE_DIR}")
   include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR})
 
   ## Flatbuffers
-  if("$ENV{FLATBUFFERS_HOME}" STREQUAL "")
+  if("${FLATBUFFERS_HOME}" STREQUAL "")
     set(FLATBUFFERS_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/flatbuffers_ep-prefix/src/flatbuffers_ep-install")
     ExternalProject_Add(flatbuffers_ep
       URL "https://github.com/google/flatbuffers/archive/v${FLATBUFFERS_VERSION}.tar.gz"

http://git-wip-us.apache.org/repos/asf/arrow/blob/07c6ade9/cpp/cmake_modules/FindFlatbuffers.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/FindFlatbuffers.cmake b/cpp/cmake_modules/FindFlatbuffers.cmake
index ee472d1..7fa640a 100644
--- a/cpp/cmake_modules/FindFlatbuffers.cmake
+++ b/cpp/cmake_modules/FindFlatbuffers.cmake
@@ -31,8 +31,8 @@
 #  FLATBUFFERS_STATIC_LIB, path to libflatbuffers.a
 #  FLATBUFFERS_FOUND, whether flatbuffers has been found
 
-if( NOT "$ENV{FLATBUFFERS_HOME}" STREQUAL "")
-    file( TO_CMAKE_PATH "$ENV{FLATBUFFERS_HOME}" _native_path )
+if( NOT "${FLATBUFFERS_HOME}" STREQUAL "")
+    file( TO_CMAKE_PATH "${FLATBUFFERS_HOME}" _native_path )
     list( APPEND _flatbuffers_roots ${_native_path} )
 elseif ( Flatbuffers_HOME )
     list( APPEND _flatbuffers_roots ${Flatbuffers_HOME} )
@@ -52,7 +52,7 @@ else ()
 endif ()
 
 find_program(FLATBUFFERS_COMPILER flatc
-  $ENV{FLATBUFFERS_HOME}/bin
+  ${FLATBUFFERS_HOME}/bin
   /usr/local/bin
   /usr/bin
   NO_DEFAULT_PATH

http://git-wip-us.apache.org/repos/asf/arrow/blob/07c6ade9/cpp/cmake_modules/Findjemalloc.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/Findjemalloc.cmake b/cpp/cmake_modules/Findjemalloc.cmake
index e511d4d..9345898 100644
--- a/cpp/cmake_modules/Findjemalloc.cmake
+++ b/cpp/cmake_modules/Findjemalloc.cmake
@@ -30,8 +30,8 @@
 #  JEMALLOC_SHARED_LIB, path to libjemalloc.so/dylib
 #  JEMALLOC_FOUND, whether flatbuffers has been found
 
-if( NOT "$ENV{JEMALLOC_HOME}" STREQUAL "")
-    file( TO_CMAKE_PATH "$ENV{JEMALLOC_HOME}" _native_path )
+if( NOT "${JEMALLOC_HOME}" STREQUAL "")
+    file( TO_CMAKE_PATH "${JEMALLOC_HOME}" _native_path )
     list( APPEND _jemalloc_roots ${_native_path} )
 elseif ( JEMALLOC_HOME )
     list( APPEND _jemalloc_roots ${JEMALLOC_HOME} )