parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject parquet-cpp git commit: PARQUET-955: Only look for Arrow pkgconfig if ARROW_HOME is not set in environment
Date Sun, 16 Apr 2017 17:34:35 GMT
Repository: parquet-cpp
Updated Branches:
  refs/heads/master b89cbad30 -> 38e95ccde


PARQUET-955: Only look for Arrow pkgconfig if ARROW_HOME is not set in environment

cc @kou

Ran into this when testing out https://github.com/apache/arrow/pull/548

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #298 from wesm/PARQUET-955 and squashes the following commits:

ab96f03 [Wes McKinney] Rearrange logic to make more clear
a29cc57 [Wes McKinney] Remove redundant env variable check
1960fb3 [Wes McKinney] Print Arrow include dir in FindArrow.cmake
970f0c5 [Wes McKinney] Move pkgconfig logic into FindArrow.cmake
92e7c70 [Wes McKinney] Only look for Arrow pkgconfig if ARROW_HOME is not set in 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/38e95ccd
Tree: http://git-wip-us.apache.org/repos/asf/parquet-cpp/tree/38e95ccd
Diff: http://git-wip-us.apache.org/repos/asf/parquet-cpp/diff/38e95ccd

Branch: refs/heads/master
Commit: 38e95ccdefc8b3e46d7df1360abd39672e4468f9
Parents: b89cbad
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Sun Apr 16 13:34:28 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Sun Apr 16 13:34:28 2017 -0400

----------------------------------------------------------------------
 cmake_modules/FindArrow.cmake           | 84 ++++++++++++++++++----------
 cmake_modules/ThirdpartyToolchain.cmake | 24 +-------
 2 files changed, 55 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/38e95ccd/cmake_modules/FindArrow.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/FindArrow.cmake b/cmake_modules/FindArrow.cmake
index c3f835b..d5e11d1 100644
--- a/cmake_modules/FindArrow.cmake
+++ b/cmake_modules/FindArrow.cmake
@@ -18,52 +18,78 @@
 # - Find ARROW (arrow/api.h, libarrow.a, libarrow.so)
 # This module defines
 #  ARROW_INCLUDE_DIR, directory containing headers
-#  ARROW_LIBS, directory containing arrow libraries
 #  ARROW_STATIC_LIB, path to libarrow.a
 #  ARROW_SHARED_LIB, path to libarrow's shared library
 #  ARROW_FOUND, whether arrow has been found
 
-if( NOT "$ENV{ARROW_HOME}" STREQUAL "")
+if ("$ENV{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)
+  if (ARROW_FOUND)
+    # We found the pkgconfig
+    set(ARROW_INCLUDE_DIR ${ARROW_INCLUDE_DIRS})
+
+    if (COMMAND pkg_get_variable)
+      pkg_get_variable(ARROW_ABI_VERSION arrow abi_version)
+    else()
+      set(ARROW_ABI_VERSION "")
+    endif()
+    if (ARROW_ABI_VERSION STREQUAL "")
+      set(ARROW_SHARED_LIB_SUFFIX "")
+    else()
+      set(ARROW_SHARED_LIB_SUFFIX ".${ARROW_ABI_VERSION}")
+    endif()
+
+    set(ARROW_LIB_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}arrow)
+
+    set(ARROW_SHARED_LIB ${ARROW_LIBDIR}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}${ARROW_SHARED_LIB_SUFFIX})
+    set(ARROW_STATIC_LIB ${ARROW_LIBDIR}/${ARROW_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
+  endif()
+else()
   set(ARROW_HOME "$ENV{ARROW_HOME}")
-endif()
 
-set(ARROW_SEARCH_HEADER_PATHS
-  ${ARROW_HOME}/include
-)
+  set(ARROW_SEARCH_HEADER_PATHS
+    ${ARROW_HOME}/include
+    )
 
-set(ARROW_SEARCH_LIB_PATH
-  ${ARROW_HOME}/lib
-)
+  set(ARROW_SEARCH_LIB_PATH
+    ${ARROW_HOME}/lib
+    )
 
-find_path(ARROW_INCLUDE_DIR arrow/array.h PATHS
-  ${ARROW_SEARCH_HEADER_PATHS}
-  # make sure we don't accidentally pick up a different version
-  NO_DEFAULT_PATH
-)
+  find_path(ARROW_INCLUDE_DIR arrow/array.h PATHS
+    ${ARROW_SEARCH_HEADER_PATHS}
+    # make sure we don't accidentally pick up a different version
+    NO_DEFAULT_PATH
+    )
 
-find_library(ARROW_LIB_PATH NAMES arrow
-  PATHS
-  ${ARROW_SEARCH_LIB_PATH}
-  NO_DEFAULT_PATH)
+  find_library(ARROW_LIB_PATH NAMES arrow
+    PATHS
+    ${ARROW_SEARCH_LIB_PATH}
+    NO_DEFAULT_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)
+  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)
 
-  get_filename_component(ARROW_LIBS ${ARROW_LIB_PATH} DIRECTORY)
-  set(ARROW_STATIC_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}.a)
-  set(ARROW_SHARED_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
+    get_filename_component(ARROW_LIBS ${ARROW_LIB_PATH} DIRECTORY)
+    set(ARROW_STATIC_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}.a)
+    set(ARROW_SHARED_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
+  endif ()
+endif()
 
+if (ARROW_FOUND)
   if (NOT Arrow_FIND_QUIETLY)
+    message(STATUS "Arrow include path: ${ARROW_INCLUDE_DIR}")
     if (PARQUET_MINIMAL_DEPENDENCY)
       message(STATUS "Found the Arrow header: ${ARROW_HEADER}")
     else ()
       message(STATUS "Found the Arrow library: ${ARROW_LIB_PATH}")
     endif ()
   endif ()
-else ()
+else()
   if (NOT Arrow_FIND_QUIETLY)
     set(ARROW_ERR_MSG "Could not find the Arrow library. Looked for headers")
     set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_HEADER_PATHS}, and for libs")
@@ -74,13 +100,11 @@ else ()
       message(STATUS "${ARROW_ERR_MSG}")
     endif (Arrow_FIND_REQUIRED)
   endif ()
-  set(ARROW_FOUND FALSE)
-endif ()
+endif()
 
 mark_as_advanced(
   ARROW_FOUND
   ARROW_INCLUDE_DIR
-  ARROW_LIBS
   ARROW_STATIC_LIB
   ARROW_SHARED_LIB
 )

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/38e95ccd/cmake_modules/ThirdpartyToolchain.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index 349be7d..83aa1cc 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -357,29 +357,7 @@ if(PARQUET_BUILD_BENCHMARKS AND NOT IGNORE_OPTIONAL_PACKAGES)
 endif()
 
 ## Apache Arrow
-pkg_check_modules(ARROW arrow)
-if (ARROW_FOUND)
-  set(ARROW_INCLUDE_DIR ${ARROW_INCLUDE_DIRS})
-
-  if (COMMAND pkg_get_variable)
-    pkg_get_variable(ARROW_ABI_VERSION arrow abi_version)
-  else()
-    set(ARROW_ABI_VERSION "")
-  endif()
-  if (ARROW_ABI_VERSION STREQUAL "")
-    set(ARROW_SHARED_LIB_SUFFIX "")
-  else()
-    set(ARROW_SHARED_LIB_SUFFIX ".${ARROW_ABI_VERSION}")
-  endif()
-
-  set(ARROW_LIB_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}arrow)
-
-  set(ARROW_SHARED_LIB ${ARROW_LIBDIR}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}${ARROW_SHARED_LIB_SUFFIX})
-  set(ARROW_STATIC_LIB ${ARROW_LIBDIR}/${ARROW_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
-
-else()
-  find_package(Arrow)
-endif()
+find_package(Arrow)
 if (NOT ARROW_FOUND)
   set(ARROW_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/arrow_ep/src/arrow_ep-install")
   set(ARROW_HOME "${ARROW_PREFIX}")


Mime
View raw message