Remove unbundled bzip2 support

This commit is contained in:
Azat Khuzhin 2022-01-16 13:55:08 +03:00
parent 6fadf4c66f
commit a752e12df9
7 changed files with 21 additions and 32 deletions

View File

@ -533,7 +533,6 @@ include (cmake/find/nuraft.cmake)
include (cmake/find/yaml-cpp.cmake) include (cmake/find/yaml-cpp.cmake)
include (cmake/find/s2geometry.cmake) include (cmake/find/s2geometry.cmake)
include (cmake/find/nlp.cmake) include (cmake/find/nlp.cmake)
include (cmake/find/bzip2.cmake)
include (cmake/find/filelog.cmake) include (cmake/find/filelog.cmake)
if(NOT USE_INTERNAL_PARQUET_LIBRARY) if(NOT USE_INTERNAL_PARQUET_LIBRARY)

View File

@ -1,19 +0,0 @@
option(ENABLE_BZIP2 "Enable bzip2 compression support" ${ENABLE_LIBRARIES})
if (NOT ENABLE_BZIP2)
message (STATUS "bzip2 compression disabled")
return()
endif()
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/bzip2/bzlib.h")
message (WARNING "submodule contrib/bzip2 is missing. to fix try run: \n git submodule update --init")
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal bzip2 library")
set (USE_NLP 0)
return()
endif ()
set (USE_BZIP2 1)
set (BZIP2_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/bzip2")
set (BZIP2_LIBRARY bzip2)
message (STATUS "Using bzip2=${USE_BZIP2}: ${BZIP2_INCLUDE_DIR} : ${BZIP2_LIBRARY}")

View File

@ -86,7 +86,7 @@ if(NOT USE_INTERNAL_PARQUET_LIBRARY)
add_library(imported_arrow_deps STATIC ${ARROW_OTHER_OBJS}) add_library(imported_arrow_deps STATIC ${ARROW_OTHER_OBJS})
set(ARROW_LIBRARY ${ARROW_STATIC_LIB} set(ARROW_LIBRARY ${ARROW_STATIC_LIB}
imported_arrow_deps ${THRIFT_LIBRARY} ${UTF8_PROC_LIBRARY} ${BZIP2_LIBRARIES} ${SNAPPY_LIBRARY}) imported_arrow_deps ${THRIFT_LIBRARY} ${UTF8_PROC_LIBRARY} bzip2 ${SNAPPY_LIBRARY})
else() else()
message(WARNING "Using external static Arrow does not always work. " message(WARNING "Using external static Arrow does not always work. "
"Could not find arrow_bundled_dependencies.a. If compilation fails, " "Could not find arrow_bundled_dependencies.a. If compilation fails, "
@ -100,7 +100,7 @@ if(NOT USE_INTERNAL_PARQUET_LIBRARY)
set(PARQUET_LIBRARY ${PARQUET_SHARED_LIB}) set(PARQUET_LIBRARY ${PARQUET_SHARED_LIB})
endif() endif()
if(ARROW_INCLUDE_DIR AND ARROW_LIBRARY AND PARQUET_INCLUDE_DIR AND PARQUET_LIBRARY AND THRIFT_LIBRARY AND UTF8_PROC_LIBRARY AND BZIP2_FOUND) if(ARROW_INCLUDE_DIR AND ARROW_LIBRARY AND PARQUET_INCLUDE_DIR AND PARQUET_LIBRARY AND THRIFT_LIBRARY AND UTF8_PROC_LIBRARY)
set(USE_PARQUET 1) set(USE_PARQUET 1)
set(EXTERNAL_PARQUET_FOUND 1) set(EXTERNAL_PARQUET_FOUND 1)
else() else()

View File

@ -59,6 +59,7 @@ add_subdirectory (croaring-cmake)
add_subdirectory (zstd-cmake) add_subdirectory (zstd-cmake)
add_subdirectory (zlib-ng-cmake) add_subdirectory (zlib-ng-cmake)
add_subdirectory (rocksdb-cmake) add_subdirectory (rocksdb-cmake)
add_subdirectory (bzip2-cmake)
# TODO: refactor the contrib libraries below this comment. # TODO: refactor the contrib libraries below this comment.
@ -277,10 +278,6 @@ if (USE_NLP)
add_subdirectory(lemmagen-c-cmake) add_subdirectory(lemmagen-c-cmake)
endif() endif()
if (USE_BZIP2)
add_subdirectory(bzip2-cmake)
endif()
if (USE_SQLITE) if (USE_SQLITE)
add_subdirectory(sqlite-cmake) add_subdirectory(sqlite-cmake)
endif() endif()

View File

@ -1,3 +1,9 @@
option(ENABLE_BZIP2 "Enable bzip2 compression support" ${ENABLE_LIBRARIES})
if (NOT ENABLE_BZIP2)
message (STATUS "bzip2 compression disabled")
return()
endif()
set(BZIP2_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/bzip2") set(BZIP2_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/bzip2")
set(BZIP2_BINARY_DIR "${ClickHouse_BINARY_DIR}/contrib/bzip2") set(BZIP2_BINARY_DIR "${ClickHouse_BINARY_DIR}/contrib/bzip2")
@ -18,6 +24,10 @@ configure_file (
"${BZIP2_BINARY_DIR}/bz_version.h" "${BZIP2_BINARY_DIR}/bz_version.h"
) )
add_library(bzip2 ${SRCS}) add_library(_bzip2 ${SRCS})
add_library(ch_contrib::bzip2 ALIAS _bzip2)
target_include_directories(bzip2 PUBLIC "${BZIP2_SOURCE_DIR}" "${BZIP2_BINARY_DIR}") # To avoid -Wreserved-id-macro we use SYSTEM:
#
# clickhouse/contrib/bzip2/bzlib.h:23:9: error: macro name is a reserved identifier [-Werror,-Wreserved-id-macro]
# #define _BZLIB_H
target_include_directories(_bzip2 SYSTEM BEFORE PUBLIC "${BZIP2_SOURCE_DIR}" "${BZIP2_BINARY_DIR}")

View File

@ -534,9 +534,8 @@ if (USE_NLP)
dbms_target_link_libraries (PUBLIC lemmagen) dbms_target_link_libraries (PUBLIC lemmagen)
endif() endif()
if (USE_BZIP2) if (TARGET ch_contrib::bzip2)
target_link_libraries (clickhouse_common_io PRIVATE ${BZIP2_LIBRARY}) target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::bzip2)
target_include_directories (clickhouse_common_io SYSTEM BEFORE PRIVATE ${BZIP2_INCLUDE_DIR})
endif() endif()
if(USE_SIMDJSON) if(USE_SIMDJSON)

View File

@ -1,3 +1,6 @@
if (TARGET ch_contrib::rocksdb) if (TARGET ch_contrib::rocksdb)
set(USE_ROCKSDB 1) set(USE_ROCKSDB 1)
endif() endif()
if (TARGET ch_contrib::bzip2)
set(USE_BZIP2 1)
endif()