arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-1303: [C++] Support downloading Boost
Date Wed, 02 Aug 2017 15:44:45 GMT
Repository: arrow
Updated Branches:
  refs/heads/master e50b6ae5c -> b95bed050


ARROW-1303: [C++] Support downloading Boost

CentOS 6 ships old Boost. If we support downloading Boost, we'll build
RPM for CentOS 6 easily.

Author: Kouhei Sutou <kou@clear-code.com>

Closes #927 from kou/cpp-boost-download and squashes the following commits:

5bf6818 [Kouhei Sutou] [C++] Always use static link for vendored Boost
832673d [Kouhei Sutou] [C++] Add ARROW_BOOST_VENDORED option
290e6e1 [Kouhei Sutou] [C++] Support downloading Boost


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

Branch: refs/heads/master
Commit: b95bed050c6d5d0943fd7866cfdade7fd9cc4904
Parents: e50b6ae
Author: Kouhei Sutou <kou@clear-code.com>
Authored: Wed Aug 2 11:44:40 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Wed Aug 2 11:44:40 2017 -0400

----------------------------------------------------------------------
 cpp/CMakeLists.txt                          |   4 +
 cpp/cmake_modules/ThirdpartyToolchain.cmake | 118 ++++++++++++++++-------
 2 files changed, 88 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/b95bed05/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 07b8e15..eeff912 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -114,6 +114,10 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
     "Rely on boost shared libraries where relevant"
     ON)
 
+  option(ARROW_BOOST_VENDORED
+    "Use vendored Boost instead of existing Boost"
+    OFF)
+
   option(ARROW_PYTHON
     "Build the Arrow CPython extensions"
     OFF)

http://git-wip-us.apache.org/repos/asf/arrow/blob/b95bed05/cpp/cmake_modules/ThirdpartyToolchain.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 1271b8a..ae48e8d 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -124,50 +124,100 @@ set(Boost_ADDITIONAL_VERSIONS
   "1.62.0" "1.61"
   "1.61.0" "1.62"
   "1.60.0" "1.60")
-
-if (ARROW_BOOST_USE_SHARED)
-  # Find shared Boost libraries.
-  set(Boost_USE_STATIC_LIBS OFF)
-
-  if(MSVC)
-    # disable autolinking in boost
-    add_definitions(-DBOOST_ALL_NO_LIB)
-
-    # force all boost libraries to dynamic link
-    add_definitions(-DBOOST_ALL_DYN_LINK)
-  endif()
-
+list(GET Boost_ADDITIONAL_VERSIONS 0 BOOST_LATEST_VERSION)
+string(REPLACE "." "_" BOOST_LATEST_VERSION_IN_PATH ${BOOST_LATEST_VERSION})
+set(BOOST_LATEST_URL
+  "https://dl.bintray.com/boostorg/release/${BOOST_LATEST_VERSION}/source/boost_${BOOST_LATEST_VERSION_IN_PATH}.tar.gz")
+
+if (ARROW_BOOST_VENDORED)
+  set(BOOST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/boost_ep-prefix/src/boost_ep")
+  set(BOOST_LIB_DIR "${BOOST_PREFIX}/stage/lib")
+  set(BOOST_BUILD_LINK "static")
+  set(BOOST_STATIC_SYSTEM_LIBRARY
+    "${BOOST_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}boost_system${CMAKE_STATIC_LIBRARY_SUFFIX}")
+  set(BOOST_STATIC_FILESYSTEM_LIBRARY
+    "${BOOST_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}boost_filesystem${CMAKE_STATIC_LIBRARY_SUFFIX}")
+  set(BOOST_SYSTEM_LIBRARY "${BOOST_STATIC_SYSTEM_LIBRARY}")
+  set(BOOST_FILESYSTEM_LIBRARY "${BOOST_STATIC_FILESYSTEM_LIBRARY}")
   if (ARROW_BOOST_HEADER_ONLY)
-    find_package(Boost)
+    set(BOOST_BUILD_PRODUCTS)
+    set(BOOST_CONFIGURE_COMMAND "")
+    set(BOOST_BUILD_COMMAND "")
   else()
-    find_package(Boost COMPONENTS system filesystem REQUIRED)
+    set(BOOST_BUILD_PRODUCTS
+      ${BOOST_SYSTEM_LIBRARY}
+      ${BOOST_FILESYSTEM_LIBRARY})
+    set(BOOST_CONFIGURE_COMMAND
+      "./bootstrap.sh"
+      "--prefix=${BOOST_PREFIX}"
+      "--with-libraries=filesystem,system")
     if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
-      set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
-      set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG})
+      set(BOOST_BUILD_VARIANT "debug")
     else()
-      set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
-      set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE})
+      set(BOOST_BUILD_VARIANT "release")
     endif()
-    set(BOOST_SYSTEM_LIBRARY boost_system_shared)
-    set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_shared)
+    set(BOOST_BUILD_COMMAND
+      "./b2"
+      "link=${BOOST_BUILD_LINK}"
+      "variant=${BOOST_BUILD_VARIANT}"
+      "cxxflags=-fPIC")
   endif()
+  ExternalProject_Add(boost_ep
+    URL ${BOOST_LATEST_URL}
+    BUILD_BYPRODUCTS ${BOOST_BUILD_PRODUCTS}
+    BUILD_IN_SOURCE 1
+    CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND}
+    BUILD_COMMAND ${BOOST_BUILD_COMMAND}
+    INSTALL_COMMAND ""
+    ${EP_LOG_OPTIONS})
+  set(Boost_INCLUDE_DIR "${BOOST_PREFIX}")
+  set(Boost_INCLUDE_DIRS "${BOOST_INCLUDE_DIR}")
+  add_dependencies(arrow_dependencies boost_ep)
 else()
-  # Find static boost headers and libs
-  # TODO Differentiate here between release and debug builds
-  set(Boost_USE_STATIC_LIBS ON)
-  if (ARROW_BOOST_HEADER_ONLY)
-    find_package(Boost)
+  if (ARROW_BOOST_USE_SHARED)
+    # Find shared Boost libraries.
+    set(Boost_USE_STATIC_LIBS OFF)
+
+    if(MSVC)
+      # disable autolinking in boost
+      add_definitions(-DBOOST_ALL_NO_LIB)
+
+      # force all boost libraries to dynamic link
+      add_definitions(-DBOOST_ALL_DYN_LINK)
+    endif()
+
+    if (ARROW_BOOST_HEADER_ONLY)
+      find_package(Boost REQUIRED)
+    else()
+      find_package(Boost COMPONENTS system filesystem REQUIRED)
+      if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
+	set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
+	set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG})
+      else()
+	set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
+	set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE})
+      endif()
+      set(BOOST_SYSTEM_LIBRARY boost_system_shared)
+      set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_shared)
+    endif()
   else()
-    find_package(Boost COMPONENTS system filesystem REQUIRED)
-    if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
-      set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
-      set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG})
+    # Find static boost headers and libs
+    # TODO Differentiate here between release and debug builds
+    set(Boost_USE_STATIC_LIBS ON)
+    if (ARROW_BOOST_HEADER_ONLY)
+      find_package(Boost REQUIRED)
     else()
-      set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
-      set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE})
+      find_package(Boost COMPONENTS system filesystem REQUIRED)
+      if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
+	set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
+	set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG})
+      else()
+	set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
+	set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE})
+      endif()
+      set(BOOST_SYSTEM_LIBRARY boost_system_static)
+      set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_static)
     endif()
-    set(BOOST_SYSTEM_LIBRARY boost_system_static)
-    set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_static)
   endif()
 endif()
 


Mime
View raw message