forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port over compression toolchain and interfaces from parquet-cpp, adap…
…t to Arrow-style error handling Change-Id: I7db868884ba173c2c0c3cac0148bd5c218a52db7
- Loading branch information
Showing
13 changed files
with
1,648 additions
and
446 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# | ||
# 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. | ||
# | ||
# Tries to find Brotli headers and libraries. | ||
# | ||
# Usage of this module as follows: | ||
# | ||
# find_package(Brotli) | ||
# | ||
# Variables used by this module, they can change the default behaviour and need | ||
# to be set before calling find_package: | ||
# | ||
# Brotli_HOME - When set, this path is inspected instead of standard library | ||
# locations as the root of the Brotli installation. | ||
# The environment variable BROTLI_HOME overrides this veriable. | ||
# | ||
# This module defines | ||
# BROTLI_INCLUDE_DIR, directory containing headers | ||
# BROTLI_LIBS, directory containing brotli libraries | ||
# BROTLI_STATIC_LIB, path to libbrotli.a | ||
# BROTLI_SHARED_LIB, path to libbrotli's shared library | ||
# BROTLI_FOUND, whether brotli has been found | ||
|
||
if( NOT "${BROTLI_HOME}" STREQUAL "") | ||
file( TO_CMAKE_PATH "${BROTLI_HOME}" _native_path ) | ||
list( APPEND _brotli_roots ${_native_path} ) | ||
elseif ( Brotli_HOME ) | ||
list( APPEND _brotli_roots ${Brotli_HOME} ) | ||
endif() | ||
|
||
find_path( BROTLI_INCLUDE_DIR NAMES brotli/decode.h | ||
PATHS ${_brotli_roots} | ||
NO_DEFAULT_PATH | ||
PATH_SUFFIXES "include" ) | ||
|
||
find_library( BROTLI_LIBRARY_ENC NAMES libbrotlienc.a brotlienc | ||
PATHS ${_brotli_roots} | ||
NO_DEFAULT_PATH | ||
PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib" ) | ||
|
||
find_library( BROTLI_LIBRARY_DEC NAMES libbrotlidec.a brotlidec | ||
PATHS ${_brotli_roots} | ||
NO_DEFAULT_PATH | ||
PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib" ) | ||
|
||
find_library( BROTLI_LIBRARY_COMMON NAMES libbrotlicommon.a brotlicommon | ||
PATHS ${_brotli_roots} | ||
NO_DEFAULT_PATH | ||
PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib" ) | ||
|
||
set(BROTLI_LIBRARIES ${BROTLI_LIBRARY_ENC} ${BROTLI_LIBRARY_DEC} | ||
${BROTLI_LIBRARY_COMMON}) | ||
|
||
if (BROTLI_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR BROTLI_LIBRARIES)) | ||
set(BROTLI_FOUND TRUE) | ||
get_filename_component( BROTLI_LIBS ${BROTLI_LIBRARY_ENC} PATH ) | ||
set(BROTLI_LIB_NAME brotli) | ||
if (MSVC AND NOT BROTLI_MSVC_STATIC_LIB_SUFFIX) | ||
set(BROTLI_MSVC_STATIC_LIB_SUFFIX _static) | ||
endif() | ||
set(BROTLI_STATIC_LIB | ||
${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}enc${BROTLI_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} | ||
${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}dec${BROTLI_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} | ||
${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}common${BROTLI_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
set(BROTLI_STATIC_LIBRARY_ENC ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}enc${BROTLI_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
set(BROTLI_STATIC_LIBRARY_DEC ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}dec${BROTLI_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
set(BROTLI_STATIC_LIBRARY_COMMON ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}common${BROTLI_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
set(BROTLI_SHARED_LIB | ||
${BROTLI_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${BROTLI_LIB_NAME}enc${CMAKE_SHARED_LIBRARY_SUFFIX} | ||
${BROTLI_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${BROTLI_LIB_NAME}dec${CMAKE_SHARED_LIBRARY_SUFFIX} | ||
${BROTLI_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${BROTLI_LIB_NAME}common${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
else () | ||
set(BROTLI_FOUND FALSE) | ||
endif () | ||
|
||
if (BROTLI_FOUND) | ||
if (NOT Brotli_FIND_QUIETLY) | ||
if (PARQUET_MINIMAL_DEPENDENCY) | ||
message(STATUS "Found the Brotli headers: ${BROTLI_INCLUDE_DIR}") | ||
else () | ||
message(STATUS "Found the Brotli library: ${BROTLI_LIBRARIES}") | ||
endif () | ||
endif () | ||
else () | ||
if (NOT Brotli_FIND_QUIETLY) | ||
set(BROTLI_ERR_MSG "Could not find the Brotli library. Looked in ") | ||
if ( _brotli_roots ) | ||
set(BROTLI_ERR_MSG "${BROTLI_ERR_MSG} in ${_brotli_roots}.") | ||
else () | ||
set(BROTLI_ERR_MSG "${BROTLI_ERR_MSG} system search paths.") | ||
endif () | ||
if (Brotli_FIND_REQUIRED) | ||
message(FATAL_ERROR "${BROTLI_ERR_MSG}") | ||
else (Brotli_FIND_REQUIRED) | ||
message(STATUS "${BROTLI_ERR_MSG}") | ||
endif (Brotli_FIND_REQUIRED) | ||
endif () | ||
endif () | ||
|
||
mark_as_advanced( | ||
BROTLI_INCLUDE_DIR | ||
BROTLI_LIBS | ||
BROTLI_LIBRARIES | ||
BROTLI_STATIC_LIB | ||
BROTLI_SHARED_LIB | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# | ||
# 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. | ||
# | ||
# Tries to find Snappy headers and libraries. | ||
# | ||
# Usage of this module as follows: | ||
# | ||
# find_package(Snappy) | ||
# | ||
# Variables used by this module, they can change the default behaviour and need | ||
# to be set before calling find_package: | ||
# | ||
# Snappy_HOME - When set, this path is inspected instead of standard library | ||
# locations as the root of the Snappy installation. | ||
# The environment variable SNAPPY_HOME overrides this variable. | ||
# | ||
# This module defines | ||
# SNAPPY_INCLUDE_DIR, directory containing headers | ||
# SNAPPY_LIBS, directory containing snappy libraries | ||
# SNAPPY_STATIC_LIB, path to libsnappy.a | ||
# SNAPPY_SHARED_LIB, path to libsnappy's shared library | ||
# SNAPPY_FOUND, whether snappy has been found | ||
|
||
if( NOT "${SNAPPY_HOME}" STREQUAL "") | ||
file( TO_CMAKE_PATH "${SNAPPY_HOME}" _native_path ) | ||
list( APPEND _snappy_roots ${_native_path} ) | ||
elseif ( Snappy_HOME ) | ||
list( APPEND _snappy_roots ${Snappy_HOME} ) | ||
endif() | ||
|
||
message(STATUS "SNAPPY_HOME: ${SNAPPY_HOME}") | ||
find_path(SNAPPY_INCLUDE_DIR snappy.h HINTS | ||
${_snappy_roots} | ||
NO_DEFAULT_PATH | ||
PATH_SUFFIXES "include") | ||
|
||
find_library( SNAPPY_LIBRARIES NAMES snappy PATHS | ||
${_snappy_roots} | ||
NO_DEFAULT_PATH | ||
PATH_SUFFIXES "lib") | ||
|
||
if (SNAPPY_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR SNAPPY_LIBRARIES)) | ||
set(SNAPPY_FOUND TRUE) | ||
get_filename_component( SNAPPY_LIBS ${SNAPPY_LIBRARIES} PATH ) | ||
set(SNAPPY_HEADER_NAME snappy.h) | ||
set(SNAPPY_HEADER ${SNAPPY_INCLUDE_DIR}/${SNAPPY_HEADER_NAME}) | ||
set(SNAPPY_LIB_NAME snappy) | ||
set(SNAPPY_STATIC_LIB ${SNAPPY_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_LIB_NAME}${SNAPPY_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
set(SNAPPY_SHARED_LIB ${SNAPPY_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${SNAPPY_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
else () | ||
set(SNAPPY_FOUND FALSE) | ||
endif () | ||
|
||
if (SNAPPY_FOUND) | ||
if (NOT Snappy_FIND_QUIETLY) | ||
if (PARQUET_MINIMAL_DEPENDENCY) | ||
message(STATUS "Found the Snappy header: ${SNAPPY_HEADER}") | ||
else () | ||
message(STATUS "Found the Snappy library: ${SNAPPY_LIBRARIES}") | ||
endif () | ||
endif () | ||
else () | ||
if (NOT Snappy_FIND_QUIETLY) | ||
set(SNAPPY_ERR_MSG "Could not find the Snappy library. Looked in ") | ||
if ( _snappy_roots ) | ||
set(SNAPPY_ERR_MSG "${SNAPPY_ERR_MSG} in ${_snappy_roots}.") | ||
else () | ||
set(SNAPPY_ERR_MSG "${SNAPPY_ERR_MSG} system search paths.") | ||
endif () | ||
if (Snappy_FIND_REQUIRED) | ||
message(FATAL_ERROR "${SNAPPY_ERR_MSG}") | ||
else (Snappy_FIND_REQUIRED) | ||
message(STATUS "${SNAPPY_ERR_MSG}") | ||
endif (Snappy_FIND_REQUIRED) | ||
endif () | ||
endif () | ||
|
||
mark_as_advanced( | ||
SNAPPY_INCLUDE_DIR | ||
SNAPPY_LIBS | ||
SNAPPY_LIBRARIES | ||
SNAPPY_STATIC_LIB | ||
SNAPPY_SHARED_LIB | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# | ||
# 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. | ||
# | ||
# Tries to find ZLIB headers and libraries. | ||
# | ||
# Usage of this module as follows: | ||
# | ||
# find_package(ZLIB) | ||
# | ||
# Variables used by this module, they can change the default behaviour and need | ||
# to be set before calling find_package: | ||
# | ||
# ZLIB_HOME - When set, this path is inspected instead of standard library | ||
# locations as the root of the ZLIB installation. | ||
# The environment variable ZLIB_HOME overrides this variable. | ||
# | ||
# - Find ZLIB (zlib.h, libz.a, libz.so, and libz.so.1) | ||
# This module defines | ||
# ZLIB_INCLUDE_DIR, directory containing headers | ||
# ZLIB_LIBS, directory containing zlib libraries | ||
# ZLIB_STATIC_LIB, path to libz.a | ||
# ZLIB_SHARED_LIB, path to libz's shared library | ||
# ZLIB_FOUND, whether zlib has been found | ||
|
||
if( NOT "${ZLIB_HOME}" STREQUAL "") | ||
file( TO_CMAKE_PATH "${ZLIB_HOME}" _native_path ) | ||
list( APPEND _zlib_roots ${_native_path} ) | ||
elseif ( ZLIB_HOME ) | ||
list( APPEND _zlib_roots ${ZLIB_HOME} ) | ||
endif() | ||
|
||
# Try the parameterized roots, if they exist | ||
if ( _zlib_roots ) | ||
find_path( ZLIB_INCLUDE_DIR NAMES zlib.h | ||
PATHS ${_zlib_roots} NO_DEFAULT_PATH | ||
PATH_SUFFIXES "include" ) | ||
find_library( ZLIB_LIBRARIES NAMES libz.a zlib | ||
PATHS ${_zlib_roots} NO_DEFAULT_PATH | ||
PATH_SUFFIXES "lib" ) | ||
else () | ||
find_path( ZLIB_INCLUDE_DIR NAMES zlib.h ) | ||
# Only look for the static library | ||
find_library( ZLIB_LIBRARIES NAMES libz.a zlib ) | ||
endif () | ||
|
||
|
||
if (ZLIB_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR ZLIB_LIBRARIES)) | ||
set(ZLIB_FOUND TRUE) | ||
get_filename_component( ZLIB_LIBS ${ZLIB_LIBRARIES} PATH ) | ||
set(ZLIB_HEADER_NAME zlib.h) | ||
set(ZLIB_HEADER ${ZLIB_INCLUDE_DIR}/${ZLIB_HEADER_NAME}) | ||
set(ZLIB_LIB_NAME z) | ||
if (MSVC) | ||
if (NOT ZLIB_MSVC_STATIC_LIB_SUFFIX) | ||
set(ZLIB_MSVC_STATIC_LIB_SUFFIX libstatic) | ||
endif() | ||
set(ZLIB_MSVC_SHARED_LIB_SUFFIX lib) | ||
endif() | ||
set(ZLIB_STATIC_LIB ${ZLIB_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${ZLIB_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
set(ZLIB_SHARED_LIB ${ZLIB_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${ZLIB_MSVC_SHARED_LIB_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
else () | ||
set(ZLIB_FOUND FALSE) | ||
endif () | ||
|
||
if (ZLIB_FOUND) | ||
if (NOT ZLIB_FIND_QUIETLY) | ||
if (PARQUET_MINIMAL_DEPENDENCY) | ||
message(STATUS "Found the ZLIB header: ${ZLIB_HEADER}") | ||
else() | ||
message(STATUS "Found the ZLIB library: ${ZLIB_LIBRARIES}") | ||
endif () | ||
endif () | ||
else () | ||
if (NOT ZLIB_FIND_QUIETLY) | ||
set(ZLIB_ERR_MSG "Could not find the ZLIB library. Looked in ") | ||
if ( _zlib_roots ) | ||
set(ZLIB_ERR_MSG "${ZLIB_ERR_MSG} in ${_zlib_roots}.") | ||
else () | ||
set(ZLIB_ERR_MSG "${ZLIB_ERR_MSG} system search paths.") | ||
endif () | ||
if (ZLIB_FIND_REQUIRED) | ||
message(FATAL_ERROR "${ZLIB_ERR_MSG}") | ||
else (ZLIB_FIND_REQUIRED) | ||
message(STATUS "${ZLIB_ERR_MSG}") | ||
endif (ZLIB_FIND_REQUIRED) | ||
endif () | ||
endif () | ||
|
||
mark_as_advanced( | ||
ZLIB_INCLUDE_DIR | ||
ZLIB_LIBS | ||
ZLIB_LIBRARIES | ||
ZLIB_STATIC_LIB | ||
ZLIB_SHARED_LIB | ||
) |
Oops, something went wrong.