Remove unbundled brotli support

This commit is contained in:
Azat Khuzhin 2022-01-17 21:48:14 +03:00
parent 789dfd9f3b
commit 041b4f3635
6 changed files with 18 additions and 54 deletions

View File

@ -501,7 +501,6 @@ include (cmake/find/capnp.cmake)
include (cmake/find/llvm.cmake)
include (cmake/find/h3.cmake)
include (cmake/find/libxml2.cmake)
include (cmake/find/brotli.cmake)
include (cmake/find/pdqsort.cmake)
include (cmake/find/miniselect.cmake)
include (cmake/find/poco.cmake)

View File

@ -1,42 +0,0 @@
option (ENABLE_BROTLI "Enable brotli" ${ENABLE_LIBRARIES})
if (NOT ENABLE_BROTLI)
if (USE_INTERNAL_BROTLI_LIBRARY)
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal brotly library with ENABLE_BROTLI=OFF")
endif()
return()
endif()
option (USE_INTERNAL_BROTLI_LIBRARY "Set to FALSE to use system libbrotli library instead of bundled" ON)
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/brotli/c/include/brotli/decode.h")
if (USE_INTERNAL_BROTLI_LIBRARY)
message (WARNING "submodule contrib/brotli is missing. to fix try run: \n git submodule update --init")
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot find internal brotli")
set (USE_INTERNAL_BROTLI_LIBRARY 0)
endif ()
set (MISSING_INTERNAL_BROTLI_LIBRARY 1)
endif ()
if(NOT USE_INTERNAL_BROTLI_LIBRARY)
find_library(BROTLI_LIBRARY_COMMON brotlicommon)
find_library(BROTLI_LIBRARY_DEC brotlidec)
find_library(BROTLI_LIBRARY_ENC brotlienc)
find_path(BROTLI_INCLUDE_DIR NAMES brotli/decode.h brotli/encode.h brotli/port.h brotli/types.h PATHS ${BROTLI_INCLUDE_PATHS})
if(BROTLI_LIBRARY_DEC AND BROTLI_LIBRARY_ENC AND BROTLI_LIBRARY_COMMON)
set(BROTLI_LIBRARY ${BROTLI_LIBRARY_DEC} ${BROTLI_LIBRARY_ENC} ${BROTLI_LIBRARY_COMMON})
else()
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use system brotli")
endif()
endif()
if (BROTLI_LIBRARY AND BROTLI_INCLUDE_DIR)
set (USE_BROTLI 1)
elseif (NOT MISSING_INTERNAL_BROTLI_LIBRARY)
set (BROTLI_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/brotli/c/include")
set (USE_INTERNAL_BROTLI_LIBRARY 1)
set (BROTLI_LIBRARY brotli)
set (USE_BROTLI 1)
endif ()
message (STATUS "Using brotli=${USE_BROTLI}: ${BROTLI_INCLUDE_DIR} : ${BROTLI_LIBRARY}")

View File

@ -48,6 +48,7 @@ endif()
add_subdirectory (re2-cmake)
add_subdirectory (xz-cmake)
add_subdirectory (brotli-cmake)
add_subdirectory (double-conversion-cmake)
add_subdirectory (boringssl-cmake)
add_subdirectory (poco-cmake)
@ -134,11 +135,6 @@ if (USE_INTERNAL_LIBXML2_LIBRARY)
add_subdirectory(libxml2-cmake)
endif ()
if (USE_INTERNAL_BROTLI_LIBRARY)
add_subdirectory(brotli-cmake)
target_compile_definitions(brotli PRIVATE BROTLI_BUILD_PORTABLE=1)
endif ()
if (USE_INTERNAL_AWS_S3_LIBRARY)
add_subdirectory(aws-s3-cmake)

View File

@ -1,3 +1,10 @@
option (ENABLE_BROTLI "Enable brotli" ${ENABLE_LIBRARIES})
if (NOT ENABLE_BROTLI)
message(STATUS "Not using brotli")
return()
endif()
set(BROTLI_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/brotli/c")
set(BROTLI_BINARY_DIR "${ClickHouse_BINARY_DIR}/contrib/brotli/c")
@ -33,10 +40,12 @@ set(SRCS
"${BROTLI_SOURCE_DIR}/common/constants.c"
)
add_library(brotli ${SRCS})
add_library(_brotli ${SRCS})
add_library(ch_contrib::brotli ALIAS _brotli)
target_include_directories(brotli PUBLIC "${BROTLI_SOURCE_DIR}/include")
target_include_directories(_brotli SYSTEM BEFORE PUBLIC "${BROTLI_SOURCE_DIR}/include")
if(M_LIBRARY)
target_link_libraries(brotli PRIVATE ${M_LIBRARY})
target_link_libraries(_brotli PRIVATE ${M_LIBRARY})
endif()
target_compile_definitions(_brotli PRIVATE BROTLI_BUILD_PORTABLE=1)

View File

@ -449,9 +449,8 @@ if (TARGET ch_contrib::s2)
dbms_target_link_libraries (PUBLIC ch_contrib::s2)
endif()
if (USE_BROTLI)
target_link_libraries (clickhouse_common_io PRIVATE ${BROTLI_LIBRARY})
target_include_directories (clickhouse_common_io SYSTEM BEFORE PRIVATE ${BROTLI_INCLUDE_DIR})
if (TARGET ch_contrib::brotli)
target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::brotli)
endif()
if (TARGET ch_contrib::snappy)

View File

@ -7,6 +7,9 @@ endif()
if (TARGET ch_contrib::snappy)
set(USE_SNAPPY 1)
endif()
if (TARGET ch_contrib::brotli)
set(USE_BROTLI 1)
endif()
if (TARGET ch_contrib::hivemetastore)
set(USE_HIVE 1)
endif()