2019-10-05 19:25:31 +00:00
|
|
|
option (ENABLE_BROTLI "Enable brotli" ${ENABLE_LIBRARIES})
|
2019-03-13 07:37:16 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
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()
|
2019-03-13 07:37:16 +00:00
|
|
|
|
2020-08-21 22:25:38 +00:00
|
|
|
if (UNBUNDLED)
|
|
|
|
# Many system ship only dynamic brotly libraries, so we back off to bundled by default
|
|
|
|
option (USE_INTERNAL_BROTLI_LIBRARY "Set to FALSE to use system libbrotli library instead of bundled" ${USE_STATIC_LIBRARIES})
|
|
|
|
else()
|
|
|
|
option (USE_INTERNAL_BROTLI_LIBRARY "Set to FALSE to use system libbrotli library instead of bundled" ON)
|
|
|
|
endif()
|
2019-02-02 13:33:50 +00:00
|
|
|
|
|
|
|
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/brotli/c/include/brotli/decode.h")
|
|
|
|
if (USE_INTERNAL_BROTLI_LIBRARY)
|
2021-10-17 23:29:04 +00:00
|
|
|
message (WARNING "submodule contrib/brotli is missing. to fix try run: \n git submodule update --init")
|
2020-08-14 15:44:04 +00:00
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot find internal brotli")
|
2019-02-02 13:33:50 +00:00
|
|
|
set (USE_INTERNAL_BROTLI_LIBRARY 0)
|
|
|
|
endif ()
|
|
|
|
set (MISSING_INTERNAL_BROTLI_LIBRARY 1)
|
|
|
|
endif ()
|
|
|
|
|
2019-02-13 14:47:24 +00:00
|
|
|
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})
|
2020-08-14 15:44:04 +00:00
|
|
|
else()
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use system brotli")
|
2019-02-13 14:47:24 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2019-02-02 13:33:50 +00:00
|
|
|
|
|
|
|
if (BROTLI_LIBRARY AND BROTLI_INCLUDE_DIR)
|
2019-02-03 14:14:30 +00:00
|
|
|
set (USE_BROTLI 1)
|
2019-02-02 13:33:50 +00:00
|
|
|
elseif (NOT MISSING_INTERNAL_BROTLI_LIBRARY)
|
2020-08-14 15:44:04 +00:00
|
|
|
set (BROTLI_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/brotli/c/include")
|
2019-02-02 13:33:50 +00:00
|
|
|
set (USE_INTERNAL_BROTLI_LIBRARY 1)
|
2019-02-02 14:17:51 +00:00
|
|
|
set (BROTLI_LIBRARY brotli)
|
|
|
|
set (USE_BROTLI 1)
|
2019-02-02 13:33:50 +00:00
|
|
|
endif ()
|
|
|
|
|
2019-02-03 14:14:30 +00:00
|
|
|
message (STATUS "Using brotli=${USE_BROTLI}: ${BROTLI_INCLUDE_DIR} : ${BROTLI_LIBRARY}")
|