You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by uw...@apache.org on 2018/04/09 07:31:22 UTC
[arrow] branch master updated: ARROW-2416: [C++] Support system
libprotobuf
This is an automated email from the ASF dual-hosted git repository.
uwe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 408aa5a ARROW-2416: [C++] Support system libprotobuf
408aa5a is described below
commit 408aa5a699887e24181abcde01c86ba09982013a
Author: Kouhei Sutou <ko...@clear-code.com>
AuthorDate: Mon Apr 9 09:24:07 2018 +0200
ARROW-2416: [C++] Support system libprotobuf
Author: Kouhei Sutou <ko...@clear-code.com>
Closes #1854 from kou/cpp-system-protobuf and squashes the following commits:
25d3d34 <Kouhei Sutou> Support system libprotobuf
---
cpp/CMakeLists.txt | 18 ++++++++++++++++--
cpp/cmake_modules/FindProtobuf.cmake | 16 ++++++++++++++--
cpp/cmake_modules/ThirdpartyToolchain.cmake | 9 +++++++--
3 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index a61bcad..b913685 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -139,6 +139,10 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
"Use vendored Boost instead of existing Boost"
OFF)
+ option(ARROW_PROTOBUF_USE_SHARED
+ "Rely on Protocol Buffers shared libraries where relevant"
+ OFF)
+
option(ARROW_PYTHON
"Build the Arrow CPython extensions"
OFF)
@@ -531,6 +535,7 @@ endif(UNIX)
# Linker and Dependencies
############################################################
+set(ARROW_LINK_LIBS)
set(ARROW_STATIC_LINK_LIBS)
if (ARROW_WITH_BROTLI)
@@ -568,8 +573,16 @@ endif()
if (ARROW_ORC)
SET(ARROW_STATIC_LINK_LIBS
orc
- protobuf
${ARROW_STATIC_LINK_LIBS})
+ if (ARROW_PROTOBUF_USE_SHARED)
+ SET(ARROW_LINK_LIBS
+ protobuf
+ ${ARROW_LINK_LIBS})
+ else()
+ SET(ARROW_STATIC_LINK_LIBS
+ protobuf
+ ${ARROW_STATIC_LINK_LIBS})
+ endif()
endif()
if (ARROW_STATIC_LINK_LIBS)
@@ -583,7 +596,8 @@ set(ARROW_BENCHMARK_LINK_LIBS
${ARROW_STATIC_LINK_LIBS})
set(ARROW_LINK_LIBS
- ${ARROW_STATIC_LINK_LIBS})
+ ${ARROW_STATIC_LINK_LIBS}
+ ${ARROW_LINK_LIBS})
set(ARROW_SHARED_PRIVATE_LINK_LIBS
${BOOST_SYSTEM_LIBRARY}
diff --git a/cpp/cmake_modules/FindProtobuf.cmake b/cpp/cmake_modules/FindProtobuf.cmake
index a42f449..9591bd1 100644
--- a/cpp/cmake_modules/FindProtobuf.cmake
+++ b/cpp/cmake_modules/FindProtobuf.cmake
@@ -36,15 +36,23 @@ find_path (PROTOBUF_INCLUDE_DIR google/protobuf/io/coded_stream.h HINTS
NO_DEFAULT_PATH
PATH_SUFFIXES "include")
+set (lib_dirs "lib")
+if (EXISTS "${_protobuf_path}/lib64")
+ set (lib_dirs "lib64" ${lib_dirs})
+endif ()
+if (EXISTS "${_protobuf_path}/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+ set (lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}" ${lib_dirs})
+endif ()
+
find_library (PROTOBUF_LIBRARY NAMES protobuf PATHS
${_protobuf_path}
NO_DEFAULT_PATH
- PATH_SUFFIXES "lib")
+ PATH_SUFFIXES ${lib_dirs})
find_library (PROTOC_LIBRARY NAMES protoc PATHS
${_protobuf_path}
NO_DEFAULT_PATH
- PATH_SUFFIXES "lib")
+ PATH_SUFFIXES ${lib_dirs})
find_program(PROTOBUF_EXECUTABLE protoc HINTS
${_protobuf_path}
@@ -53,6 +61,8 @@ find_program(PROTOBUF_EXECUTABLE protoc HINTS
if (PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARY AND PROTOC_LIBRARY AND PROTOBUF_EXECUTABLE)
set (PROTOBUF_FOUND TRUE)
+ set (PROTOBUF_SHARED_LIB ${PROTOBUF_LIBRARY})
+ set (PROTOC_SHARED_LIB ${PROTOC_LIBRARY})
get_filename_component (PROTOBUF_LIBS ${PROTOBUF_LIBRARY} PATH)
set (PROTOBUF_LIB_NAME protobuf)
set (PROTOC_LIB_NAME protoc)
@@ -64,7 +74,9 @@ endif ()
if (PROTOBUF_FOUND)
message (STATUS "Found the Protobuf headers: ${PROTOBUF_INCLUDE_DIR}")
+ message (STATUS "Found the Protobuf shared library: ${PROTOBUF_SHARED_LIB}")
message (STATUS "Found the Protobuf library: ${PROTOBUF_STATIC_LIB}")
+ message (STATUS "Found the Protoc shared library: ${PROTOC_SHARED_LIB}")
message (STATUS "Found the Protoc library: ${PROTOC_STATIC_LIB}")
message (STATUS "Found the Protoc executable: ${PROTOBUF_EXECUTABLE}")
else()
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index be9d55c..129174c 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -915,8 +915,13 @@ if (ARROW_ORC)
endif ()
include_directories (SYSTEM ${PROTOBUF_INCLUDE_DIR})
- ADD_THIRDPARTY_LIB(protobuf
- STATIC_LIB ${PROTOBUF_STATIC_LIB})
+ if (ARROW_PROTOBUF_USE_SHARED)
+ ADD_THIRDPARTY_LIB(protobuf
+ SHARED_LIB ${PROTOBUF_LIBRARY})
+ else ()
+ ADD_THIRDPARTY_LIB(protobuf
+ STATIC_LIB ${PROTOBUF_STATIC_LIB})
+ endif ()
if (PROTOBUF_VENDORED)
add_dependencies (protobuf protobuf_ep)
--
To stop receiving notification emails like this one, please contact
uwe@apache.org.