Remove unbundled lz4 support

This commit is contained in:
Azat Khuzhin 2022-01-17 08:28:05 +03:00
parent 61b781971c
commit 8485abd52b
11 changed files with 29 additions and 44 deletions

View File

@ -373,7 +373,7 @@ endif ()
target_include_directories(_arrow SYSTEM BEFORE PUBLIC ${ARROW_SRC_DIR})
target_include_directories(_arrow SYSTEM BEFORE PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/cpp/src")
target_link_libraries(_arrow PRIVATE ${DOUBLE_CONVERSION_LIBRARIES} ${Protobuf_LIBRARY})
target_link_libraries(_arrow PRIVATE lz4)
target_link_libraries(_arrow PRIVATE ch_contrib::lz4)
target_link_libraries(_arrow PRIVATE ch_contrib::snappy)
target_link_libraries(_arrow PRIVATE ch_contrib::zlib)
target_link_libraries(_arrow PRIVATE ch_contrib::zstd)

View File

@ -122,7 +122,7 @@ target_include_directories(_rdkafka SYSTEM PUBLIC ${RDKAFKA_SOURCE_DIR})
target_include_directories(_rdkafka SYSTEM PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/auxdir") # for "../config.h"
target_link_libraries(_rdkafka
PRIVATE
lz4
ch_contrib::lz4
ch_contrib::zlib
ch_contrib::zstd
OpenSSL::Crypto OpenSSL::SSL

View File

@ -1,37 +1,18 @@
option (USE_INTERNAL_LZ4_LIBRARY "Use internal lz4 library" ON)
# lz4 is the main compression method, cannot be disabled.
if (NOT USE_INTERNAL_LZ4_LIBRARY)
find_library (LIBRARY_LZ4 lz4)
find_path (INCLUDE_LZ4 lz4.h)
set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/lz4")
set (SRCS
"${LIBRARY_DIR}/lib/lz4.c"
"${LIBRARY_DIR}/lib/lz4hc.c"
"${LIBRARY_DIR}/lib/lz4frame.c"
"${LIBRARY_DIR}/lib/xxhash.c"
)
if (LIBRARY_LZ4 AND INCLUDE_LZ4)
set(EXTERNAL_LZ4_LIBRARY_FOUND 1)
add_library (lz4 INTERFACE)
set_property (TARGET lz4 PROPERTY INTERFACE_LINK_LIBRARIES ${LIBRARY_LZ4})
set_property (TARGET lz4 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_LZ4})
set_property (TARGET lz4 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USE_XXHASH=0)
else()
set(EXTERNAL_LZ4_LIBRARY_FOUND 0)
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system lz4")
endif()
endif()
add_library (_lz4 ${SRCS})
add_library (ch_contrib::lz4 ALIAS _lz4)
if (NOT EXTERNAL_LZ4_LIBRARY_FOUND)
set (USE_INTERNAL_LZ4_LIBRARY 1)
set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/lz4")
set (SRCS
"${LIBRARY_DIR}/lib/lz4.c"
"${LIBRARY_DIR}/lib/lz4hc.c"
"${LIBRARY_DIR}/lib/lz4frame.c"
"${LIBRARY_DIR}/lib/xxhash.c"
)
add_library (lz4 ${SRCS})
target_compile_definitions (lz4 PUBLIC LZ4_DISABLE_DEPRECATE_WARNINGS=1 USE_XXHASH=1)
if (SANITIZE STREQUAL "undefined")
target_compile_options (lz4 PRIVATE -fno-sanitize=undefined)
endif ()
target_include_directories(lz4 PUBLIC "${LIBRARY_DIR}/lib")
target_compile_definitions (_lz4 PUBLIC LZ4_DISABLE_DEPRECATE_WARNINGS=1 USE_XXHASH=1)
if (SANITIZE STREQUAL "undefined")
target_compile_options (_lz4 PRIVATE -fno-sanitize=undefined)
endif ()
target_include_directories(_lz4 PUBLIC "${LIBRARY_DIR}/lib")

View File

@ -223,7 +223,11 @@ if (USE_INTERNAL_POCO_LIBRARY)
POCO_OS_FAMILY_UNIX
)
target_include_directories (_poco_foundation SYSTEM PUBLIC "${LIBRARY_DIR}/Foundation/include")
target_link_libraries (_poco_foundation PRIVATE Poco::Foundation::PCRE ch_contrib::zlib lz4)
target_link_libraries (_poco_foundation
PRIVATE
Poco::Foundation::PCRE
ch_contrib::zlib
ch_contrib::lz4)
else ()
add_library (Poco::Foundation UNKNOWN IMPORTED GLOBAL)

View File

@ -67,7 +67,7 @@ else()
if(WITH_LZ4)
add_definitions(-DLZ4)
list(APPEND THIRDPARTY_LIBS lz4)
list(APPEND THIRDPARTY_LIBS ch_contrib::lz4)
endif()
if(WITH_ZSTD)

View File

@ -368,7 +368,7 @@ dbms_target_link_libraries (
clickhouse_common_zookeeper
clickhouse_dictionaries_embedded
clickhouse_parsers
lz4
ch_contrib::lz4
Poco::JSON
Poco::MongoDB
string_utils
@ -507,7 +507,7 @@ if (USE_DATASKETCHES)
target_include_directories (clickhouse_aggregate_functions SYSTEM BEFORE PRIVATE ${DATASKETCHES_INCLUDE_DIR})
endif ()
target_link_libraries (clickhouse_common_io PRIVATE lz4)
target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::lz4)
dbms_target_link_libraries(PRIVATE _boost_context)

View File

@ -6,7 +6,7 @@ if (ENABLE_FUZZING)
list(REMOVE_ITEM ${fuzz_compression_sources} CompressionFactoryAdditions.cpp)
add_library(fuzz_compression ${fuzz_compression_headers} ${fuzz_compression_sources})
target_link_libraries(fuzz_compression PUBLIC clickhouse_parsers clickhouse_common_io common lz4)
target_link_libraries(fuzz_compression PUBLIC clickhouse_parsers clickhouse_common_io common ch_contrib::lz4)
endif()
if (ENABLE_EXAMPLES)

View File

@ -8,7 +8,7 @@ add_executable (compressed_buffer_fuzzer compressed_buffer_fuzzer.cpp)
target_link_libraries (compressed_buffer_fuzzer PRIVATE dbms ${LIB_FUZZING_ENGINE})
add_executable (lz4_decompress_fuzzer lz4_decompress_fuzzer.cpp)
target_link_libraries (lz4_decompress_fuzzer PUBLIC dbms lz4 ${LIB_FUZZING_ENGINE})
target_link_libraries (lz4_decompress_fuzzer PUBLIC dbms ch_contrib::lz4 ${LIB_FUZZING_ENGINE})
add_executable (delta_decompress_fuzzer delta_decompress_fuzzer.cpp)
target_link_libraries (delta_decompress_fuzzer PRIVATE dbms ${LIB_FUZZING_ENGINE})

View File

@ -79,7 +79,7 @@ if(USE_BASE64)
target_include_directories(clickhouse_functions SYSTEM PRIVATE ${BASE64_INCLUDE_DIR})
endif()
target_link_libraries(clickhouse_functions PRIVATE lz4)
target_link_libraries(clickhouse_functions PRIVATE ch_contrib::lz4)
if (USE_H3)
target_link_libraries(clickhouse_functions PRIVATE ${H3_LIBRARY})

View File

@ -35,7 +35,7 @@ const char * auto_config_build[]
"USE_RDKAFKA", "@USE_RDKAFKA@",
"USE_CAPNP", "@USE_CAPNP@",
"USE_BASE64", "@USE_BASE64@",
"USE_XXHASH", "@USE_INTERNAL_LZ4_LIBRARY@",
"USE_XXHASH",
"USE_HDFS", "@USE_HDFS@",
"USE_SNAPPY", "@USE_SNAPPY@",
"USE_PARQUET", "@USE_PARQUET@",

View File

@ -1,2 +1,2 @@
add_executable (decompress_perf decompress_perf.cpp)
target_link_libraries(decompress_perf PRIVATE dbms lz4)
target_link_libraries(decompress_perf PRIVATE dbms ch_contrib::lz4)