Skip to content

Commit

Permalink
Also search for Parquet in PyArrow
Browse files Browse the repository at this point in the history
  • Loading branch information
xhochy committed Jun 4, 2016
1 parent 6a41d23 commit cd3b9a9
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ if (PYARROW_BUILD_TESTS)
STATIC_LIB ${GTEST_STATIC_LIB})
endif()

## Parquet
find_package(Parquet REQUIRED)
include_directories(SYSTEM ${PARQUET_INCLUDE_DIR})

## Arrow
find_package(Arrow REQUIRED)
include_directories(SYSTEM ${ARROW_INCLUDE_DIR})
Expand Down
80 changes: 80 additions & 0 deletions python/cmake_modules/FindParquet.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright 2012 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# - Find PARQUET (parquet/parquet.h, libparquet.a, libparquet.so)
# This module defines
# PARQUET_INCLUDE_DIR, directory containing headers
# PARQUET_LIBS, directory containing parquet libraries
# PARQUET_STATIC_LIB, path to libparquet.a
# PARQUET_SHARED_LIB, path to libparquet's shared library
# PARQUET_FOUND, whether parquet has been found

if( NOT "$ENV{PARQUET_HOME}" STREQUAL "")
file( TO_CMAKE_PATH "$ENV{PARQUET_HOME}" _native_path )
list( APPEND _parquet_roots ${_native_path} )
elseif ( Parquet_HOME )
list( APPEND _parquet_roots ${Parquet_HOME} )
endif()

# Try the parameterized roots, if they exist
if ( _parquet_roots )
find_path( PARQUET_INCLUDE_DIR NAMES parquet/api/reader.h
PATHS ${_parquet_roots} NO_DEFAULT_PATH
PATH_SUFFIXES "include" )
find_library( PARQUET_LIBRARIES NAMES parquet
PATHS ${_parquet_roots} NO_DEFAULT_PATH
PATH_SUFFIXES "lib" )
else ()
find_path( PARQUET_INCLUDE_DIR NAMES parquet/api/reader.h )
find_library( PARQUET_LIBRARIES NAMES parquet )
endif ()


if (PARQUET_INCLUDE_DIR AND PARQUET_LIBRARIES)
set(PARQUET_FOUND TRUE)
get_filename_component( PARQUET_LIBS ${PARQUET_LIBRARIES} PATH )
set(PARQUET_LIB_NAME libparquet)
set(PARQUET_STATIC_LIB ${PARQUET_LIBS}/${PARQUET_LIB_NAME}.a)
set(PARQUET_SHARED_LIB ${PARQUET_LIBS}/${PARQUET_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
else ()
set(PARQUET_FOUND FALSE)
endif ()

if (PARQUET_FOUND)
if (NOT Parquet_FIND_QUIETLY)
message(STATUS "Found the Parquet library: ${PARQUET_LIBRARIES}")
endif ()
else ()
if (NOT Parquet_FIND_QUIETLY)
set(PARQUET_ERR_MSG "Could not find the Parquet library. Looked in ")
if ( _parquet_roots )
set(PARQUET_ERR_MSG "${PARQUET_ERR_MSG} in ${_parquet_roots}.")
else ()
set(PARQUET_ERR_MSG "${PARQUET_ERR_MSG} system search paths.")
endif ()
if (Parquet_FIND_REQUIRED)
message(FATAL_ERROR "${PARQUET_ERR_MSG}")
else (Parquet_FIND_REQUIRED)
message(STATUS "${PARQUET_ERR_MSG}")
endif (Parquet_FIND_REQUIRED)
endif ()
endif ()

mark_as_advanced(
PARQUET_INCLUDE_DIR
PARQUET_LIBS
PARQUET_LIBRARIES
PARQUET_STATIC_LIB
PARQUET_SHARED_LIB
)

0 comments on commit cd3b9a9

Please sign in to comment.