diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3dffbd7ecfc..db923369296 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -24,3 +24,6 @@ Detailed description / Documentation draft: By adding documentation, you'll allow users to try your new feature immediately, not when someone else will have time to document it later. Documentation is necessary for all features that affect user experience in any way. You can add brief documentation draft above, or add documentation right into your patch as Markdown files in [docs](https://github.com/ClickHouse/ClickHouse/tree/master/docs) folder. If you are doing this for the first time, it's recommended to read the lightweight [Contributing to ClickHouse Documentation](https://github.com/ClickHouse/ClickHouse/tree/master/docs/README.md) guide first. + + +Information about CI checks: https://clickhouse.tech/docs/en/development/continuous-integration/ diff --git a/CMakeLists.txt b/CMakeLists.txt index ec168723b83..cf97b2c40ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,16 @@ endforeach() project(ClickHouse) +option(FAIL_ON_UNSUPPORTED_OPTIONS_COMBINATION + "Stop/Fail CMake configuration if some ENABLE_XXX option is defined (either ON or OFF) but is not possible to satisfy" + ON +) +if(FAIL_ON_UNSUPPORTED_OPTIONS_COMBINATION) + set(RECONFIGURE_MESSAGE_LEVEL FATAL_ERROR) +else() + set(RECONFIGURE_MESSAGE_LEVEL STATUS) +endif() + include (cmake/arch.cmake) include (cmake/target.cmake) include (cmake/tools.cmake) @@ -57,7 +67,7 @@ if(ENABLE_IPO) message(STATUS "IPO/LTO is supported, enabling") set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) else() - message(STATUS "IPO/LTO is not supported: <${IPO_NOT_SUPPORTED}>") + message (${RECONFIGURE_MESSAGE_LEVEL} "IPO/LTO is not supported: <${IPO_NOT_SUPPORTED}>") endif() else() message(STATUS "IPO/LTO not enabled.") @@ -133,6 +143,8 @@ option (ENABLE_TESTS "Enables tests" ON) if (OS_LINUX AND NOT UNBUNDLED AND MAKE_STATIC_LIBRARIES AND NOT SPLIT_SHARED_LIBRARIES AND CMAKE_VERSION VERSION_GREATER "3.9.0") option (GLIBC_COMPATIBILITY "Set to TRUE to enable compatibility with older glibc libraries. Only for x86_64, Linux. Implies ENABLE_FASTMEMCPY." ON) +elseif(GLIBC_COMPATIBILITY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Glibc compatibility cannot be enabled in current configuration") endif () if (NOT CMAKE_VERSION VERSION_GREATER "3.9.0") @@ -253,7 +265,9 @@ if (COMPILER_CLANG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-absolute-paths") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-absolute-paths") - option(ENABLE_THINLTO "Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers." ON) + if (NOT ENABLE_TESTS AND NOT SANITIZE) + option(ENABLE_THINLTO "Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers." ON) + endif() # We cannot afford to use LTO when compiling unitests, and it's not enough # to only supply -fno-lto at the final linking stage. So we disable it @@ -263,6 +277,8 @@ if (COMPILER_CLANG) set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -flto=thin") set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto=thin") set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -flto=thin") + elseif (ENABLE_THINLTO) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot enable ThinLTO") endif () # Always prefer llvm tools when using clang. For instance, we cannot use GNU ar when llvm LTO is enabled @@ -282,6 +298,8 @@ if (COMPILER_CLANG) else () message(WARNING "Cannot find llvm-ranlib. System ranlib will be used instead. It does not work with ThinLTO.") endif () +elseif (ENABLE_THINLTO) + message (${RECONFIGURE_MESSAGE_LEVEL} "ThinLTO is only available with CLang") endif () option (ENABLE_LIBRARIES "Enable all libraries (Global default switch)" ON) @@ -385,6 +403,7 @@ include (cmake/find/rdkafka.cmake) include (cmake/find/amqpcpp.cmake) include (cmake/find/capnp.cmake) include (cmake/find/llvm.cmake) +include (cmake/find/termcap.cmake) # for external static llvm include (cmake/find/opencl.cmake) include (cmake/find/h3.cmake) include (cmake/find/libxml2.cmake) @@ -393,21 +412,33 @@ include (cmake/find/protobuf.cmake) include (cmake/find/grpc.cmake) include (cmake/find/pdqsort.cmake) include (cmake/find/hdfs3.cmake) # uses protobuf +include (cmake/find/poco.cmake) +include (cmake/find/curl.cmake) include (cmake/find/s3.cmake) include (cmake/find/base64.cmake) include (cmake/find/parquet.cmake) include (cmake/find/simdjson.cmake) include (cmake/find/rapidjson.cmake) include (cmake/find/fastops.cmake) +include (cmake/find/odbc.cmake) + +if(NOT USE_INTERNAL_PARQUET_LIBRARY) + set (ENABLE_ORC OFF CACHE INTERNAL "") +endif() include (cmake/find/orc.cmake) + include (cmake/find/avro.cmake) include (cmake/find/msgpack.cmake) include (cmake/find/cassandra.cmake) include (cmake/find/sentry.cmake) include (cmake/find/stats.cmake) +set (USE_INTERNAL_CITYHASH_LIBRARY ON CACHE INTERNAL "") find_contrib_lib(cityhash) + find_contrib_lib(farmhash) + +set (USE_INTERNAL_BTRIE_LIBRARY ON CACHE INTERNAL "") find_contrib_lib(btrie) if (ENABLE_TESTS) diff --git a/README.md b/README.md index e895e10c458..5daf152109f 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,5 @@ ClickHouse is an open-source column-oriented database management system that all ## Upcoming Events -* [ClickHouse at ByteDance (in Chinese)](https://mp.weixin.qq.com/s/Em-HjPylO8D7WPui4RREAQ) on August 14, 2020. +* [ClickHouse at ByteDance (in Chinese)](https://mp.weixin.qq.com/s/Em-HjPylO8D7WPui4RREAQ) on August 28, 2020. +* [ClickHouse Data Integration Virtual Meetup](https://www.eventbrite.com/e/clickhouse-september-virtual-meetup-data-integration-tickets-117421895049) on September 10, 2020. diff --git a/base/common/StringRef.h b/base/common/StringRef.h index 2247f0de2ed..410e13ba7d8 100644 --- a/base/common/StringRef.h +++ b/base/common/StringRef.h @@ -21,21 +21,26 @@ #endif -/// The thing to avoid creating strings to find substrings in the hash table. +/** + * The std::string_view-like container to avoid creating strings to find substrings in the hash table. + */ struct StringRef { const char * data = nullptr; size_t size = 0; + /// Non-constexpr due to reinterpret_cast. template > - constexpr StringRef(const CharT * data_, size_t size_) : data(reinterpret_cast(data_)), size(size_) + StringRef(const CharT * data_, size_t size_) : data(reinterpret_cast(data_)), size(size_) { /// Sanity check for overflowed values. assert(size < 0x8000000000000000ULL); } + constexpr StringRef(const char * data_, size_t size_) : data(data_), size(size_) {} + StringRef(const std::string & s) : data(s.data()), size(s.size()) {} - constexpr explicit StringRef(const std::string_view & s) : data(s.data()), size(s.size()) {} + constexpr explicit StringRef(std::string_view s) : data(s.data()), size(s.size()) {} constexpr StringRef(const char * data_) : StringRef(std::string_view{data_}) {} constexpr StringRef() = default; @@ -45,6 +50,12 @@ struct StringRef constexpr explicit operator std::string_view() const { return {data, size}; } }; +/// Here constexpr doesn't implicate inline, see https://www.viva64.com/en/w/v1043/ +/// nullptr can't be used because the StringRef values are used in SipHash's pointer arithmetics +/// and the UBSan thinks that something like nullptr + 8 is UB. +constexpr const inline char empty_string_ref_addr{}; +constexpr const inline StringRef EMPTY_STRING_REF{&empty_string_ref_addr, 0}; + using StringRefs = std::vector; diff --git a/base/common/getResource.cpp b/base/common/getResource.cpp index be7f205e7d1..5d5f18047b3 100644 --- a/base/common/getResource.cpp +++ b/base/common/getResource.cpp @@ -2,6 +2,7 @@ #include "unaligned.h" #include #include +#include std::string_view getResource(std::string_view name) @@ -10,6 +11,7 @@ std::string_view getResource(std::string_view name) std::replace(name_replaced.begin(), name_replaced.end(), '/', '_'); std::replace(name_replaced.begin(), name_replaced.end(), '-', '_'); std::replace(name_replaced.begin(), name_replaced.end(), '.', '_'); + boost::replace_all(name_replaced, "+", "_PLUS_"); /// These are the names that are generated by "ld -r -b binary" std::string symbol_name_data = "_binary_" + name_replaced + "_start"; diff --git a/base/common/types.h b/base/common/types.h index c49e9334bf5..0a394de9f5c 100644 --- a/base/common/types.h +++ b/base/common/types.h @@ -121,3 +121,18 @@ template <> struct is_big_int { static constexpr bool value = true; }; template inline constexpr bool is_big_int_v = is_big_int::value; + +template +inline std::string bigintToString(const T & x) +{ + return x.str(); +} + +template +inline To bigint_cast(const From & x [[maybe_unused]]) +{ + if constexpr ((is_big_int_v && std::is_same_v) || (is_big_int_v && std::is_same_v)) + return static_cast(x); + else + return static_cast(x); +} diff --git a/base/mysqlxx/CMakeLists.txt b/base/mysqlxx/CMakeLists.txt index 7d35c1bd31d..b410c38cfad 100644 --- a/base/mysqlxx/CMakeLists.txt +++ b/base/mysqlxx/CMakeLists.txt @@ -50,6 +50,14 @@ if (NOT USE_INTERNAL_MYSQL_LIBRARY AND OPENSSL_INCLUDE_DIR) target_include_directories (mysqlxx SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR}) endif () +if (NOT USE_INTERNAL_MYSQL_LIBRARY AND USE_STATIC_LIBRARIES) + message(WARNING "Statically linking with system mysql/mariadb only works " + "if mysql client libraries are built with same openssl version as " + "we are going to use now. It wouldn't work if GnuTLS is used. " + "Try -D\"USE_INTERNAL_MYSQL_LIBRARY\"=ON or -D\"ENABLE_MYSQL\"=OFF or " + "-D\"USE_STATIC_LIBRARIES\"=OFF") +endif () + if (ENABLE_TESTS) add_subdirectory (tests) endif () diff --git a/base/mysqlxx/Connection.cpp b/base/mysqlxx/Connection.cpp index 7ba14c9baba..8c7e11eb4a1 100644 --- a/base/mysqlxx/Connection.cpp +++ b/base/mysqlxx/Connection.cpp @@ -116,7 +116,7 @@ void Connection::connect(const char* db, throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get())); /// Enables auto-reconnect. - my_bool reconnect = true; + bool reconnect = true; if (mysql_options(driver.get(), MYSQL_OPT_RECONNECT, reinterpret_cast(&reconnect))) throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get())); diff --git a/cmake/Modules/FindArrow.cmake b/cmake/Modules/FindArrow.cmake index 4043a474988..5bd111de1e3 100644 --- a/cmake/Modules/FindArrow.cmake +++ b/cmake/Modules/FindArrow.cmake @@ -17,143 +17,417 @@ # specific language governing permissions and limitations # under the License. -# - Find ARROW (arrow/api.h, libarrow.a, libarrow.so) +# - Find Arrow (arrow/api.h, libarrow.a, libarrow.so) # This module defines +# ARROW_FOUND, whether Arrow has been found +# ARROW_FULL_SO_VERSION, full shared object version of found Arrow "100.0.0" +# ARROW_IMPORT_LIB, path to libarrow's import library (Windows only) # ARROW_INCLUDE_DIR, directory containing headers -# ARROW_LIBS, directory containing arrow libraries -# ARROW_STATIC_LIB, path to libarrow.a +# ARROW_LIBS, deprecated. Use ARROW_LIB_DIR instead +# ARROW_LIB_DIR, directory containing Arrow libraries +# ARROW_SHARED_IMP_LIB, deprecated. Use ARROW_IMPORT_LIB instead # ARROW_SHARED_LIB, path to libarrow's shared library -# ARROW_SHARED_IMP_LIB, path to libarrow's import library (MSVC only) -# ARROW_FOUND, whether arrow has been found +# ARROW_SO_VERSION, shared object version of found Arrow such as "100" +# ARROW_STATIC_LIB, path to libarrow.a +# ARROW_VERSION, version of found Arrow +# ARROW_VERSION_MAJOR, major version of found Arrow +# ARROW_VERSION_MINOR, minor version of found Arrow +# ARROW_VERSION_PATCH, patch version of found Arrow + +if(DEFINED ARROW_FOUND) + return() +endif() include(FindPkgConfig) -include(GNUInstallDirs) +include(FindPackageHandleStandardArgs) -if ("$ENV{ARROW_HOME}" STREQUAL "") - pkg_check_modules(ARROW arrow) - if (ARROW_FOUND) - pkg_get_variable(ARROW_SO_VERSION arrow so_version) - set(ARROW_ABI_VERSION ${ARROW_SO_VERSION}) - message(STATUS "Arrow SO and ABI version: ${ARROW_SO_VERSION}") - pkg_get_variable(ARROW_FULL_SO_VERSION arrow full_so_version) - message(STATUS "Arrow full SO version: ${ARROW_FULL_SO_VERSION}") - if ("${ARROW_INCLUDE_DIRS}" STREQUAL "") - set(ARROW_INCLUDE_DIRS "/usr/${CMAKE_INSTALL_INCLUDEDIR}") - endif() - if ("${ARROW_LIBRARY_DIRS}" STREQUAL "") - set(ARROW_LIBRARY_DIRS "/usr/${CMAKE_INSTALL_LIBDIR}") - if (EXISTS "/etc/debian_version" AND CMAKE_LIBRARY_ARCHITECTURE) - set(ARROW_LIBRARY_DIRS - "${ARROW_LIBRARY_DIRS}/${CMAKE_LIBRARY_ARCHITECTURE}") - endif() - endif() - set(ARROW_INCLUDE_DIR ${ARROW_INCLUDE_DIRS}) - set(ARROW_LIBS ${ARROW_LIBRARY_DIRS}) - set(ARROW_SEARCH_LIB_PATH ${ARROW_LIBRARY_DIRS}) - endif() -else() - set(ARROW_HOME "$ENV{ARROW_HOME}") - - set(ARROW_SEARCH_HEADER_PATHS - ${ARROW_HOME}/include - ) - - set(ARROW_SEARCH_LIB_PATH - ${ARROW_HOME}/lib - ) - - find_path(ARROW_INCLUDE_DIR arrow/array.h PATHS - ${ARROW_SEARCH_HEADER_PATHS} - # make sure we don't accidentally pick up a different version - NO_DEFAULT_PATH - ) +set(ARROW_SEARCH_LIB_PATH_SUFFIXES) +if(CMAKE_LIBRARY_ARCHITECTURE) + list(APPEND ARROW_SEARCH_LIB_PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}") +endif() +list(APPEND ARROW_SEARCH_LIB_PATH_SUFFIXES + "lib64" + "lib32" + "lib" + "bin") +set(ARROW_CONFIG_SUFFIXES + "_RELEASE" + "_RELWITHDEBINFO" + "_MINSIZEREL" + "_DEBUG" + "") +if(CMAKE_BUILD_TYPE) + string(TOUPPER ${CMAKE_BUILD_TYPE} ARROW_CONFIG_SUFFIX_PREFERRED) + set(ARROW_CONFIG_SUFFIX_PREFERRED "_${ARROW_CONFIG_SUFFIX_PREFERRED}") + list(INSERT ARROW_CONFIG_SUFFIXES 0 "${ARROW_CONFIG_SUFFIX_PREFERRED}") endif() -find_library(ARROW_LIB_PATH NAMES arrow - PATHS - ${ARROW_SEARCH_LIB_PATH} - NO_DEFAULT_PATH) -get_filename_component(ARROW_LIBS ${ARROW_LIB_PATH} DIRECTORY) - -find_library(ARROW_PYTHON_LIB_PATH NAMES arrow_python - PATHS - ${ARROW_SEARCH_LIB_PATH} - NO_DEFAULT_PATH) -get_filename_component(ARROW_PYTHON_LIBS ${ARROW_PYTHON_LIB_PATH} DIRECTORY) - -if (MSVC) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll") - - if (MSVC AND NOT DEFINED ARROW_MSVC_STATIC_LIB_SUFFIX) +if(NOT DEFINED ARROW_MSVC_STATIC_LIB_SUFFIX) + if(MSVC) set(ARROW_MSVC_STATIC_LIB_SUFFIX "_static") - endif() - - find_library(ARROW_SHARED_LIBRARIES NAMES arrow - PATHS ${ARROW_HOME} NO_DEFAULT_PATH - PATH_SUFFIXES "bin" ) - - find_library(ARROW_PYTHON_SHARED_LIBRARIES NAMES arrow_python - PATHS ${ARROW_HOME} NO_DEFAULT_PATH - PATH_SUFFIXES "bin" ) - get_filename_component(ARROW_SHARED_LIBS ${ARROW_SHARED_LIBRARIES} PATH ) - get_filename_component(ARROW_PYTHON_SHARED_LIBS ${ARROW_PYTHON_SHARED_LIBRARIES} PATH ) -endif () - -if (ARROW_INCLUDE_DIR AND ARROW_LIBS) - set(ARROW_FOUND TRUE) - set(ARROW_LIB_NAME arrow) - set(ARROW_PYTHON_LIB_NAME arrow_python) - if (MSVC) - set(ARROW_STATIC_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(ARROW_PYTHON_STATIC_LIB ${ARROW_PYTHON_LIBS}/${ARROW_PYTHON_LIB_NAME}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(ARROW_SHARED_LIB ${ARROW_SHARED_LIBS}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(ARROW_PYTHON_SHARED_LIB ${ARROW_PYTHON_SHARED_LIBS}/${ARROW_PYTHON_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(ARROW_SHARED_IMP_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}.lib) - set(ARROW_PYTHON_SHARED_IMP_LIB ${ARROW_PYTHON_LIBS}/${ARROW_PYTHON_LIB_NAME}.lib) else() - set(ARROW_STATIC_LIB ${ARROW_LIBS}/lib${ARROW_LIB_NAME}.a) - set(ARROW_PYTHON_STATIC_LIB ${ARROW_LIBS}/lib${ARROW_PYTHON_LIB_NAME}.a) - - set(ARROW_SHARED_LIB ${ARROW_LIBS}/lib${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(ARROW_PYTHON_SHARED_LIB ${ARROW_LIBS}/lib${ARROW_PYTHON_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(ARROW_MSVC_STATIC_LIB_SUFFIX "") endif() endif() -if (ARROW_FOUND) - if (NOT Arrow_FIND_QUIETLY) - message(STATUS "Found the Arrow core library: ${ARROW_LIB_PATH}") - message(STATUS "Found the Arrow Python library: ${ARROW_PYTHON_LIB_PATH}") - endif () -else () - if (NOT Arrow_FIND_QUIETLY) - set(ARROW_ERR_MSG "Could not find the Arrow library. Looked for headers") - set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_HEADER_PATHS}, and for libs") - set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_LIB_PATH}") - if (Arrow_FIND_REQUIRED) - message(FATAL_ERROR "${ARROW_ERR_MSG}") - else (Arrow_FIND_REQUIRED) - message(STATUS "${ARROW_ERR_MSG}") - endif (Arrow_FIND_REQUIRED) - endif () - set(ARROW_FOUND FALSE) -endif () +# Internal function. +# +# Set shared library name for ${base_name} to ${output_variable}. +# +# Example: +# arrow_build_shared_library_name(ARROW_SHARED_LIBRARY_NAME arrow) +# # -> ARROW_SHARED_LIBRARY_NAME=libarrow.so on Linux +# # -> ARROW_SHARED_LIBRARY_NAME=libarrow.dylib on macOS +# # -> ARROW_SHARED_LIBRARY_NAME=arrow.dll with MSVC on Windows +# # -> ARROW_SHARED_LIBRARY_NAME=libarrow.dll with MinGW on Windows +function(arrow_build_shared_library_name output_variable base_name) + set(${output_variable} + "${CMAKE_SHARED_LIBRARY_PREFIX}${base_name}${CMAKE_SHARED_LIBRARY_SUFFIX}" + PARENT_SCOPE) +endfunction() -if (MSVC) - mark_as_advanced( - ARROW_INCLUDE_DIR - ARROW_STATIC_LIB - ARROW_SHARED_LIB - ARROW_SHARED_IMP_LIB - ARROW_PYTHON_STATIC_LIB - ARROW_PYTHON_SHARED_LIB - ARROW_PYTHON_SHARED_IMP_LIB - ) -else() - mark_as_advanced( - ARROW_INCLUDE_DIR - ARROW_STATIC_LIB - ARROW_SHARED_LIB - ARROW_PYTHON_STATIC_LIB - ARROW_PYTHON_SHARED_LIB - ) +# Internal function. +# +# Set import library name for ${base_name} to ${output_variable}. +# This is useful only for MSVC build. Import library is used only +# with MSVC build. +# +# Example: +# arrow_build_import_library_name(ARROW_IMPORT_LIBRARY_NAME arrow) +# # -> ARROW_IMPORT_LIBRARY_NAME=arrow on Linux (meaningless) +# # -> ARROW_IMPORT_LIBRARY_NAME=arrow on macOS (meaningless) +# # -> ARROW_IMPORT_LIBRARY_NAME=arrow.lib with MSVC on Windows +# # -> ARROW_IMPORT_LIBRARY_NAME=libarrow.dll.a with MinGW on Windows +function(arrow_build_import_library_name output_variable base_name) + set(${output_variable} + "${CMAKE_IMPORT_LIBRARY_PREFIX}${base_name}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + PARENT_SCOPE) +endfunction() + +# Internal function. +# +# Set static library name for ${base_name} to ${output_variable}. +# +# Example: +# arrow_build_static_library_name(ARROW_STATIC_LIBRARY_NAME arrow) +# # -> ARROW_STATIC_LIBRARY_NAME=libarrow.a on Linux +# # -> ARROW_STATIC_LIBRARY_NAME=libarrow.a on macOS +# # -> ARROW_STATIC_LIBRARY_NAME=arrow.lib with MSVC on Windows +# # -> ARROW_STATIC_LIBRARY_NAME=libarrow.dll.a with MinGW on Windows +function(arrow_build_static_library_name output_variable base_name) + set( + ${output_variable} + "${CMAKE_STATIC_LIBRARY_PREFIX}${base_name}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}" + PARENT_SCOPE) +endfunction() + +# Internal function. +# +# Set macro value for ${macro_name} in ${header_content} to ${output_variable}. +# +# Example: +# arrow_extract_macro_value(version_major +# "ARROW_VERSION_MAJOR" +# "#define ARROW_VERSION_MAJOR 1.0.0") +# # -> version_major=1.0.0 +function(arrow_extract_macro_value output_variable macro_name header_content) + string(REGEX MATCH "#define +${macro_name} +[^\r\n]+" macro_definition + "${header_content}") + string(REGEX + REPLACE "^#define +${macro_name} +(.+)$" "\\1" macro_value "${macro_definition}") + set(${output_variable} "${macro_value}" PARENT_SCOPE) +endfunction() + +# Internal macro only for arrow_find_package. +# +# Find package in HOME. +macro(arrow_find_package_home) + find_path(${prefix}_include_dir "${header_path}" + PATHS "${home}" + PATH_SUFFIXES "include" + NO_DEFAULT_PATH) + set(include_dir "${${prefix}_include_dir}") + set(${prefix}_INCLUDE_DIR "${include_dir}" PARENT_SCOPE) + + if(MSVC) + set(CMAKE_SHARED_LIBRARY_SUFFIXES_ORIGINAL ${CMAKE_FIND_LIBRARY_SUFFIXES}) + # .dll isn't found by find_library with MSVC because .dll isn't included in + # CMAKE_FIND_LIBRARY_SUFFIXES. + list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() + find_library(${prefix}_shared_lib + NAMES "${shared_lib_name}" + PATHS "${home}" + PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES} + NO_DEFAULT_PATH) + if(MSVC) + set(CMAKE_SHARED_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIGINAL}) + endif() + set(shared_lib "${${prefix}_shared_lib}") + set(${prefix}_SHARED_LIB "${shared_lib}" PARENT_SCOPE) + if(shared_lib) + add_library(${target_shared} SHARED IMPORTED) + set_target_properties(${target_shared} PROPERTIES IMPORTED_LOCATION "${shared_lib}") + if(include_dir) + set_target_properties(${target_shared} + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dir}") + endif() + find_library(${prefix}_import_lib + NAMES "${import_lib_name}" + PATHS "${home}" + PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES} + NO_DEFAULT_PATH) + set(import_lib "${${prefix}_import_lib}") + set(${prefix}_IMPORT_LIB "${import_lib}" PARENT_SCOPE) + if(import_lib) + set_target_properties(${target_shared} PROPERTIES IMPORTED_IMPLIB "${import_lib}") + endif() + endif() + + find_library(${prefix}_static_lib + NAMES "${static_lib_name}" + PATHS "${home}" + PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES} + NO_DEFAULT_PATH) + set(static_lib "${${prefix}_static_lib}") + set(${prefix}_STATIC_LIB "${static_lib}" PARENT_SCOPE) + if(static_lib) + add_library(${target_static} STATIC IMPORTED) + set_target_properties(${target_static} PROPERTIES IMPORTED_LOCATION "${static_lib}") + if(include_dir) + set_target_properties(${target_static} + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dir}") + endif() + endif() +endmacro() + +# Internal macro only for arrow_find_package. +# +# Find package by CMake package configuration. +macro(arrow_find_package_cmake_package_configuration) + find_package(${cmake_package_name} CONFIG) + if(${cmake_package_name}_FOUND) + set(${prefix}_USE_CMAKE_PACKAGE_CONFIG TRUE PARENT_SCOPE) + if(TARGET ${target_shared}) + foreach(suffix ${ARROW_CONFIG_SUFFIXES}) + get_target_property(shared_lib ${target_shared} IMPORTED_LOCATION${suffix}) + if(shared_lib) + # Remove shared library version: + # libarrow.so.100.0.0 -> libarrow.so + # Because ARROW_HOME and pkg-config approaches don't add + # shared library version. + string(REGEX + REPLACE "(${CMAKE_SHARED_LIBRARY_SUFFIX})[.0-9]+$" "\\1" shared_lib + "${shared_lib}") + set(${prefix}_SHARED_LIB "${shared_lib}" PARENT_SCOPE) + break() + endif() + endforeach() + endif() + if(TARGET ${target_static}) + foreach(suffix ${ARROW_CONFIG_SUFFIXES}) + get_target_property(static_lib ${target_static} IMPORTED_LOCATION${suffix}) + if(static_lib) + set(${prefix}_STATIC_LIB "${static_lib}" PARENT_SCOPE) + break() + endif() + endforeach() + endif() + endif() +endmacro() + +# Internal macro only for arrow_find_package. +# +# Find package by pkg-config. +macro(arrow_find_package_pkg_config) + pkg_check_modules(${prefix}_PC ${pkg_config_name}) + if(${prefix}_PC_FOUND) + set(${prefix}_USE_PKG_CONFIG TRUE PARENT_SCOPE) + + set(include_dir "${${prefix}_PC_INCLUDEDIR}") + set(lib_dir "${${prefix}_PC_LIBDIR}") + set(shared_lib_paths "${${prefix}_PC_LINK_LIBRARIES}") + # Use the first shared library path as the IMPORTED_LOCATION + # for ${target_shared}. This assumes that the first shared library + # path is the shared library path for this module. + list(GET shared_lib_paths 0 first_shared_lib_path) + # Use the rest shared library paths as the INTERFACE_LINK_LIBRARIES + # for ${target_shared}. This assumes that the rest shared library + # paths are dependency library paths for this module. + list(LENGTH shared_lib_paths n_shared_lib_paths) + if(n_shared_lib_paths LESS_EQUAL 1) + set(rest_shared_lib_paths) + else() + list(SUBLIST + shared_lib_paths + 1 + -1 + rest_shared_lib_paths) + endif() + + set(${prefix}_VERSION "${${prefix}_PC_VERSION}" PARENT_SCOPE) + set(${prefix}_INCLUDE_DIR "${include_dir}" PARENT_SCOPE) + set(${prefix}_SHARED_LIB "${first_shared_lib_path}" PARENT_SCOPE) + + add_library(${target_shared} SHARED IMPORTED) + set_target_properties(${target_shared} + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${include_dir}" + INTERFACE_LINK_LIBRARIES + "${rest_shared_lib_paths}" + IMPORTED_LOCATION + "${first_shared_lib_path}") + get_target_property(shared_lib ${target_shared} IMPORTED_LOCATION) + + find_library(${prefix}_static_lib + NAMES "${static_lib_name}" + PATHS "${lib_dir}" + NO_DEFAULT_PATH) + set(static_lib "${${prefix}_static_lib}") + set(${prefix}_STATIC_LIB "${static_lib}" PARENT_SCOPE) + if(static_lib) + add_library(${target_static} STATIC IMPORTED) + set_target_properties(${target_static} + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dir}" + IMPORTED_LOCATION "${static_lib}") + endif() + endif() +endmacro() + +function(arrow_find_package + prefix + home + base_name + header_path + cmake_package_name + pkg_config_name) + arrow_build_shared_library_name(shared_lib_name ${base_name}) + arrow_build_import_library_name(import_lib_name ${base_name}) + arrow_build_static_library_name(static_lib_name ${base_name}) + + set(target_shared ${base_name}_shared) + set(target_static ${base_name}_static) + + if(home) + arrow_find_package_home() + set(${prefix}_FIND_APPROACH "HOME: ${home}" PARENT_SCOPE) + else() + arrow_find_package_cmake_package_configuration() + if(${cmake_package_name}_FOUND) + set(${prefix}_FIND_APPROACH + "CMake package configuration: ${cmake_package_name}" + PARENT_SCOPE) + else() + arrow_find_package_pkg_config() + set(${prefix}_FIND_APPROACH "pkg-config: ${pkg_config_name}" PARENT_SCOPE) + endif() + endif() + + if(NOT include_dir) + if(TARGET ${target_shared}) + get_target_property(include_dir ${target_shared} INTERFACE_INCLUDE_DIRECTORIES) + elseif(TARGET ${target_static}) + get_target_property(include_dir ${target_static} INTERFACE_INCLUDE_DIRECTORIES) + endif() + endif() + if(include_dir) + set(${prefix}_INCLUDE_DIR "${include_dir}" PARENT_SCOPE) + endif() + + if(shared_lib) + get_filename_component(lib_dir "${shared_lib}" DIRECTORY) + elseif(static_lib) + get_filename_component(lib_dir "${static_lib}" DIRECTORY) + else() + set(lib_dir NOTFOUND) + endif() + set(${prefix}_LIB_DIR "${lib_dir}" PARENT_SCOPE) + # For backward compatibility + set(${prefix}_LIBS "${lib_dir}" PARENT_SCOPE) +endfunction() + +if(NOT "$ENV{ARROW_HOME}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{ARROW_HOME}" ARROW_HOME) +endif() +arrow_find_package(ARROW + "${ARROW_HOME}" + arrow + arrow/api.h + Arrow + arrow) + +if(ARROW_HOME) + if(ARROW_INCLUDE_DIR) + file(READ "${ARROW_INCLUDE_DIR}/arrow/util/config.h" ARROW_CONFIG_H_CONTENT) + arrow_extract_macro_value(ARROW_VERSION_MAJOR "ARROW_VERSION_MAJOR" + "${ARROW_CONFIG_H_CONTENT}") + arrow_extract_macro_value(ARROW_VERSION_MINOR "ARROW_VERSION_MINOR" + "${ARROW_CONFIG_H_CONTENT}") + arrow_extract_macro_value(ARROW_VERSION_PATCH "ARROW_VERSION_PATCH" + "${ARROW_CONFIG_H_CONTENT}") + if("${ARROW_VERSION_MAJOR}" STREQUAL "" + OR "${ARROW_VERSION_MINOR}" STREQUAL "" + OR "${ARROW_VERSION_PATCH}" STREQUAL "") + set(ARROW_VERSION "0.0.0") + else() + set(ARROW_VERSION + "${ARROW_VERSION_MAJOR}.${ARROW_VERSION_MINOR}.${ARROW_VERSION_PATCH}") + endif() + + arrow_extract_macro_value(ARROW_SO_VERSION_QUOTED "ARROW_SO_VERSION" + "${ARROW_CONFIG_H_CONTENT}") + string(REGEX REPLACE "^\"(.+)\"$" "\\1" ARROW_SO_VERSION "${ARROW_SO_VERSION_QUOTED}") + arrow_extract_macro_value(ARROW_FULL_SO_VERSION_QUOTED "ARROW_FULL_SO_VERSION" + "${ARROW_CONFIG_H_CONTENT}") + string(REGEX + REPLACE "^\"(.+)\"$" "\\1" ARROW_FULL_SO_VERSION + "${ARROW_FULL_SO_VERSION_QUOTED}") + endif() +else() + if(ARROW_USE_CMAKE_PACKAGE_CONFIG) + find_package(Arrow CONFIG) + elseif(ARROW_USE_PKG_CONFIG) + pkg_get_variable(ARROW_SO_VERSION arrow so_version) + pkg_get_variable(ARROW_FULL_SO_VERSION arrow full_so_version) + endif() +endif() + +set(ARROW_ABI_VERSION ${ARROW_SO_VERSION}) + +mark_as_advanced(ARROW_ABI_VERSION + ARROW_CONFIG_SUFFIXES + ARROW_FULL_SO_VERSION + ARROW_IMPORT_LIB + ARROW_INCLUDE_DIR + ARROW_LIBS + ARROW_LIB_DIR + ARROW_SEARCH_LIB_PATH_SUFFIXES + ARROW_SHARED_IMP_LIB + ARROW_SHARED_LIB + ARROW_SO_VERSION + ARROW_STATIC_LIB + ARROW_VERSION + ARROW_VERSION_MAJOR + ARROW_VERSION_MINOR + ARROW_VERSION_PATCH) + +find_package_handle_standard_args(Arrow REQUIRED_VARS + # The first required variable is shown + # in the found message. So this list is + # not sorted alphabetically. + ARROW_INCLUDE_DIR + ARROW_LIB_DIR + ARROW_FULL_SO_VERSION + ARROW_SO_VERSION + VERSION_VAR + ARROW_VERSION) +set(ARROW_FOUND ${Arrow_FOUND}) + +if(Arrow_FOUND AND NOT Arrow_FIND_QUIETLY) + message(STATUS "Arrow version: ${ARROW_VERSION} (${ARROW_FIND_APPROACH})") + message(STATUS "Arrow SO and ABI version: ${ARROW_SO_VERSION}") + message(STATUS "Arrow full SO version: ${ARROW_FULL_SO_VERSION}") + message(STATUS "Found the Arrow core shared library: ${ARROW_SHARED_LIB}") + message(STATUS "Found the Arrow core import library: ${ARROW_IMPORT_LIB}") + message(STATUS "Found the Arrow core static library: ${ARROW_STATIC_LIB}") endif() diff --git a/cmake/Modules/FindParquet.cmake b/cmake/Modules/FindParquet.cmake index ab9c31efe2d..654020c0b87 100644 --- a/cmake/Modules/FindParquet.cmake +++ b/cmake/Modules/FindParquet.cmake @@ -17,131 +17,116 @@ # specific language governing permissions and limitations # under the License. -# - Find PARQUET (parquet/parquet.h, libparquet.a, libparquet.so) +# - Find Parquet (parquet/api/reader.h, libparquet.a, libparquet.so) +# +# This module requires Arrow from which it uses +# arrow_find_package() +# # This module defines +# PARQUET_FOUND, whether Parquet has been found +# PARQUET_IMPORT_LIB, path to libparquet's import library (Windows only) # PARQUET_INCLUDE_DIR, directory containing headers -# PARQUET_LIBS, directory containing parquet libraries -# PARQUET_STATIC_LIB, path to libparquet.a +# PARQUET_LIBS, deprecated. Use PARQUET_LIB_DIR instead +# PARQUET_LIB_DIR, directory containing Parquet libraries +# PARQUET_SHARED_IMP_LIB, deprecated. Use PARQUET_IMPORT_LIB instead # PARQUET_SHARED_LIB, path to libparquet's shared library -# PARQUET_SHARED_IMP_LIB, path to libparquet's import library (MSVC only) -# PARQUET_FOUND, whether parquet has been found +# PARQUET_SO_VERSION, shared object version of found Parquet such as "100" +# PARQUET_STATIC_LIB, path to libparquet.a -include(FindPkgConfig) +if(DEFINED PARQUET_FOUND) + return() +endif() + +set(find_package_arguments) +if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) + list(APPEND find_package_arguments "${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION}") +endif() +if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + list(APPEND find_package_arguments REQUIRED) +endif() +if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + list(APPEND find_package_arguments QUIET) +endif() +find_package(Arrow ${find_package_arguments}) if(NOT "$ENV{PARQUET_HOME}" STREQUAL "") - set(PARQUET_HOME "$ENV{PARQUET_HOME}") + file(TO_CMAKE_PATH "$ENV{PARQUET_HOME}" PARQUET_HOME) endif() -if (MSVC) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll") +if((NOT PARQUET_HOME) AND ARROW_HOME) + set(PARQUET_HOME ${ARROW_HOME}) +endif() - if (MSVC AND NOT DEFINED PARQUET_MSVC_STATIC_LIB_SUFFIX) - set(PARQUET_MSVC_STATIC_LIB_SUFFIX "_static") - endif() - - find_library(PARQUET_SHARED_LIBRARIES NAMES parquet - PATHS ${PARQUET_HOME} NO_DEFAULT_PATH - PATH_SUFFIXES "bin" ) - - get_filename_component(PARQUET_SHARED_LIBS ${PARQUET_SHARED_LIBRARIES} PATH ) -endif () - -if(PARQUET_HOME) - set(PARQUET_SEARCH_HEADER_PATHS - ${PARQUET_HOME}/include - ) - set(PARQUET_SEARCH_LIB_PATH - ${PARQUET_HOME}/lib - ) - find_path(PARQUET_INCLUDE_DIR parquet/api/reader.h PATHS - ${PARQUET_SEARCH_HEADER_PATHS} - # make sure we don't accidentally pick up a different version - NO_DEFAULT_PATH - ) - find_library(PARQUET_LIBRARIES NAMES parquet - PATHS ${PARQUET_HOME} NO_DEFAULT_PATH - PATH_SUFFIXES "lib") - get_filename_component(PARQUET_LIBS ${PARQUET_LIBRARIES} PATH ) - - # Try to autodiscover the Parquet ABI version - get_filename_component(PARQUET_LIB_REALPATH ${PARQUET_LIBRARIES} REALPATH) - get_filename_component(PARQUET_EXT_REALPATH ${PARQUET_LIB_REALPATH} EXT) - string(REGEX MATCH ".([0-9]+.[0-9]+.[0-9]+)" HAS_ABI_VERSION ${PARQUET_EXT_REALPATH}) - if (HAS_ABI_VERSION) - if (APPLE) - string(REGEX REPLACE ".([0-9]+.[0-9]+.[0-9]+).dylib" "\\1" PARQUET_ABI_VERSION ${PARQUET_EXT_REALPATH}) +if(ARROW_FOUND) + arrow_find_package(PARQUET + "${PARQUET_HOME}" + parquet + parquet/api/reader.h + Parquet + parquet) + if(PARQUET_HOME) + if(PARQUET_INCLUDE_DIR) + file(READ "${PARQUET_INCLUDE_DIR}/parquet/parquet_version.h" + PARQUET_VERSION_H_CONTENT) + arrow_extract_macro_value(PARQUET_VERSION_MAJOR "PARQUET_VERSION_MAJOR" + "${PARQUET_VERSION_H_CONTENT}") + arrow_extract_macro_value(PARQUET_VERSION_MINOR "PARQUET_VERSION_MINOR" + "${PARQUET_VERSION_H_CONTENT}") + arrow_extract_macro_value(PARQUET_VERSION_PATCH "PARQUET_VERSION_PATCH" + "${PARQUET_VERSION_H_CONTENT}") + if("${PARQUET_VERSION_MAJOR}" STREQUAL "" + OR "${PARQUET_VERSION_MINOR}" STREQUAL "" + OR "${PARQUET_VERSION_PATCH}" STREQUAL "") + set(PARQUET_VERSION "0.0.0") else() - string(REGEX REPLACE ".so.([0-9]+.[0-9]+.[0-9]+)" "\\1" PARQUET_ABI_VERSION ${PARQUET_EXT_REALPATH}) + set(PARQUET_VERSION + "${PARQUET_VERSION_MAJOR}.${PARQUET_VERSION_MINOR}.${PARQUET_VERSION_PATCH}") endif() - string(REGEX REPLACE "([0-9]+).[0-9]+.[0-9]+" "\\1" PARQUET_SO_VERSION ${PARQUET_ABI_VERSION}) - else() - set(PARQUET_ABI_VERSION "1.0.0") - set(PARQUET_SO_VERSION "1") + + arrow_extract_macro_value(PARQUET_SO_VERSION_QUOTED "PARQUET_SO_VERSION" + "${PARQUET_VERSION_H_CONTENT}") + string(REGEX + REPLACE "^\"(.+)\"$" "\\1" PARQUET_SO_VERSION "${PARQUET_SO_VERSION_QUOTED}") + arrow_extract_macro_value(PARQUET_FULL_SO_VERSION_QUOTED "PARQUET_FULL_SO_VERSION" + "${PARQUET_VERSION_H_CONTENT}") + string(REGEX + REPLACE "^\"(.+)\"$" "\\1" PARQUET_FULL_SO_VERSION + "${PARQUET_FULL_SO_VERSION_QUOTED}") endif() -else() - pkg_check_modules(PARQUET parquet) - if (PARQUET_FOUND) - pkg_get_variable(PARQUET_ABI_VERSION parquet abi_version) - message(STATUS "Parquet C++ ABI version: ${PARQUET_ABI_VERSION}") - pkg_get_variable(PARQUET_SO_VERSION parquet so_version) - message(STATUS "Parquet C++ SO version: ${PARQUET_SO_VERSION}") - set(PARQUET_INCLUDE_DIR ${PARQUET_INCLUDE_DIRS}) - set(PARQUET_LIBS ${PARQUET_LIBRARY_DIRS}) - set(PARQUET_SEARCH_LIB_PATH ${PARQUET_LIBRARY_DIRS}) - message(STATUS "Searching for parquet libs in: ${PARQUET_SEARCH_LIB_PATH}") - find_library(PARQUET_LIBRARIES NAMES parquet - PATHS ${PARQUET_SEARCH_LIB_PATH} NO_DEFAULT_PATH) - else() - find_path(PARQUET_INCLUDE_DIR NAMES parquet/api/reader.h ) - find_library(PARQUET_LIBRARIES NAMES parquet) - get_filename_component(PARQUET_LIBS ${PARQUET_LIBRARIES} PATH ) + else() + if(PARQUET_USE_CMAKE_PACKAGE_CONFIG) + find_package(Parquet CONFIG) + elseif(PARQUET_USE_PKG_CONFIG) + pkg_get_variable(PARQUET_SO_VERSION parquet so_version) + pkg_get_variable(PARQUET_FULL_SO_VERSION parquet full_so_version) endif() + endif() + set(PARQUET_ABI_VERSION "${PARQUET_SO_VERSION}") endif() -if (PARQUET_INCLUDE_DIR AND PARQUET_LIBRARIES) - set(PARQUET_FOUND TRUE) - set(PARQUET_LIB_NAME parquet) - if (MSVC) - set(PARQUET_STATIC_LIB "${PARQUET_LIBS}/${PARQUET_LIB_NAME}${PARQUET_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(PARQUET_SHARED_LIB "${PARQUET_SHARED_LIBS}/${PARQUET_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}") - set(PARQUET_SHARED_IMP_LIB "${PARQUET_LIBS}/${PARQUET_LIB_NAME}.lib") - else() - set(PARQUET_STATIC_LIB ${PARQUET_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${PARQUET_LIB_NAME}.a) - set(PARQUET_SHARED_LIB ${PARQUET_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${PARQUET_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) - endif() -else () - set(PARQUET_FOUND FALSE) -endif () +mark_as_advanced(PARQUET_ABI_VERSION + PARQUET_IMPORT_LIB + PARQUET_INCLUDE_DIR + PARQUET_LIBS + PARQUET_LIB_DIR + PARQUET_SHARED_IMP_LIB + PARQUET_SHARED_LIB + PARQUET_SO_VERSION + PARQUET_STATIC_LIB + PARQUET_VERSION) -if (PARQUET_FOUND) - if (NOT Parquet_FIND_QUIETLY) - message(STATUS "Found the Parquet library: ${PARQUET_LIBRARIES}") - endif () -else () - if (NOT Parquet_FIND_QUIETLY) - if (NOT PARQUET_FOUND) - set(PARQUET_ERR_MSG "${PARQUET_ERR_MSG} Could not find the parquet library.") - endif() +find_package_handle_standard_args(Parquet + REQUIRED_VARS + PARQUET_INCLUDE_DIR + PARQUET_LIB_DIR + PARQUET_SO_VERSION + VERSION_VAR + PARQUET_VERSION) +set(PARQUET_FOUND ${Parquet_FOUND}) - set(PARQUET_ERR_MSG "${PARQUET_ERR_MSG} Looked in ") - if ( _parquet_roots ) - set(PARQUET_ERR_MSG "${PARQUET_ERR_MSG} in ${_parquet_roots}.") - else () - set(PARQUET_ERR_MSG "${PARQUET_ERR_MSG} system search paths.") - endif () - if (Parquet_FIND_REQUIRED) - message(FATAL_ERROR "${PARQUET_ERR_MSG}") - else (Parquet_FIND_REQUIRED) - message(STATUS "${PARQUET_ERR_MSG}") - endif (Parquet_FIND_REQUIRED) - endif () -endif () - -mark_as_advanced( - PARQUET_FOUND - PARQUET_INCLUDE_DIR - PARQUET_LIBS - PARQUET_LIBRARIES - PARQUET_STATIC_LIB - PARQUET_SHARED_LIB -) +if(Parquet_FOUND AND NOT Parquet_FIND_QUIETLY) + message(STATUS "Parquet version: ${PARQUET_VERSION} (${PARQUET_FIND_APPROACH})") + message(STATUS "Found the Parquet shared library: ${PARQUET_SHARED_LIB}") + message(STATUS "Found the Parquet import library: ${PARQUET_IMPORT_LIB}") + message(STATUS "Found the Parquet static library: ${PARQUET_STATIC_LIB}") +endif() diff --git a/cmake/analysis.cmake b/cmake/analysis.cmake index 287c36a8de7..daaa730ac4b 100644 --- a/cmake/analysis.cmake +++ b/cmake/analysis.cmake @@ -12,7 +12,9 @@ if (ENABLE_CLANG_TIDY) set (USE_CLANG_TIDY 1) # The variable CMAKE_CXX_CLANG_TIDY will be set inside src and base directories with non third-party code. # set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}") + elseif (FAIL_ON_UNSUPPORTED_OPTIONS_COMBINATION) + message(FATAL_ERROR "clang-tidy is not found") else () - message(STATUS "clang-tidy is not found. This is normal - the tool is used only for static code analysis and not essential for build.") + message(STATUS "clang-tidy is not found. This is normal - the tool is only used for static code analysis and isn't essential for the build.") endif () endif () diff --git a/cmake/autogenerated_versions.txt b/cmake/autogenerated_versions.txt index ebb9bdcf568..27586821af2 100644 --- a/cmake/autogenerated_versions.txt +++ b/cmake/autogenerated_versions.txt @@ -1,9 +1,9 @@ # This strings autochanged from release_lib.sh: -SET(VERSION_REVISION 54438) +SET(VERSION_REVISION 54439) SET(VERSION_MAJOR 20) -SET(VERSION_MINOR 8) +SET(VERSION_MINOR 9) SET(VERSION_PATCH 1) -SET(VERSION_GITHASH 5d60ab33a511efd149c7c3de77c0dd4b81e65b13) -SET(VERSION_DESCRIBE v20.8.1.1-prestable) -SET(VERSION_STRING 20.8.1.1) +SET(VERSION_GITHASH 0586f0d555f7481b394afc55bbb29738cd573a1c) +SET(VERSION_DESCRIBE v20.9.1.1-prestable) +SET(VERSION_STRING 20.9.1.1) # end of autochange diff --git a/cmake/contrib_finder.cmake b/cmake/contrib_finder.cmake index f9bf3ce2837..64c6d5f5c0a 100644 --- a/cmake/contrib_finder.cmake +++ b/cmake/contrib_finder.cmake @@ -8,6 +8,9 @@ macro(find_contrib_lib LIB_NAME) if (NOT USE_INTERNAL_${LIB_NAME_UC}_LIBRARY) find_package ("${LIB_NAME}") + if (NOT ${LIB_NAME_UC}_FOUND) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use system ${LIB_NAME}") + endif() endif () if (NOT ${LIB_NAME_UC}_FOUND) @@ -17,5 +20,4 @@ macro(find_contrib_lib LIB_NAME) endif () message (STATUS "Using ${LIB_NAME}: ${${LIB_NAME_UC}_INCLUDE_DIR} : ${${LIB_NAME_UC}_LIBRARIES}") - endmacro() diff --git a/cmake/find/amqpcpp.cmake b/cmake/find/amqpcpp.cmake index b3e193c72ff..4191dce26bb 100644 --- a/cmake/find/amqpcpp.cmake +++ b/cmake/find/amqpcpp.cmake @@ -1,21 +1,22 @@ option(ENABLE_AMQPCPP "Enalbe AMQP-CPP" ${ENABLE_LIBRARIES}) +if (NOT ENABLE_AMQPCPP) + return() +endif() + if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/AMQP-CPP/CMakeLists.txt") message (WARNING "submodule contrib/AMQP-CPP is missing. to fix try run: \n git submodule update --init --recursive") - set (ENABLE_AMQPCPP 0) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal AMQP-CPP library") + set (USE_AMQPCPP 0) + return() endif () -if (ENABLE_AMQPCPP) +set (USE_AMQPCPP 1) +set (AMQPCPP_LIBRARY AMQP-CPP) - set (USE_AMQPCPP 1) - set (AMQPCPP_LIBRARY AMQP-CPP) - - set (AMQPCPP_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/AMQP-CPP/include") - - list (APPEND AMQPCPP_INCLUDE_DIR - "${ClickHouse_SOURCE_DIR}/contrib/AMQP-CPP/include" - "${ClickHouse_SOURCE_DIR}/contrib/AMQP-CPP") - -endif() +set (AMQPCPP_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/AMQP-CPP/include") +list (APPEND AMQPCPP_INCLUDE_DIR + "${ClickHouse_SOURCE_DIR}/contrib/AMQP-CPP/include" + "${ClickHouse_SOURCE_DIR}/contrib/AMQP-CPP") message (STATUS "Using AMQP-CPP=${USE_AMQPCPP}: ${AMQPCPP_INCLUDE_DIR} : ${AMQPCPP_LIBRARY}") diff --git a/cmake/find/avro.cmake b/cmake/find/avro.cmake index cdb3fc84d3d..e0f73d99111 100644 --- a/cmake/find/avro.cmake +++ b/cmake/find/avro.cmake @@ -1,28 +1,35 @@ option (ENABLE_AVRO "Enable Avro" ${ENABLE_LIBRARIES}) -if (ENABLE_AVRO) +if (NOT ENABLE_AVRO) + if (USE_INTERNAL_AVRO_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal avro library with ENABLE_AVRO=OFF") + endif() + return() +endif() -option (USE_INTERNAL_AVRO_LIBRARY "Set to FALSE to use system avro library instead of bundled" ${NOT_UNBUNDLED}) +option (USE_INTERNAL_AVRO_LIBRARY + "Set to FALSE to use system avro library instead of bundled" ON) # TODO: provide unbundled support -if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/avro/lang/c++/CMakeLists.txt") - if(USE_INTERNAL_AVRO_LIBRARY) +if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/avro/lang/c++/CMakeLists.txt") + if (USE_INTERNAL_AVRO_LIBRARY) message(WARNING "submodule contrib/avro is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot find internal avro") + set(USE_INTERNAL_AVRO_LIBRARY 0) endif() set(MISSING_INTERNAL_AVRO_LIBRARY 1) - set(USE_INTERNAL_AVRO_LIBRARY 0) endif() if (NOT USE_INTERNAL_AVRO_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Using system avro library is not supported yet") elseif(NOT MISSING_INTERNAL_AVRO_LIBRARY) include(cmake/find/snappy.cmake) set(AVROCPP_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/avro/lang/c++/include") set(AVROCPP_LIBRARY avrocpp) + set(USE_INTERNAL_AVRO_LIBRARY 1) endif () if (AVROCPP_LIBRARY AND AVROCPP_INCLUDE_DIR) set(USE_AVRO 1) endif() -endif() - message (STATUS "Using avro=${USE_AVRO}: ${AVROCPP_INCLUDE_DIR} : ${AVROCPP_LIBRARY}") diff --git a/cmake/find/base64.cmake b/cmake/find/base64.cmake index f72397597d7..7427baf9cad 100644 --- a/cmake/find/base64.cmake +++ b/cmake/find/base64.cmake @@ -1,17 +1,21 @@ +option (ENABLE_BASE64 "Enable base64" ${ENABLE_LIBRARIES}) + +if (NOT ENABLE_BASE64) + return() +endif() + if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/base64/LICENSE") set (MISSING_INTERNAL_BASE64_LIBRARY 1) message (WARNING "submodule contrib/base64 is missing. to fix try run: \n git submodule update --init --recursive") endif () -if (NOT MISSING_INTERNAL_BASE64_LIBRARY) - option (ENABLE_BASE64 "Enable base64" ${ENABLE_LIBRARIES}) -endif () +if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/base64") + message (WARNING "submodule contrib/base64 is missing. to fix try run: \n git submodule update --init --recursive") +else() + set (BASE64_LIBRARY base64) + set (USE_BASE64 1) +endif() -if (ENABLE_BASE64) - if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/base64") - message (WARNING "submodule contrib/base64 is missing. to fix try run: \n git submodule update --init --recursive") - else() - set (BASE64_LIBRARY base64) - set (USE_BASE64 1) - endif() -endif () +if (NOT USE_BASE64) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot enable base64") +endif() diff --git a/cmake/find/brotli.cmake b/cmake/find/brotli.cmake index 5453cf15236..bf498802922 100644 --- a/cmake/find/brotli.cmake +++ b/cmake/find/brotli.cmake @@ -1,12 +1,23 @@ option (ENABLE_BROTLI "Enable brotli" ${ENABLE_LIBRARIES}) -if (ENABLE_BROTLI) +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" ${NOT_UNBUNDLED}) +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() 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 --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot find internal brotli") set (USE_INTERNAL_BROTLI_LIBRARY 0) endif () set (MISSING_INTERNAL_BROTLI_LIBRARY 1) @@ -19,18 +30,18 @@ if(NOT USE_INTERNAL_BROTLI_LIBRARY) 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 (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 () -endif() - message (STATUS "Using brotli=${USE_BROTLI}: ${BROTLI_INCLUDE_DIR} : ${BROTLI_LIBRARY}") diff --git a/cmake/find/capnp.cmake b/cmake/find/capnp.cmake index 0620a66808b..ee4735bd175 100644 --- a/cmake/find/capnp.cmake +++ b/cmake/find/capnp.cmake @@ -1,15 +1,21 @@ option (ENABLE_CAPNP "Enable Cap'n Proto" ${ENABLE_LIBRARIES}) -if (ENABLE_CAPNP) +if (NOT ENABLE_CAPNP) + if (USE_INTERNAL_CAPNP_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal capnproto library with ENABLE_CAPNP=OFF") + endif() + return() +endif() option (USE_INTERNAL_CAPNP_LIBRARY "Set to FALSE to use system capnproto library instead of bundled" ${NOT_UNBUNDLED}) if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/capnproto/CMakeLists.txt") if(USE_INTERNAL_CAPNP_LIBRARY) message(WARNING "submodule contrib/capnproto is missing. to fix try run: \n git submodule update --init --recursive") + message(${RECONFIGURE_MESSAGE_LEVEL} "cannot find internal capnproto") + set(USE_INTERNAL_CAPNP_LIBRARY 0) endif() set(MISSING_INTERNAL_CAPNP_LIBRARY 1) - set(USE_INTERNAL_CAPNP_LIBRARY 0) endif() # FIXME: refactor to use `add_library(… IMPORTED)` if possible. @@ -18,17 +24,21 @@ if (NOT USE_INTERNAL_CAPNP_LIBRARY) find_library (CAPNP capnp) find_library (CAPNPC capnpc) - set (CAPNP_LIBRARIES ${CAPNPC} ${CAPNP} ${KJ}) + if(KJ AND CAPNP AND CAPNPC) + set (CAPNP_LIBRARIES ${CAPNPC} ${CAPNP} ${KJ}) + else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system capnproto") + endif() +endif() + +if (CAPNP_LIBRARIES) + set (USE_CAPNP 1) elseif(NOT MISSING_INTERNAL_CAPNP_LIBRARY) add_subdirectory(contrib/capnproto-cmake) set (CAPNP_LIBRARIES capnpc) -endif () - -if (CAPNP_LIBRARIES) set (USE_CAPNP 1) -endif () - + set (USE_INTERNAL_CAPNP_LIBRARY 1) endif () message (STATUS "Using capnp=${USE_CAPNP}: ${CAPNP_LIBRARIES}") diff --git a/cmake/find/cassandra.cmake b/cmake/find/cassandra.cmake index 6ff7697ea57..037d6c3f131 100644 --- a/cmake/find/cassandra.cmake +++ b/cmake/find/cassandra.cmake @@ -1,29 +1,33 @@ option(ENABLE_CASSANDRA "Enable Cassandra" ${ENABLE_LIBRARIES}) -if (ENABLE_CASSANDRA) - if (APPLE) - SET(CMAKE_MACOSX_RPATH ON) - endif() +if (NOT ENABLE_CASSANDRA) + return() +endif() - if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libuv") - message (ERROR "submodule contrib/libuv is missing. to fix try run: \n git submodule update --init --recursive") - elseif (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cassandra") - message (ERROR "submodule contrib/cassandra is missing. to fix try run: \n git submodule update --init --recursive") +if (APPLE) + set(CMAKE_MACOSX_RPATH ON) +endif() + +if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libuv") + message (ERROR "submodule contrib/libuv is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal libuv needed for Cassandra") +elseif (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cassandra") + message (ERROR "submodule contrib/cassandra is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal Cassandra") +else() + set (LIBUV_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/libuv") + set (CASSANDRA_INCLUDE_DIR + "${ClickHouse_SOURCE_DIR}/contrib/cassandra/include/") + if (MAKE_STATIC_LIBRARIES) + set (LIBUV_LIBRARY uv_a) + set (CASSANDRA_LIBRARY cassandra_static) else() - set (LIBUV_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/libuv") - set (CASSANDRA_INCLUDE_DIR - "${ClickHouse_SOURCE_DIR}/contrib/cassandra/include/") - if (USE_STATIC_LIBRARIES) - set (LIBUV_LIBRARY uv_a) - set (CASSANDRA_LIBRARY cassandra_static) - else() - set (LIBUV_LIBRARY uv) - set (CASSANDRA_LIBRARY cassandra) - endif() - set (USE_CASSANDRA 1) - set (CASS_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/cassandra") - + set (LIBUV_LIBRARY uv) + set (CASSANDRA_LIBRARY cassandra) endif() + + set (USE_CASSANDRA 1) + set (CASS_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/cassandra") endif() message (STATUS "Using cassandra=${USE_CASSANDRA}: ${CASSANDRA_INCLUDE_DIR} : ${CASSANDRA_LIBRARY}") diff --git a/cmake/find/ccache.cmake b/cmake/find/ccache.cmake index 95d6b208cfa..59211e9d304 100644 --- a/cmake/find/ccache.cmake +++ b/cmake/find/ccache.cmake @@ -1,6 +1,25 @@ -find_program (CCACHE_FOUND ccache) +if (CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache" OR CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache") + set(COMPILER_MATCHES_CCACHE 1) +else() + set(COMPILER_MATCHES_CCACHE 0) +endif() -if (CCACHE_FOUND AND NOT CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache" AND NOT CMAKE_CXX_COMPILER MATCHES "ccache") +if ((ENABLE_CCACHE OR NOT DEFINED ENABLE_CCACHE) AND NOT COMPILER_MATCHES_CCACHE) + find_program (CCACHE_FOUND ccache) +endif() + +if (NOT CCACHE_FOUND AND NOT DEFINED ENABLE_CCACHE AND NOT COMPILER_MATCHES_CCACHE) + message(WARNING "CCache is not found. We recommend setting it up if you build ClickHouse from source often. " + "Setting it up will significantly reduce compilation time for 2nd and consequent builds") +endif() + +option(ENABLE_CCACHE "Speedup re-compilations using ccache" ${CCACHE_FOUND}) + +if (NOT ENABLE_CCACHE) + return() +endif() + +if (CCACHE_FOUND AND NOT COMPILER_MATCHES_CCACHE) execute_process(COMMAND ${CCACHE_FOUND} "-V" OUTPUT_VARIABLE CCACHE_VERSION) string(REGEX REPLACE "ccache version ([0-9\\.]+).*" "\\1" CCACHE_VERSION ${CCACHE_VERSION}) @@ -9,6 +28,8 @@ if (CCACHE_FOUND AND NOT CMAKE_CXX_COMPILER_LAUNCHER MATCHES "ccache" AND NOT CM set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND}) set_property (GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_FOUND}) else () - message(STATUS "Not using ${CCACHE_FOUND} ${CCACHE_VERSION} bug: https://bugzilla.samba.org/show_bug.cgi?id=8118") + message(${RECONFIGURE_MESSAGE_LEVEL} "Not using ${CCACHE_FOUND} ${CCACHE_VERSION} bug: https://bugzilla.samba.org/show_bug.cgi?id=8118") endif () +elseif (NOT CCACHE_FOUND AND NOT COMPILER_MATCHES_CCACHE) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use ccache") endif () diff --git a/cmake/find/curl.cmake b/cmake/find/curl.cmake new file mode 100644 index 00000000000..0a9fcc05ccf --- /dev/null +++ b/cmake/find/curl.cmake @@ -0,0 +1,37 @@ +option (ENABLE_CURL "Enable curl" ${ENABLE_LIBRARIES}) + +if (NOT ENABLE_CURL) + if (USE_INTERNAL_CURL) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal curl with ENABLE_CURL=OFF") + endif() + return() +endif() + +option (USE_INTERNAL_CURL "Use internal curl library" ${NOT_UNBUNDLED}) + +if (NOT USE_INTERNAL_CURL) + find_package (CURL) + if (NOT CURL_FOUND) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system curl") + endif() +endif() + +if (NOT CURL_FOUND) + set (USE_INTERNAL_CURL 1) + set (CURL_LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/curl") + + # find_package(CURL) compatibility for the following packages that uses + # find_package(CURL)/include(FindCURL): + # - mariadb-connector-c + # - aws-s3-cmake + # - sentry-native + set (CURL_FOUND ON CACHE BOOL "") + set (CURL_ROOT_DIR ${CURL_LIBRARY_DIR} CACHE PATH "") + set (CURL_INCLUDE_DIR ${CURL_LIBRARY_DIR}/include CACHE PATH "") + set (CURL_INCLUDE_DIRS ${CURL_LIBRARY_DIR}/include CACHE PATH "") + set (CURL_LIBRARY curl CACHE STRING "") + set (CURL_LIBRARIES ${CURL_LIBRARY} CACHE STRING "") + set (CURL_VERSION_STRING 7.67.0 CACHE STRING "") +endif () + +message (STATUS "Using curl: ${CURL_INCLUDE_DIRS} : ${CURL_LIBRARIES}") diff --git a/cmake/find/cxx.cmake b/cmake/find/cxx.cmake index f6c999351e8..02f7113e6fb 100644 --- a/cmake/find/cxx.cmake +++ b/cmake/find/cxx.cmake @@ -1,41 +1,68 @@ -set(USE_INTERNAL_LIBCXX_LIBRARY_DEFAULT ${NOT_UNBUNDLED}) +option (USE_LIBCXX "Use libc++ and libc++abi instead of libstdc++" ${NOT_UNBUNDLED}) -if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libcxx/CMakeLists.txt") - message(WARNING "submodule contrib/libcxx is missing. to fix try run: \n git submodule update --init --recursive") - set(USE_INTERNAL_LIBCXX_LIBRARY_DEFAULT 0) +if (NOT USE_LIBCXX) + if (USE_INTERNAL_LIBCXX_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal libcxx with USE_LIBCXX=OFF") + endif() + target_link_libraries(global-libs INTERFACE -l:libstdc++.a -l:libstdc++fs.a) # Always link these libraries as static + target_link_libraries(global-libs INTERFACE ${EXCEPTION_HANDLING_LIBRARY}) + return() endif() -option (USE_LIBCXX "Use libc++ and libc++abi instead of libstdc++" ${NOT_UNBUNDLED}) +set(USE_INTERNAL_LIBCXX_LIBRARY_DEFAULT ${NOT_UNBUNDLED}) option (USE_INTERNAL_LIBCXX_LIBRARY "Set to FALSE to use system libcxx and libcxxabi libraries instead of bundled" ${USE_INTERNAL_LIBCXX_LIBRARY_DEFAULT}) -if (USE_LIBCXX) - set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_LIBCPP_DEBUG=0") # More checks in debug build. +if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libcxx/CMakeLists.txt") + if (USE_INTERNAL_LIBCXX_LIBRARY) + message(WARNING "submodule contrib/libcxx is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal libcxx") + set(USE_INTERNAL_LIBCXX_LIBRARY 0) + endif() + set(USE_INTERNAL_LIBCXX_LIBRARY_DEFAULT 0) + set(MISSING_INTERNAL_LIBCXX_LIBRARY 1) +endif() - if (NOT USE_INTERNAL_LIBCXX_LIBRARY) - find_library (LIBCXX_LIBRARY c++) - find_library (LIBCXXFS_LIBRARY c++fs) - find_library (LIBCXXABI_LIBRARY c++abi) +set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_LIBCPP_DEBUG=0") # More checks in debug build. - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +if (NOT USE_INTERNAL_LIBCXX_LIBRARY) + find_library (LIBCXX_LIBRARY c++) + find_library (LIBCXXFS_LIBRARY c++fs) + find_library (LIBCXXABI_LIBRARY c++abi) - target_link_libraries(global-libs INTERFACE ${EXCEPTION_HANDLING_LIBRARY}) + if(LIBCXX_LIBRARY AND LIBCXXABI_LIBRARY) # c++fs is now a part of the libc++ + set (HAVE_LIBCXX 1) else () - set (LIBCXX_LIBRARY cxx) - set (LIBCXXABI_LIBRARY cxxabi) - add_subdirectory(contrib/libcxxabi-cmake) - add_subdirectory(contrib/libcxx-cmake) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system libcxx") + endif() - # Exception handling library is embedded into libcxxabi. - endif () + if(NOT LIBCXXFS_LIBRARY) + set(LIBCXXFS_LIBRARY ${LIBCXX_LIBRARY}) + endif() - target_link_libraries(global-libs INTERFACE ${LIBCXX_LIBRARY} ${LIBCXXABI_LIBRARY} ${LIBCXXFS_LIBRARY}) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + + target_link_libraries(global-libs INTERFACE ${EXCEPTION_HANDLING_LIBRARY}) +endif () + +if (NOT HAVE_LIBCXX AND NOT MISSING_INTERNAL_LIBCXX_LIBRARY) + set (LIBCXX_LIBRARY cxx) + set (LIBCXXABI_LIBRARY cxxabi) + add_subdirectory(contrib/libcxxabi-cmake) + add_subdirectory(contrib/libcxx-cmake) + + # Exception handling library is embedded into libcxxabi. set (HAVE_LIBCXX 1) + set(USE_INTERNAL_LIBCXX_LIBRARY 1) +endif () + +if (HAVE_LIBCXX) + target_link_libraries(global-libs INTERFACE ${LIBCXX_LIBRARY} ${LIBCXXABI_LIBRARY} ${LIBCXXFS_LIBRARY}) message (STATUS "Using libcxx: ${LIBCXX_LIBRARY}") message (STATUS "Using libcxxfs: ${LIBCXXFS_LIBRARY}") message (STATUS "Using libcxxabi: ${LIBCXXABI_LIBRARY}") -else () +else() target_link_libraries(global-libs INTERFACE -l:libstdc++.a -l:libstdc++fs.a) # Always link these libraries as static target_link_libraries(global-libs INTERFACE ${EXCEPTION_HANDLING_LIBRARY}) -endif () +endif() diff --git a/cmake/find/fastops.cmake b/cmake/find/fastops.cmake index 1296ba586a0..5ab320bdb7a 100644 --- a/cmake/find/fastops.cmake +++ b/cmake/find/fastops.cmake @@ -1,19 +1,24 @@ if(NOT ARCH_ARM AND NOT OS_FREEBSD AND NOT OS_DARWIN) option(ENABLE_FASTOPS "Enable fast vectorized mathematical functions library by Mikhail Parakhin" ${ENABLE_LIBRARIES}) +elseif(ENABLE_FASTOPS) + message (${RECONFIGURE_MESSAGE_LEVEL} "Fastops library is not supported on ARM, FreeBSD and Darwin") endif() -if(ENABLE_FASTOPS) - if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/fastops/fastops/fastops.h") - message(WARNING "submodule contrib/fastops is missing. to fix try run: \n git submodule update --init --recursive") - set(MISSING_INTERNAL_FASTOPS_LIBRARY 1) - endif() - if(NOT MISSING_INTERNAL_FASTOPS_LIBRARY) - set(USE_FASTOPS 1) - set(FASTOPS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/fastops/) - set(FASTOPS_LIBRARY fastops) - endif() -else() +if(NOT ENABLE_FASTOPS) set(USE_FASTOPS 0) + return() +endif() + +if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/fastops/fastops/fastops.h") + message(WARNING "submodule contrib/fastops is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal fastops library") + set(MISSING_INTERNAL_FASTOPS_LIBRARY 1) +endif() + +if(NOT MISSING_INTERNAL_FASTOPS_LIBRARY) + set(USE_FASTOPS 1) + set(FASTOPS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/fastops/) + set(FASTOPS_LIBRARY fastops) endif() message(STATUS "Using fastops=${USE_FASTOPS}: ${FASTOPS_INCLUDE_DIR} : ${FASTOPS_LIBRARY}") diff --git a/cmake/find/gperf.cmake b/cmake/find/gperf.cmake index 451f5c21571..9b806598c57 100644 --- a/cmake/find/gperf.cmake +++ b/cmake/find/gperf.cmake @@ -1,8 +1,11 @@ -# Check if gperf was installed -find_program(GPERF gperf) -if(GPERF) - option(ENABLE_GPERF "Use gperf function hash generator tool" ${ENABLE_LIBRARIES}) +if(NOT DEFINED ENABLE_GPERF OR ENABLE_GPERF) + # Check if gperf was installed + find_program(GPERF gperf) + if(GPERF) + option(ENABLE_GPERF "Use gperf function hash generator tool" ${ENABLE_LIBRARIES}) + endif() endif() + if (ENABLE_GPERF) if(NOT GPERF) message(FATAL_ERROR "Could not find the program gperf") diff --git a/cmake/find/grpc.cmake b/cmake/find/grpc.cmake index 0019dbd5eed..52d0e042573 100644 --- a/cmake/find/grpc.cmake +++ b/cmake/find/grpc.cmake @@ -1,26 +1,45 @@ option (ENABLE_GRPC "Use gRPC" ${ENABLE_LIBRARIES}) -if (ENABLE_GRPC) - option (USE_INTERNAL_GRPC_LIBRARY "Set to FALSE to use system gRPC library instead of bundled" ${NOT_UNBUNDLED}) - +if (NOT ENABLE_GRPC) if (USE_INTERNAL_GRPC_LIBRARY) - if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/grpc/include/grpc++/grpc++.h") - message(WARNING "submodule contrib/grpc is missing. To fix try run: \n git submodule update --init --recursive") - set (USE_INTERNAL_GRPC_LIBRARY OFF) - elif (NOT USE_PROTOBUF) - message(WARNING "gRPC requires protobuf which is disabled") - set (USE_INTERNAL_GRPC_LIBRARY OFF) - else() - set (GRPC_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/grpc/include") - set (GRPC_LIBRARY "libgrpc++") - set (USE_GRPC ON) - endif() + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal gRPC library with ENABLE_GRPC=OFF") + endif() + return() +endif() + +option (USE_INTERNAL_GRPC_LIBRARY + "Set to FALSE to use system gRPC library instead of bundled. (Experimental. Set to OFF on your own risk)" + ${NOT_UNBUNDLED}) + +if (NOT USE_INTERNAL_GRPC_LIBRARY) + find_package(grpc) + if (NOT GRPC_FOUND) + find_path(GRPC_INCLUDE_DIR grpcpp/grpcpp.h) + find_library(GRPC_LIBRARY grpc++) + endif () + + if (GRPC_INCLUDE_DIR AND GRPC_LIBRARY) + set (USE_GRPC ON) else() - find_package(grpc) - if (GRPC_INCLUDE_DIR AND GRPC_LIBRARY) - set (USE_GRPC ON) - endif() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system gRPC") endif() endif() -message(STATUS "Using gRPC=${USE_GRPC}: ${GRPC_INCLUDE_DIR} : ${GRPC_LIBRARY}") +if (NOT USE_GRPC) + if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/grpc/include/grpc++/grpc++.h") + message (WARNING "submodule contrib/grpc is missing. To fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal gRPC") + set (USE_INTERNAL_GRPC_LIBRARY OFF) + elseif (NOT USE_PROTOBUF) + message (WARNING "gRPC requires protobuf which is disabled") + message (${RECONFIGURE_MESSAGE_LEVEL} "Will not use internal gRPC without protobuf") + set (USE_INTERNAL_GRPC_LIBRARY OFF) + else() + set (GRPC_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/grpc/include") + set (GRPC_LIBRARY "libgrpc++") + set (USE_GRPC ON) + set (USE_INTERNAL_GRPC_LIBRARY ON) + endif() +endif() + +message (STATUS "Using gRPC=${USE_GRPC}: ${GRPC_INCLUDE_DIR} : ${GRPC_LIBRARY}") diff --git a/cmake/find/gtest.cmake b/cmake/find/gtest.cmake index b41c4cc0af8..36e45a1381e 100644 --- a/cmake/find/gtest.cmake +++ b/cmake/find/gtest.cmake @@ -1,22 +1,30 @@ option (ENABLE_GTEST_LIBRARY "Enable gtest library" ${ENABLE_LIBRARIES}) -if (ENABLE_GTEST_LIBRARY) +if (NOT ENABLE_GTEST_LIBRARY) + if(USE_INTERNAL_GTEST_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal Google Test when ENABLE_GTEST_LIBRARY=OFF") + endif() + return() +endif() option (USE_INTERNAL_GTEST_LIBRARY "Set to FALSE to use system Google Test instead of bundled" ${NOT_UNBUNDLED}) if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest/CMakeLists.txt") if (USE_INTERNAL_GTEST_LIBRARY) message (WARNING "submodule contrib/googletest is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal gtest") set (USE_INTERNAL_GTEST_LIBRARY 0) endif () set (MISSING_INTERNAL_GTEST_LIBRARY 1) endif () - if(NOT USE_INTERNAL_GTEST_LIBRARY) # TODO: autodetect of GTEST_SRC_DIR by EXISTS /usr/src/googletest/CMakeLists.txt if(NOT GTEST_SRC_DIR) find_package(GTest) + if (NOT GTEST_INCLUDE_DIRS) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system Google Test") + endif() endif() endif() @@ -26,12 +34,13 @@ if (NOT GTEST_SRC_DIR AND NOT GTEST_INCLUDE_DIRS AND NOT MISSING_INTERNAL_GTEST_ set (GTEST_LIBRARIES gtest) set (GTEST_BOTH_LIBRARIES ${GTEST_MAIN_LIBRARIES} ${GTEST_LIBRARIES}) set (GTEST_INCLUDE_DIRS ${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest) +elseif(USE_INTERNAL_GTEST_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Wouldn't use internal Google Test library") + set (USE_INTERNAL_GTEST_LIBRARY 0) endif () if((GTEST_INCLUDE_DIRS AND GTEST_BOTH_LIBRARIES) OR GTEST_SRC_DIR) set(USE_GTEST 1) endif() -endif() - message (STATUS "Using gtest=${USE_GTEST}: ${GTEST_INCLUDE_DIRS} : ${GTEST_BOTH_LIBRARIES} : ${GTEST_SRC_DIR}") diff --git a/cmake/find/h3.cmake b/cmake/find/h3.cmake index e01f0269507..03b6f32fc3c 100644 --- a/cmake/find/h3.cmake +++ b/cmake/find/h3.cmake @@ -1,28 +1,39 @@ option (ENABLE_H3 "Enable H3" ${ENABLE_LIBRARIES}) -if (ENABLE_H3) +if(NOT ENABLE_H3) + if(USE_INTERNAL_H3_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal h3 library with ENABLE_H3=OFF") + endif () + return() +endif() -option (USE_INTERNAL_H3_LIBRARY "Set to FALSE to use system h3 library instead of bundled" ${NOT_UNBUNDLED}) +option(USE_INTERNAL_H3_LIBRARY "Set to FALSE to use system h3 library instead of bundled" + ON) # we are not aware of any distribution that provides h3 package if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/h3/src/h3lib/include/h3Index.h") if(USE_INTERNAL_H3_LIBRARY) - message(WARNING "submodule contrib/h3 is missing. to fix try run: \n git submodule update --init --recursive") + message(WARNING "submodule contrib/h3 is missing. to fix try run: \n git submodule update --init --recursive") + message(${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal h3 library") + set(USE_INTERNAL_H3_LIBRARY 0) endif() set(MISSING_INTERNAL_H3_LIBRARY 1) - set(USE_INTERNAL_H3_LIBRARY 0) endif() -if (USE_INTERNAL_H3_LIBRARY) - set (H3_LIBRARY h3) - set (H3_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/h3/src/h3lib/include) -elseif (NOT MISSING_INTERNAL_H3_LIBRARY) - find_library (H3_LIBRARY h3) - find_path (H3_INCLUDE_DIR NAMES h3/h3api.h PATHS ${H3_INCLUDE_PATHS}) -endif () +if(NOT USE_INTERNAL_H3_LIBRARY) + find_library(H3_LIBRARY h3) + find_path(H3_INCLUDE_DIR NAMES h3/h3api.h PATHS ${H3_INCLUDE_PATHS}) + + if(NOT H3_LIBRARY OR NOT H3_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system h3 library") + endif() +endif() if (H3_LIBRARY AND H3_INCLUDE_DIR) set (USE_H3 1) -endif () - -endif () +elseif(NOT MISSING_INTERNAL_H3_LIBRARY) + set (H3_LIBRARY h3) + set (H3_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/h3/src/h3lib/include") + set (USE_H3 1) + set (USE_INTERNAL_H3_LIBRARY 1) +endif() message (STATUS "Using h3=${USE_H3}: ${H3_INCLUDE_DIR} : ${H3_LIBRARY}") diff --git a/cmake/find/hdfs3.cmake b/cmake/find/hdfs3.cmake index 6a0d01d2245..7b385f24e1e 100644 --- a/cmake/find/hdfs3.cmake +++ b/cmake/find/hdfs3.cmake @@ -1,34 +1,45 @@ if(NOT ARCH_ARM AND NOT OS_FREEBSD AND NOT APPLE AND USE_PROTOBUF) option(ENABLE_HDFS "Enable HDFS" ${ENABLE_LIBRARIES}) +elseif(ENABLE_HDFS OR USE_INTERNAL_HDFS3_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use HDFS3 with current configuration") endif() -if(ENABLE_HDFS) -option(USE_INTERNAL_HDFS3_LIBRARY "Set to FALSE to use system HDFS3 instead of bundled" ${NOT_UNBUNDLED}) +if(NOT ENABLE_HDFS) + if(USE_INTERNAL_HDFS3_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal HDFS3 library with ENABLE_HDFS3=OFF") + endif() + return() +endif() + +option(USE_INTERNAL_HDFS3_LIBRARY "Set to FALSE to use system HDFS3 instead of bundled (experimental - set to OFF on your own risk)" + ON) # We don't know any linux distribution with package for it if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libhdfs3/include/hdfs/hdfs.h") if(USE_INTERNAL_HDFS3_LIBRARY) - message(WARNING "submodule contrib/libhdfs3 is missing. to fix try run: \n git submodule update --init --recursive") + message(WARNING "submodule contrib/libhdfs3 is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal HDFS3 library") + set(USE_INTERNAL_HDFS3_LIBRARY 0) endif() set(MISSING_INTERNAL_HDFS3_LIBRARY 1) - set(USE_INTERNAL_HDFS3_LIBRARY 0) endif() if(NOT USE_INTERNAL_HDFS3_LIBRARY) find_library(HDFS3_LIBRARY hdfs3) find_path(HDFS3_INCLUDE_DIR NAMES hdfs/hdfs.h PATHS ${HDFS3_INCLUDE_PATHS}) + if(NOT HDFS3_LIBRARY OR NOT HDFS3_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot find system HDFS3 library") + endif() endif() if(HDFS3_LIBRARY AND HDFS3_INCLUDE_DIR) set(USE_HDFS 1) -elseif(NOT MISSING_INTERNAL_HDFS3_LIBRARY AND LIBGSASL_LIBRARY AND LIBXML2_LIBRARY) +elseif(NOT MISSING_INTERNAL_HDFS3_LIBRARY AND LIBGSASL_LIBRARY AND LIBXML2_LIBRARIES) set(HDFS3_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libhdfs3/include") set(HDFS3_LIBRARY hdfs3) set(USE_INTERNAL_HDFS3_LIBRARY 1) set(USE_HDFS 1) else() - set(USE_INTERNAL_HDFS3_LIBRARY 0) -endif() - + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannout enable HDFS3") endif() message(STATUS "Using hdfs3=${USE_HDFS}: ${HDFS3_INCLUDE_DIR} : ${HDFS3_LIBRARY}") diff --git a/cmake/find/icu.cmake b/cmake/find/icu.cmake index 7beb25626b9..40fb391656d 100644 --- a/cmake/find/icu.cmake +++ b/cmake/find/icu.cmake @@ -4,13 +4,20 @@ else () option(ENABLE_ICU "Enable ICU" 0) endif () -if (ENABLE_ICU) +if (NOT ENABLE_ICU) + if(USE_INTERNAL_ICU_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal icu library with ENABLE_ICU=OFF") + endif() + message(STATUS "Build without ICU (support for collations and charset conversion functions will be disabled)") + return() +endif() option (USE_INTERNAL_ICU_LIBRARY "Set to FALSE to use system ICU library instead of bundled" ${NOT_UNBUNDLED}) if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/icu/icu4c/LICENSE") if (USE_INTERNAL_ICU_LIBRARY) message (WARNING "submodule contrib/icu is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal ICU") set (USE_INTERNAL_ICU_LIBRARY 0) endif () set (MISSING_INTERNAL_ICU_LIBRARY 1) @@ -24,6 +31,8 @@ if(NOT USE_INTERNAL_ICU_LIBRARY) #set (ICU_LIBRARIES ${ICU_I18N_LIBRARY} ${ICU_UC_LIBRARY} ${ICU_DATA_LIBRARY} CACHE STRING "") if(ICU_FOUND) set(USE_ICU 1) + else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system ICU") endif() endif() @@ -35,8 +44,6 @@ elseif (NOT MISSING_INTERNAL_ICU_LIBRARY) set (USE_ICU 1) endif () -endif() - if(USE_ICU) message(STATUS "Using icu=${USE_ICU}: ${ICU_INCLUDE_DIR} : ${ICU_LIBRARIES}") else() diff --git a/cmake/find/ldap.cmake b/cmake/find/ldap.cmake index 99c9007d6b5..369c1e42e8d 100644 --- a/cmake/find/ldap.cmake +++ b/cmake/find/ldap.cmake @@ -1,84 +1,101 @@ +if (UNBUNDLED AND USE_STATIC_LIBRARIES) + set (ENABLE_LDAP OFF CACHE INTERNAL "") +endif() + option (ENABLE_LDAP "Enable LDAP" ${ENABLE_LIBRARIES}) -if (ENABLE_LDAP) - option (USE_INTERNAL_LDAP_LIBRARY "Set to FALSE to use system *LDAP library instead of bundled" ${NOT_UNBUNDLED}) +if (NOT ENABLE_LDAP) + if(USE_INTERNAL_LDAP_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal LDAP library with ENABLE_LDAP=OFF") + endif () + return() +endif() - if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/openldap/README") - if (USE_INTERNAL_LDAP_LIBRARY) - message (WARNING "Submodule contrib/openldap is missing. To fix try running:\n git submodule update --init --recursive") - endif () +option (USE_INTERNAL_LDAP_LIBRARY "Set to FALSE to use system *LDAP library instead of bundled" ${NOT_UNBUNDLED}) - set (USE_INTERNAL_LDAP_LIBRARY 0) - set (MISSING_INTERNAL_LDAP_LIBRARY 1) +if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/openldap/README") + if (USE_INTERNAL_LDAP_LIBRARY) + message (WARNING "Submodule contrib/openldap is missing. To fix try running:\n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal LDAP library") endif () - set (OPENLDAP_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES}) - set (OPENLDAP_USE_REENTRANT_LIBS 1) + set (USE_INTERNAL_LDAP_LIBRARY 0) + set (MISSING_INTERNAL_LDAP_LIBRARY 1) +endif () - if (NOT USE_INTERNAL_LDAP_LIBRARY) - if (OPENLDAP_USE_STATIC_LIBS) - message (WARNING "Unable to use external static OpenLDAP libraries, falling back to the bundled version.") - set (USE_INTERNAL_LDAP_LIBRARY 1) - else () - if (APPLE AND NOT OPENLDAP_ROOT_DIR) - set (OPENLDAP_ROOT_DIR "/usr/local/opt/openldap") - endif () +set (OPENLDAP_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES}) +set (OPENLDAP_USE_REENTRANT_LIBS 1) - find_package (OpenLDAP) - endif () - endif () - - if (NOT OPENLDAP_FOUND AND NOT MISSING_INTERNAL_LDAP_LIBRARY) - string (TOLOWER "${CMAKE_SYSTEM_NAME}" _system_name) - string (TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _system_processor) - - if ( - "${_system_processor}" STREQUAL "amd64" OR - "${_system_processor}" STREQUAL "x64" - ) - set (_system_processor "x86_64") - elseif ( - "${_system_processor}" STREQUAL "arm64" - ) - set (_system_processor "aarch64") +if (NOT USE_INTERNAL_LDAP_LIBRARY) + if (OPENLDAP_USE_STATIC_LIBS) + message (WARNING "Unable to use external static OpenLDAP libraries, falling back to the bundled version.") + message (${RECONFIGURE_MESSAGE_LEVEL} "Unable to use external OpenLDAP") + set (USE_INTERNAL_LDAP_LIBRARY 1) + else () + if (APPLE AND NOT OPENLDAP_ROOT_DIR) + set (OPENLDAP_ROOT_DIR "/usr/local/opt/openldap") endif () - if ( - ( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "x86_64" ) OR - ( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "aarch64" ) OR - ( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "x86_64" ) OR - ( "${_system_name}" STREQUAL "darwin" AND "${_system_processor}" STREQUAL "x86_64" ) - ) - set (_ldap_supported_platform TRUE) - endif () + find_package (OpenLDAP) - if (NOT _ldap_supported_platform) - message (WARNING "LDAP support using the bundled library is not implemented for ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} platform.") - elseif (NOT USE_SSL) - message (WARNING "LDAP support using the bundled library is not possible if SSL is not used.") - else () - set (USE_INTERNAL_LDAP_LIBRARY 1) - set (OPENLDAP_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/openldap") - set (OPENLDAP_INCLUDE_DIRS - "${ClickHouse_SOURCE_DIR}/contrib/openldap-cmake/${_system_name}_${_system_processor}/include" - "${ClickHouse_SOURCE_DIR}/contrib/openldap/include" - ) - # Below, 'ldap'/'ldap_r' and 'lber' will be resolved to - # the targets defined in contrib/openldap-cmake/CMakeLists.txt - if (OPENLDAP_USE_REENTRANT_LIBS) - set (OPENLDAP_LDAP_LIBRARY "ldap_r") - else () - set (OPENLDAP_LDAP_LIBRARY "ldap") - endif() - set (OPENLDAP_LBER_LIBRARY "lber") - set (OPENLDAP_LIBRARIES ${OPENLDAP_LDAP_LIBRARY} ${OPENLDAP_LBER_LIBRARY}) - set (OPENLDAP_FOUND 1) - endif () - endif () - - if (OPENLDAP_FOUND) - set (USE_LDAP 1) + if (NOT OPENLDAP_FOUND) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system OpenLDAP") + endif() endif () endif () +if (NOT OPENLDAP_FOUND AND NOT MISSING_INTERNAL_LDAP_LIBRARY) + string (TOLOWER "${CMAKE_SYSTEM_NAME}" _system_name) + string (TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _system_processor) + + if ( + "${_system_processor}" STREQUAL "amd64" OR + "${_system_processor}" STREQUAL "x64" + ) + set (_system_processor "x86_64") + elseif ( + "${_system_processor}" STREQUAL "arm64" + ) + set (_system_processor "aarch64") + endif () + + if ( + ( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "x86_64" ) OR + ( "${_system_name}" STREQUAL "linux" AND "${_system_processor}" STREQUAL "aarch64" ) OR + ( "${_system_name}" STREQUAL "freebsd" AND "${_system_processor}" STREQUAL "x86_64" ) OR + ( "${_system_name}" STREQUAL "darwin" AND "${_system_processor}" STREQUAL "x86_64" ) + ) + set (_ldap_supported_platform TRUE) + endif () + + if (NOT _ldap_supported_platform) + message (WARNING "LDAP support using the bundled library is not implemented for ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} platform.") + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot enable LDAP support") + elseif (NOT USE_SSL) + message (WARNING "LDAP support using the bundled library is not possible if SSL is not used.") + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot enable LDAP support") + else () + set (USE_INTERNAL_LDAP_LIBRARY 1) + set (OPENLDAP_ROOT_DIR "${ClickHouse_SOURCE_DIR}/contrib/openldap") + set (OPENLDAP_INCLUDE_DIRS + "${ClickHouse_SOURCE_DIR}/contrib/openldap-cmake/${_system_name}_${_system_processor}/include" + "${ClickHouse_SOURCE_DIR}/contrib/openldap/include" + ) + # Below, 'ldap'/'ldap_r' and 'lber' will be resolved to + # the targets defined in contrib/openldap-cmake/CMakeLists.txt + if (OPENLDAP_USE_REENTRANT_LIBS) + set (OPENLDAP_LDAP_LIBRARY "ldap_r") + else () + set (OPENLDAP_LDAP_LIBRARY "ldap") + endif() + set (OPENLDAP_LBER_LIBRARY "lber") + set (OPENLDAP_LIBRARIES ${OPENLDAP_LDAP_LIBRARY} ${OPENLDAP_LBER_LIBRARY}) + set (OPENLDAP_FOUND 1) + endif () +endif () + +if (OPENLDAP_FOUND) + set (USE_LDAP 1) +endif () + message (STATUS "Using ldap=${USE_LDAP}: ${OPENLDAP_INCLUDE_DIRS} : ${OPENLDAP_LIBRARIES}") diff --git a/cmake/find/libgsasl.cmake b/cmake/find/libgsasl.cmake index e9c45a09010..3c742af2566 100644 --- a/cmake/find/libgsasl.cmake +++ b/cmake/find/libgsasl.cmake @@ -1,12 +1,23 @@ option(ENABLE_GSASL_LIBRARY "Enable gsasl library" ${ENABLE_LIBRARIES}) -if (ENABLE_GSASL_LIBRARY) +if (NOT ENABLE_GSASL_LIBRARY) + if(USE_INTERNAL_LIBGSASL_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal libgsasl library with ENABLE_GSASL_LIBRARY=OFF") + endif() + return() +endif() -option (USE_INTERNAL_LIBGSASL_LIBRARY "Set to FALSE to use system libgsasl library instead of bundled" ${NOT_UNBUNDLED}) +if (UNBUNDLED) + # when USE_STATIC_LIBRARIES we usually need to pick up hell a lot of dependencies for libgsasl + option (USE_INTERNAL_LIBGSASL_LIBRARY "Set to FALSE to use system libgsasl library instead of bundled" ${USE_STATIC_LIBRARIES}) +else() + option (USE_INTERNAL_LIBGSASL_LIBRARY "Set to FALSE to use system libgsasl library instead of bundled" ON) +endif() if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libgsasl/src/gsasl.h") if (USE_INTERNAL_LIBGSASL_LIBRARY) message (WARNING "submodule contrib/libgsasl is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal libgsasl") set (USE_INTERNAL_LIBGSASL_LIBRARY 0) endif () set (MISSING_INTERNAL_LIBGSASL_LIBRARY 1) @@ -14,12 +25,15 @@ endif () if (NOT USE_INTERNAL_LIBGSASL_LIBRARY) find_library (LIBGSASL_LIBRARY gsasl) - find_path (LIBGSASL_INCLUDE_DIR NAMES gsasl.h PATHS ${LIBGSASL_INCLUDE_PATHS}) + find_path (LIBGSASL_INCLUDE_DIR NAMES gsasl.h PATHS ${LIBGSASL_INCLUDE_PATHS}) + if (NOT LIBGSASL_LIBRARY OR NOT LIBGSASL_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system libgsasl") + endif () endif () if (LIBGSASL_LIBRARY AND LIBGSASL_INCLUDE_DIR) elseif (NOT MISSING_INTERNAL_LIBGSASL_LIBRARY) - set (LIBGSASL_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libgsasl/src ${ClickHouse_SOURCE_DIR}/contrib/libgsasl/linux_x86_64/include) + set (LIBGSASL_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libgsasl/src" "${ClickHouse_SOURCE_DIR}/contrib/libgsasl/linux_x86_64/include") set (USE_INTERNAL_LIBGSASL_LIBRARY 1) set (LIBGSASL_LIBRARY libgsasl) endif () @@ -28,6 +42,4 @@ if(LIBGSASL_LIBRARY AND LIBGSASL_INCLUDE_DIR) set (USE_LIBGSASL 1) endif() -endif() - message (STATUS "Using libgsasl=${USE_LIBGSASL}: ${LIBGSASL_INCLUDE_DIR} : ${LIBGSASL_LIBRARY}") diff --git a/cmake/find/libxml2.cmake b/cmake/find/libxml2.cmake index 73732e139c5..cdf079c33d2 100644 --- a/cmake/find/libxml2.cmake +++ b/cmake/find/libxml2.cmake @@ -3,6 +3,7 @@ option (USE_INTERNAL_LIBXML2_LIBRARY "Set to FALSE to use system libxml2 library if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libxml2/libxml.h") if (USE_INTERNAL_LIBXML2_LIBRARY) message (WARNING "submodule contrib/libxml2 is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal libxml") set (USE_INTERNAL_LIBXML2_LIBRARY 0) endif () set (MISSING_INTERNAL_LIBXML2_LIBRARY 1) @@ -12,13 +13,22 @@ if (NOT USE_INTERNAL_LIBXML2_LIBRARY) find_package (LibXml2) #find_library (LIBXML2_LIBRARY libxml2) #find_path (LIBXML2_INCLUDE_DIR NAMES libxml.h PATHS ${LIBXML2_INCLUDE_PATHS}) + + if (NOT LIBXML2_LIBRARY OR NOT LIBXML2_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system libxml2") + endif () + + if (USE_STATIC_LIBRARIES) + find_package(LibLZMA) + set (LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) + endif () endif () if (LIBXML2_LIBRARY AND LIBXML2_INCLUDE_DIR) elseif (NOT MISSING_INTERNAL_LIBXML2_LIBRARY) set (LIBXML2_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libxml2/include ${ClickHouse_SOURCE_DIR}/contrib/libxml2-cmake/linux_x86_64/include) set (USE_INTERNAL_LIBXML2_LIBRARY 1) - set (LIBXML2_LIBRARY libxml2) + set (LIBXML2_LIBRARIES libxml2) endif () -message (STATUS "Using libxml2: ${LIBXML2_INCLUDE_DIR} : ${LIBXML2_LIBRARY}") +message (STATUS "Using libxml2: ${LIBXML2_INCLUDE_DIR} : ${LIBXML2_LIBRARIES}") diff --git a/cmake/find/llvm.cmake b/cmake/find/llvm.cmake index 7cb67d1a990..70d0e356c39 100644 --- a/cmake/find/llvm.cmake +++ b/cmake/find/llvm.cmake @@ -1,79 +1,98 @@ -# Broken in macos. TODO: update clang, re-test, enable -if (NOT APPLE) - option (ENABLE_EMBEDDED_COMPILER "Set to TRUE to enable support for 'compile_expressions' option for query execution" ${ENABLE_LIBRARIES}) +if (APPLE OR SPLIT_SHARED_LIBRARIES OR NOT ARCH_AMD64) + set (ENABLE_EMBEDDED_COMPILER OFF CACHE INTERNAL "") +endif() + +option (ENABLE_EMBEDDED_COMPILER "Set to TRUE to enable support for 'compile_expressions' option for query execution" ${ENABLE_LIBRARIES}) +# Broken in macos. TODO: update clang, re-test, enable on Apple +if (ENABLE_EMBEDDED_COMPILER AND NOT SPLIT_SHARED_LIBRARIES AND ARCH_AMD64 AND NOT (SANITIZE STREQUAL "undefined")) option (USE_INTERNAL_LLVM_LIBRARY "Use bundled or system LLVM library." ${NOT_UNBUNDLED}) +endif() + +if (NOT ENABLE_EMBEDDED_COMPILER) + if(USE_INTERNAL_LLVM_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal LLVM library with ENABLE_EMBEDDED_COMPILER=OFF") + endif() + return() +endif() + +if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/llvm/llvm/CMakeLists.txt") + if (USE_INTERNAL_LLVM_LIBRARY) + message (WARNING "submodule contrib/llvm is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't fidd internal LLVM library") + endif() + set (MISSING_INTERNAL_LLVM_LIBRARY 1) endif () -if (ENABLE_EMBEDDED_COMPILER) - if (USE_INTERNAL_LLVM_LIBRARY AND NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/llvm/llvm/CMakeLists.txt") - message (WARNING "submodule contrib/llvm is missing. to fix try run: \n git submodule update --init --recursive") - set (USE_INTERNAL_LLVM_LIBRARY 0) - endif () +if (NOT USE_INTERNAL_LLVM_LIBRARY) + set (LLVM_PATHS "/usr/local/lib/llvm") - if (NOT USE_INTERNAL_LLVM_LIBRARY) - set (LLVM_PATHS "/usr/local/lib/llvm") - - foreach(llvm_v 9 8) - if (NOT LLVM_FOUND) - find_package (LLVM ${llvm_v} CONFIG PATHS ${LLVM_PATHS}) - endif () - endforeach () - - if (LLVM_FOUND) - # Remove dynamically-linked zlib and libedit from LLVM's dependencies: - set_target_properties(LLVMSupport PROPERTIES INTERFACE_LINK_LIBRARIES "-lpthread;LLVMDemangle;${ZLIB_LIBRARIES}") - set_target_properties(LLVMLineEditor PROPERTIES INTERFACE_LINK_LIBRARIES "LLVMSupport") - - option(LLVM_HAS_RTTI "Enable if LLVM was build with RTTI enabled" ON) - set (USE_EMBEDDED_COMPILER 1) - else() - set (USE_EMBEDDED_COMPILER 0) - endif() - - if (LLVM_FOUND AND OS_LINUX AND USE_LIBCXX) - message(WARNING "Option USE_INTERNAL_LLVM_LIBRARY is not set but the LLVM library from OS packages in Linux is incompatible with libc++ ABI. LLVM Will be disabled.") - set (LLVM_FOUND 0) - set (USE_EMBEDDED_COMPILER 0) + foreach(llvm_v 9 8) + if (NOT LLVM_FOUND) + find_package (LLVM ${llvm_v} CONFIG PATHS ${LLVM_PATHS}) endif () - else() - if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) - message(WARNING "Option ENABLE_EMBEDDED_COMPILER is set but LLVM library cannot build if build directory is the same as source directory.") - set (LLVM_FOUND 0) - set (USE_EMBEDDED_COMPILER 0) - elseif (SPLIT_SHARED_LIBRARIES) - # llvm-tablegen cannot find shared libraries that we build. Probably can be easily fixed. - message(WARNING "Option ENABLE_EMBEDDED_COMPILER is not compatible with SPLIT_SHARED_LIBRARIES. Build of LLVM will be disabled.") - set (LLVM_FOUND 0) - set (USE_EMBEDDED_COMPILER 0) - elseif (NOT ARCH_AMD64) - # It's not supported yet, but you can help. - message(WARNING "Option ENABLE_EMBEDDED_COMPILER is only available for x86_64. Build of LLVM will be disabled.") - set (LLVM_FOUND 0) - set (USE_EMBEDDED_COMPILER 0) - elseif (SANITIZE STREQUAL "undefined") - # llvm-tblgen, that is used during LLVM build, doesn't work with UBSan. - message(WARNING "Option ENABLE_EMBEDDED_COMPILER does not work with UBSan, because 'llvm-tblgen' tool from LLVM has undefined behaviour. Build of LLVM will be disabled.") - set (LLVM_FOUND 0) - set (USE_EMBEDDED_COMPILER 0) - else () - set (LLVM_FOUND 1) - set (USE_EMBEDDED_COMPILER 1) - set (LLVM_VERSION "9.0.0bundled") - set (LLVM_INCLUDE_DIRS - ${ClickHouse_SOURCE_DIR}/contrib/llvm/llvm/include - ${ClickHouse_BINARY_DIR}/contrib/llvm/llvm/include - ) - set (LLVM_LIBRARY_DIRS ${ClickHouse_BINARY_DIR}/contrib/llvm/llvm) - endif() - endif() + endforeach () if (LLVM_FOUND) - message(STATUS "LLVM include Directory: ${LLVM_INCLUDE_DIRS}") - message(STATUS "LLVM library Directory: ${LLVM_LIBRARY_DIRS}") - message(STATUS "LLVM C++ compiler flags: ${LLVM_CXXFLAGS}") + # Remove dynamically-linked zlib and libedit from LLVM's dependencies: + set_target_properties(LLVMSupport PROPERTIES INTERFACE_LINK_LIBRARIES "-lpthread;LLVMDemangle;${ZLIB_LIBRARIES}") + set_target_properties(LLVMLineEditor PROPERTIES INTERFACE_LINK_LIBRARIES "LLVMSupport") + + option(LLVM_HAS_RTTI "Enable if LLVM was build with RTTI enabled" ON) + set (USE_EMBEDDED_COMPILER 1) + else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system LLVM") + set (USE_EMBEDDED_COMPILER 0) + endif() + + if (LLVM_FOUND AND OS_LINUX AND USE_LIBCXX AND NOT FORCE_LLVM_WITH_LIBCXX) + message(WARNING "Option USE_INTERNAL_LLVM_LIBRARY is not set but the LLVM library from OS packages " + "in Linux is incompatible with libc++ ABI. LLVM Will be disabled. Force: -DFORCE_LLVM_WITH_LIBCXX=ON") + message (${RECONFIGURE_MESSAGE_LEVEL} "Unsupported LLVM configuration, cannot enable LLVM") + set (LLVM_FOUND 0) + set (USE_EMBEDDED_COMPILER 0) + endif () +endif() + +if(NOT LLVM_FOUND AND NOT MISSING_INTERNAL_LLVM_LIBRARY) + if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) + message(WARNING "Option ENABLE_EMBEDDED_COMPILER is set but internal LLVM library cannot build if build directory is the same as source directory.") + set (LLVM_FOUND 0) + set (USE_EMBEDDED_COMPILER 0) + elseif (SPLIT_SHARED_LIBRARIES) + # llvm-tablegen cannot find shared libraries that we build. Probably can be easily fixed. + message(WARNING "Option USE_INTERNAL_LLVM_LIBRARY is not compatible with SPLIT_SHARED_LIBRARIES. Build of LLVM will be disabled.") + set (LLVM_FOUND 0) + set (USE_EMBEDDED_COMPILER 0) + elseif (NOT ARCH_AMD64) + # It's not supported yet, but you can help. + message(WARNING "Option USE_INTERNAL_LLVM_LIBRARY is only available for x86_64. Build of LLVM will be disabled.") + set (LLVM_FOUND 0) + set (USE_EMBEDDED_COMPILER 0) + elseif (SANITIZE STREQUAL "undefined") + # llvm-tblgen, that is used during LLVM build, doesn't work with UBSan. + message(WARNING "Option USE_INTERNAL_LLVM_LIBRARY does not work with UBSan, because 'llvm-tblgen' tool from LLVM has undefined behaviour. Build of LLVM will be disabled.") + set (LLVM_FOUND 0) + set (USE_EMBEDDED_COMPILER 0) + else () + set (USE_INTERNAL_LLVM_LIBRARY ON) + set (LLVM_FOUND 1) + set (USE_EMBEDDED_COMPILER 1) + set (LLVM_VERSION "9.0.0bundled") + set (LLVM_INCLUDE_DIRS + "${ClickHouse_SOURCE_DIR}/contrib/llvm/llvm/include" + "${ClickHouse_BINARY_DIR}/contrib/llvm/llvm/include" + ) + set (LLVM_LIBRARY_DIRS "${ClickHouse_BINARY_DIR}/contrib/llvm/llvm") endif() endif() +if (LLVM_FOUND) + message(STATUS "LLVM include Directory: ${LLVM_INCLUDE_DIRS}") + message(STATUS "LLVM library Directory: ${LLVM_LIBRARY_DIRS}") + message(STATUS "LLVM C++ compiler flags: ${LLVM_CXXFLAGS}") +else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't enable LLVM") +endif() # This list was generated by listing all LLVM libraries, compiling the binary and removing all libraries while it still compiles. set (REQUIRED_LLVM_LIBRARIES diff --git a/cmake/find/ltdl.cmake b/cmake/find/ltdl.cmake index 18003618dbd..b48a3630222 100644 --- a/cmake/find/ltdl.cmake +++ b/cmake/find/ltdl.cmake @@ -1,5 +1,5 @@ if (ENABLE_ODBC AND NOT USE_INTERNAL_ODBC_LIBRARY) set (LTDL_PATHS "/usr/local/opt/libtool/lib") - find_library (LTDL_LIBRARY ltdl PATHS ${LTDL_PATHS}) + find_library (LTDL_LIBRARY ltdl PATHS ${LTDL_PATHS} REQUIRED) message (STATUS "Using ltdl: ${LTDL_LIBRARY}") endif () diff --git a/cmake/find/msgpack.cmake b/cmake/find/msgpack.cmake index 102ea619f6a..130aa007ad5 100644 --- a/cmake/find/msgpack.cmake +++ b/cmake/find/msgpack.cmake @@ -1,27 +1,37 @@ option (ENABLE_MSGPACK "Enable msgpack library" ${ENABLE_LIBRARIES}) -if (ENABLE_MSGPACK) +if(NOT ENABLE_MSGPACK) + if(USE_INTERNAL_MSGPACK_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal msgpack with ENABLE_MSGPACK=OFF") + endif() + return() +endif() option (USE_INTERNAL_MSGPACK_LIBRARY "Set to FALSE to use system msgpack library instead of bundled" ${NOT_UNBUNDLED}) -if (USE_INTERNAL_MSGPACK_LIBRARY) - if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/msgpack-c/include/msgpack.hpp") +if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/msgpack-c/include/msgpack.hpp") + if(USE_INTERNAL_MSGPACK_LIBRARY) message(WARNING "Submodule contrib/msgpack-c is missing. To fix try run: \n git submodule update --init --recursive") - set(USE_INTERNAL_MSGPACK_LIBRARY 0) - set(MISSING_INTERNAL_MSGPACK_LIBRARY 1) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal msgpack") + set(USE_INTERNAL_MSGPACK_LIBRARY 0) + endif() + set(MISSING_INTERNAL_MSGPACK_LIBRARY 1) +endif() + +if(NOT USE_INTERNAL_MSGPACK_LIBRARY) + find_path(MSGPACK_INCLUDE_DIR NAMES msgpack.hpp PATHS ${MSGPACK_INCLUDE_PATHS}) + if(NOT MSGPACK_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system msgpack") endif() endif() -if (USE_INTERNAL_MSGPACK_LIBRARY) - set(MSGPACK_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/msgpack-c/include) -else() - find_path(MSGPACK_INCLUDE_DIR NAMES msgpack.hpp PATHS ${MSGPACK_INCLUDE_PATHS}) +if(NOT MSGPACK_INCLUDE_DIR AND NOT MISSING_INTERNAL_MSGPACK_LIBRARY) + set(MSGPACK_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/msgpack-c/include") + set(USE_INTERNAL_MSGPACK_LIBRARY 1) endif() if (MSGPACK_INCLUDE_DIR) set(USE_MSGPACK 1) endif() -endif() - message(STATUS "Using msgpack=${USE_MSGPACK}: ${MSGPACK_INCLUDE_DIR}") diff --git a/cmake/find/mysqlclient.cmake b/cmake/find/mysqlclient.cmake index 886c5b9bb59..634681d98f6 100644 --- a/cmake/find/mysqlclient.cmake +++ b/cmake/find/mysqlclient.cmake @@ -4,56 +4,73 @@ else () option(ENABLE_MYSQL "Enable MySQL" FALSE) endif () -if(ENABLE_MYSQL) - option(USE_INTERNAL_MYSQL_LIBRARY "Set to FALSE to use system mysqlclient library instead of bundled" ${NOT_UNBUNDLED}) +if(NOT ENABLE_MYSQL) + if (USE_INTERNAL_MYSQL_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal mysql library with ENABLE_MYSQL=OFF") + endif () + message (STATUS "Build without mysqlclient (support for MYSQL dictionary source will be disabled)") + return() +endif() - if(USE_INTERNAL_MYSQL_LIBRARY AND NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/mariadb-connector-c/README") +option(USE_INTERNAL_MYSQL_LIBRARY "Set to FALSE to use system mysqlclient library instead of bundled" ${NOT_UNBUNDLED}) + +if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/mariadb-connector-c/README") + if(USE_INTERNAL_MYSQL_LIBRARY) message(WARNING "submodule contrib/mariadb-connector-c is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal mysql library") set(USE_INTERNAL_MYSQL_LIBRARY 0) endif() + set(MISSING_INTERNAL_MYSQL_LIBRARY 1) +endif() - if (USE_INTERNAL_MYSQL_LIBRARY) - set (MYSQLCLIENT_LIBRARIES mariadbclient) +if (NOT USE_INTERNAL_MYSQL_LIBRARY) + set (MYSQL_LIB_PATHS + "/usr/local/opt/mysql/lib" + "/usr/local/lib" + "/usr/local/lib64" + "/usr/local/lib/mariadb" # macos brew mariadb-connector-c + "/usr/mysql/lib" + "/usr/mysql/lib64" + "/usr/lib" + "/usr/lib64" + "/lib" + "/lib64") + + set (MYSQL_INCLUDE_PATHS + "/usr/local/opt/mysql/include" + "/usr/mysql/include" + "/usr/local/include" + "/usr/include/mariadb" + "/usr/include/mysql" + "/usr/include") + + find_path (MYSQL_INCLUDE_DIR NAMES mysql.h mysql/mysql.h mariadb/mysql.h PATHS ${MYSQL_INCLUDE_PATHS} PATH_SUFFIXES mysql) + + if (USE_STATIC_LIBRARIES) + find_library (STATIC_MYSQLCLIENT_LIB NAMES mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS} PATH_SUFFIXES mysql) + else () + find_library (MYSQLCLIENT_LIBRARIES NAMES mariadb mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS} PATH_SUFFIXES mysql) + endif () + + if (MYSQL_INCLUDE_DIR AND (STATIC_MYSQLCLIENT_LIB OR MYSQLCLIENT_LIBRARIES)) set (USE_MYSQL 1) set (MYSQLXX_LIBRARY mysqlxx) + if (APPLE) + # /usr/local/include/mysql/mysql_com.h:1011:10: fatal error: mysql/udf_registration_types.h: No such file or directory + set(MYSQL_INCLUDE_DIR ${MYSQL_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR}/mysql) + endif () else () - set (MYSQL_LIB_PATHS - "/usr/local/opt/mysql/lib" - "/usr/local/lib" - "/usr/local/lib64" - "/usr/local/lib/mariadb" # macos brew mariadb-connector-c - "/usr/mysql/lib" - "/usr/mysql/lib64" - "/usr/lib" - "/usr/lib64" - "/lib" - "/lib64") - - set (MYSQL_INCLUDE_PATHS - "/usr/local/opt/mysql/include" - "/usr/mysql/include" - "/usr/local/include" - "/usr/include") - - find_path (MYSQL_INCLUDE_DIR NAMES mysql/mysql.h mariadb/mysql.h PATHS ${MYSQL_INCLUDE_PATHS} PATH_SUFFIXES mysql) - - if (USE_STATIC_LIBRARIES) - find_library (STATIC_MYSQLCLIENT_LIB NAMES mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS} PATH_SUFFIXES mysql) - else () - find_library (MYSQLCLIENT_LIBRARIES NAMES mariadb mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS} PATH_SUFFIXES mysql) - endif () - - if (MYSQL_INCLUDE_DIR AND (STATIC_MYSQLCLIENT_LIB OR MYSQLCLIENT_LIBRARIES)) - set (USE_MYSQL 1) - set (MYSQLXX_LIBRARY mysqlxx) - if (APPLE) - # /usr/local/include/mysql/mysql_com.h:1011:10: fatal error: mysql/udf_registration_types.h: No such file or directory - set(MYSQL_INCLUDE_DIR ${MYSQL_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR}/mysql) - endif () - endif () + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system mysql library") endif () endif () +if (NOT USE_MYSQL AND NOT MISSING_INTERNAL_MYSQL_LIBRARY) + set (MYSQLCLIENT_LIBRARIES mariadbclient) + set (MYSQLXX_LIBRARY mysqlxx) + set (USE_MYSQL 1) + set (USE_INTERNAL_MYSQL_LIBRARY 1) +endif() + if (USE_MYSQL) message (STATUS "Using mysqlclient=${USE_MYSQL}: ${MYSQL_INCLUDE_DIR} : ${MYSQLCLIENT_LIBRARIES}; staticlib=${STATIC_MYSQLCLIENT_LIB}") else () diff --git a/cmake/find/odbc.cmake b/cmake/find/odbc.cmake new file mode 100644 index 00000000000..392d0d47390 --- /dev/null +++ b/cmake/find/odbc.cmake @@ -0,0 +1,53 @@ +option (ENABLE_ODBC "Enable ODBC library" ${ENABLE_LIBRARIES}) + +if (NOT OS_LINUX) + if (ENABLE_ODBC) + message(STATUS "ODBC is only supported on Linux") + endif() + set (ENABLE_ODBC OFF CACHE INTERNAL "") +endif () + +if (NOT ENABLE_ODBC) + if (USE_INTERNAL_ODBC_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal ODBC with ENABLE_ODBC=OFF") + endif() + + add_library (unixodbc INTERFACE) + target_compile_definitions (unixodbc INTERFACE USE_ODBC=0) + + message (STATUS "Not using unixodbc") + return() +endif() + +option (USE_INTERNAL_ODBC_LIBRARY "Use internal ODBC library" ${NOT_UNBUNDLED}) + +if (NOT USE_INTERNAL_ODBC_LIBRARY) + find_library (LIBRARY_ODBC NAMES unixodbc odbc) + find_path (INCLUDE_ODBC sql.h) + + if(LIBRARY_ODBC AND INCLUDE_ODBC) + add_library (unixodbc UNKNOWN IMPORTED) + set_target_properties (unixodbc PROPERTIES IMPORTED_LOCATION ${LIBRARY_ODBC}) + set_target_properties (unixodbc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_ODBC}) + set_target_properties (unixodbc PROPERTIES INTERFACE_COMPILE_DEFINITIONS USE_ODBC=1) + + if (USE_STATIC_LIBRARIES) + find_library(LTDL_LIBRARY ltdl) + if (LTDL_LIBRARY) + target_link_libraries(unixodbc INTERFACE ${LTDL_LIBRARY}) + endif() + endif() + + set(EXTERNAL_ODBC_LIBRARY_FOUND 1) + message (STATUS "Found odbc: ${LIBRARY_ODBC}") + else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system ODBC library") + set(EXTERNAL_ODBC_LIBRARY_FOUND 0) + endif() +endif() + +if (NOT EXTERNAL_ODBC_LIBRARY_FOUND) + set (USE_INTERNAL_ODBC_LIBRARY 1) +endif () + +message (STATUS "Using unixodbc") diff --git a/cmake/find/opencl.cmake b/cmake/find/opencl.cmake index 0f307350cb8..2b0cc7c5dd4 100644 --- a/cmake/find/opencl.cmake +++ b/cmake/find/opencl.cmake @@ -3,12 +3,14 @@ if(0) option(ENABLE_OPENCL "Enable OpenCL support" ${ENABLE_LIBRARIES}) endif() -if(ENABLE_OPENCL) +if(NOT ENABLE_OPENCL) + return() +endif() # Intel OpenCl driver: sudo apt install intel-opencl-icd # @sa https://github.com/intel/compute-runtime/releases -# OpenCL applications should link wiht ICD loader +# OpenCL applications should link with ICD loader # sudo apt install opencl-headers ocl-icd-libopencl1 # sudo ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0 /usr/lib/libOpenCL.so # TODO: add https://github.com/OCL-dev/ocl-icd as submodule instead @@ -16,8 +18,8 @@ if(ENABLE_OPENCL) find_package(OpenCL) if(OpenCL_FOUND) set(USE_OPENCL 1) -endif() - +else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't enable OpenCL support") endif() message(STATUS "Using opencl=${USE_OPENCL}: ${OpenCL_INCLUDE_DIRS} : ${OpenCL_LIBRARIES}") diff --git a/cmake/find/orc.cmake b/cmake/find/orc.cmake index 26253687c80..86a72e65093 100644 --- a/cmake/find/orc.cmake +++ b/cmake/find/orc.cmake @@ -1,12 +1,25 @@ option (ENABLE_ORC "Enable ORC" ${ENABLE_LIBRARIES}) -if(ENABLE_ORC) +if(NOT ENABLE_ORC) + if(USE_INTERNAL_ORC_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal ORC library with ENABLE_ORD=OFF") + endif() + return() +endif() + +if (USE_INTERNAL_PARQUET_LIBRARY) + option(USE_INTERNAL_ORC_LIBRARY "Set to FALSE to use system ORC instead of bundled (experimental set to OFF on your own risk)" + ON) +elseif(USE_INTERNAL_ORC_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Currently internal ORC can be build only with bundled Parquet") +endif() + include(cmake/find/snappy.cmake) -option(USE_INTERNAL_ORC_LIBRARY "Set to FALSE to use system ORC instead of bundled" ${NOT_UNBUNDLED}) if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/orc/c++/include/orc/OrcFile.hh") if(USE_INTERNAL_ORC_LIBRARY) message(WARNING "submodule contrib/orc is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal ORC") set(USE_INTERNAL_ORC_LIBRARY 0) endif() set(MISSING_INTERNAL_ORC_LIBRARY 1) @@ -14,6 +27,9 @@ endif () if (NOT USE_INTERNAL_ORC_LIBRARY) find_package(orc) + if (NOT ORC_LIBRARY OR NOT ORC_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system ORC") + endif () endif () #if (USE_INTERNAL_ORC_LIBRARY) @@ -30,10 +46,12 @@ elseif(NOT MISSING_INTERNAL_ORC_LIBRARY AND ARROW_LIBRARY AND SNAPPY_LIBRARY) # set(ORC_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/orc/c++/include") set(ORC_LIBRARY orc) set(USE_ORC 1) + set(USE_INTERNAL_ORC_LIBRARY 1) else() + message (${RECONFIGURE_MESSAGE_LEVEL} + "Can't enable ORC support - missing dependencies. Missing internal orc=${MISSING_INTERNAL_ORC_LIBRARY}. " + "arrow=${ARROW_LIBRARY} snappy=${SNAPPY_LIBRARY}") set(USE_INTERNAL_ORC_LIBRARY 0) endif() -endif() - message (STATUS "Using internal=${USE_INTERNAL_ORC_LIBRARY} orc=${USE_ORC}: ${ORC_INCLUDE_DIR} : ${ORC_LIBRARY}") diff --git a/cmake/find/parquet.cmake b/cmake/find/parquet.cmake index d4f62b87d29..6d05fa17aec 100644 --- a/cmake/find/parquet.cmake +++ b/cmake/find/parquet.cmake @@ -1,31 +1,123 @@ if (Protobuf_PROTOC_EXECUTABLE) option (ENABLE_PARQUET "Enable parquet" ${ENABLE_LIBRARIES}) +elseif(ENABLE_PARQUET OR USE_INTERNAL_PARQUET_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use parquet without protoc executable") endif() -if (ENABLE_PARQUET) +if (NOT ENABLE_PARQUET) + if(USE_INTERNAL_PARQUET_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal parquet with ENABLE_PARQUET=OFF") + endif() + message(STATUS "Building without Parquet support") + return() +endif() if (NOT OS_FREEBSD) # Freebsd: ../contrib/arrow/cpp/src/arrow/util/bit-util.h:27:10: fatal error: endian.h: No such file or directory option(USE_INTERNAL_PARQUET_LIBRARY "Set to FALSE to use system parquet library instead of bundled" ${NOT_UNBUNDLED}) +elseif(USE_INTERNAL_PARQUET_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Using internal parquet is not supported on freebsd") endif() if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/arrow/cpp/CMakeLists.txt") if(USE_INTERNAL_PARQUET_LIBRARY) message(WARNING "submodule contrib/arrow (required for Parquet) is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal parquet library") + set(USE_INTERNAL_PARQUET_LIBRARY 0) endif() - set(USE_INTERNAL_PARQUET_LIBRARY 0) set(MISSING_INTERNAL_PARQUET_LIBRARY 1) endif() +if (NOT SNAPPY_LIBRARY) + include(cmake/find/snappy.cmake) +endif() + if(NOT USE_INTERNAL_PARQUET_LIBRARY) find_package(Arrow) find_package(Parquet) + find_library(THRIFT_LIBRARY thrift) + find_library(UTF8_PROC_LIBRARY utf8proc) + find_package(BZip2) + + if(USE_STATIC_LIBRARIES) + find_library(ARROW_DEPS_LIBRARY arrow_bundled_dependencies) + + if (ARROW_DEPS_LIBRARY) + set(ARROW_IMPORT_OBJ_DIR "${CMAKE_CURRENT_BINARY_DIR}/contrib/arrow-cmake/imported-objects") + set(ARROW_OTHER_OBJS + "${ARROW_IMPORT_OBJ_DIR}/jemalloc.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/arena.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/background_thread.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/base.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/bin.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/bitmap.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/ckh.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/ctl.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/div.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/extent.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/extent_dss.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/extent_mmap.pic.o" + # skip hash + "${ARROW_IMPORT_OBJ_DIR}/hook.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/large.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/log.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/malloc_io.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/mutex.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/mutex_pool.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/nstime.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/pages.pic.o" + # skip prng + "${ARROW_IMPORT_OBJ_DIR}/prof.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/rtree.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/stats.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/sc.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/sz.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/tcache.pic.o" + # skip ticker + "${ARROW_IMPORT_OBJ_DIR}/tsd.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/test_hooks.pic.o" + "${ARROW_IMPORT_OBJ_DIR}/witness.pic.o" + ) + add_custom_command(OUTPUT ${ARROW_OTHER_OBJS} + COMMAND + mkdir -p "${ARROW_IMPORT_OBJ_DIR}" && + cd "${ARROW_IMPORT_OBJ_DIR}" && + "${CMAKE_AR}" x "${ARROW_DEPS_LIBRARY}" + ) + set_source_files_properties(jemalloc.pic.o PROPERTIES EXTERNAL_OBJECT true GENERATED true) + add_library(imported_arrow_deps STATIC ${ARROW_OTHER_OBJS}) + + set(ARROW_LIBRARY ${ARROW_STATIC_LIB} + imported_arrow_deps ${THRIFT_LIBRARY} ${UTF8_PROC_LIBRARY} ${BZIP2_LIBRARIES} ${SNAPPY_LIBRARY}) + else() + message(WARNING "Using external static Arrow does not always work. " + "Could not find arrow_bundled_dependencies.a. If compilation fails, " + "Try: -D\"USE_INTERNAL_PARQUET_LIBRARY\"=ON or -D\"ENABLE_PARQUET\"=OFF or " + "-D\"USE_STATIC_LIBRARIES\"=OFF") + set(ARROW_LIBRARY ${ARROW_STATIC_LIB}) + endif() + set(PARQUET_LIBRARY ${PARQUET_STATIC_LIB}) + else() + set(ARROW_LIBRARY ${ARROW_SHARED_LIB}) + set(PARQUET_LIBRARY ${PARQUET_SHARED_LIB}) + 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) + set(USE_PARQUET 1) + set(EXTERNAL_PARQUET_FOUND 1) + else() + message (${RECONFIGURE_MESSAGE_LEVEL} + "Can't find system parquet: arrow=${ARROW_INCLUDE_DIR}:${ARROW_LIBRARY} ;" + " parquet=${PARQUET_INCLUDE_DIR}:${PARQUET_LIBRARY} ;" + " thrift=${THRIFT_LIBRARY} ;") + set(EXTERNAL_PARQUET_FOUND 0) + endif() endif() -if(ARROW_INCLUDE_DIR AND PARQUET_INCLUDE_DIR) -elseif(NOT MISSING_INTERNAL_PARQUET_LIBRARY AND NOT OS_FREEBSD) - include(cmake/find/snappy.cmake) +if(NOT EXTERNAL_PARQUET_FOUND AND NOT MISSING_INTERNAL_PARQUET_LIBRARY AND NOT OS_FREEBSD) if(SNAPPY_LIBRARY) set(CAN_USE_INTERNAL_PARQUET_LIBRARY 1) + else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal parquet library without snappy") endif() include(CheckCXXSourceCompiles) @@ -33,19 +125,20 @@ elseif(NOT MISSING_INTERNAL_PARQUET_LIBRARY AND NOT OS_FREEBSD) set(CMAKE_REQUIRED_LIBRARIES ${DOUBLE_CONVERSION_LIBRARIES}) set(CMAKE_REQUIRED_INCLUDES ${DOUBLE_CONVERSION_INCLUDE_DIR}) check_cxx_source_compiles(" - #include - int main() { static const int flags_ = double_conversion::StringToDoubleConverter::ALLOW_CASE_INSENSIBILITY; return 0;} + #include + int main() { static const int flags_ = double_conversion::StringToDoubleConverter::ALLOW_CASE_INSENSIBILITY; return 0;} " HAVE_DOUBLE_CONVERSION_ALLOW_CASE_INSENSIBILITY) if(NOT HAVE_DOUBLE_CONVERSION_ALLOW_CASE_INSENSIBILITY) # HAVE_STD_RANDOM_SHUFFLE - message(STATUS "Disabling internal parquet library because arrow is broken (can't use old double_conversion)") - set(CAN_USE_INTERNAL_PARQUET_LIBRARY 0) + message (${RECONFIGURE_MESSAGE_LEVEL} "Disabling internal parquet library because arrow is broken (can't use old double_conversion)") + set(CAN_USE_INTERNAL_PARQUET_LIBRARY 0) endif() endif() - if(NOT CAN_USE_INTERNAL_PARQUET_LIBRARY) + if(NOT CAN_USE_INTERNAL_PARQUET_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal parquet") set(USE_INTERNAL_PARQUET_LIBRARY 0) - else() + else() set(USE_INTERNAL_PARQUET_LIBRARY 1) if(USE_INTERNAL_PARQUET_LIBRARY_NATIVE_CMAKE) @@ -53,7 +146,7 @@ elseif(NOT MISSING_INTERNAL_PARQUET_LIBRARY AND NOT OS_FREEBSD) set(PARQUET_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/arrow/cpp/src" ${ClickHouse_BINARY_DIR}/contrib/arrow/cpp/src) endif() - if(${USE_STATIC_LIBRARIES}) + if(MAKE_STATIC_LIBRARIES) set(FLATBUFFERS_LIBRARY flatbuffers) set(ARROW_LIBRARY arrow_static) set(PARQUET_LIBRARY parquet_static) @@ -72,12 +165,15 @@ elseif(NOT MISSING_INTERNAL_PARQUET_LIBRARY AND NOT OS_FREEBSD) set(USE_ORC 1) set(USE_ARROW 1) endif() -endif() - +elseif(OS_FREEBSD) + message (${RECONFIGURE_MESSAGE_LEVEL} "Using internal parquet library on FreeBSD is not supported") endif() if(USE_PARQUET) - message(STATUS "Using Parquet: ${ARROW_LIBRARY}:${ARROW_INCLUDE_DIR} ; ${PARQUET_LIBRARY}:${PARQUET_INCLUDE_DIR} ; ${THRIFT_LIBRARY} ; ${FLATBUFFERS_LIBRARY}") + message(STATUS "Using Parquet: arrow=${ARROW_LIBRARY}:${ARROW_INCLUDE_DIR} ;" + " parquet=${PARQUET_LIBRARY}:${PARQUET_INCLUDE_DIR} ;" + " thrift=${THRIFT_LIBRARY} ;" + " flatbuffers=${FLATBUFFERS_LIBRARY}") else() message(STATUS "Building without Parquet support") endif() diff --git a/cmake/find/poco.cmake b/cmake/find/poco.cmake new file mode 100644 index 00000000000..e749fc27925 --- /dev/null +++ b/cmake/find/poco.cmake @@ -0,0 +1,10 @@ +option (USE_INTERNAL_POCO_LIBRARY "Use internal Poco library" ON) + +if (USE_INTERNAL_POCO_LIBRARY) + set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/poco) +else () + find_path (ROOT_DIR NAMES Foundation/include/Poco/Poco.h include/Poco/Poco.h) + if (NOT ROOT_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system poco") + endif() +endif () diff --git a/cmake/find/protobuf.cmake b/cmake/find/protobuf.cmake index 51110d3b6a3..a7769206e9f 100644 --- a/cmake/find/protobuf.cmake +++ b/cmake/find/protobuf.cmake @@ -1,12 +1,18 @@ option(ENABLE_PROTOBUF "Enable protobuf" ${ENABLE_LIBRARIES}) -if(ENABLE_PROTOBUF) +if(NOT ENABLE_PROTOBUF) + if(USE_INTERNAL_PROTOBUF_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal protobuf with ENABLE_PROTOBUF=OFF") + endif() + return() +endif() option(USE_INTERNAL_PROTOBUF_LIBRARY "Set to FALSE to use system protobuf instead of bundled" ${NOT_UNBUNDLED}) if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/protobuf/cmake/CMakeLists.txt") if(USE_INTERNAL_PROTOBUF_LIBRARY) message(WARNING "submodule contrib/protobuf is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal protobuf") set(USE_INTERNAL_PROTOBUF_LIBRARY 0) endif() set(MISSING_INTERNAL_PROTOBUF_LIBRARY 1) @@ -14,12 +20,17 @@ endif() if(NOT USE_INTERNAL_PROTOBUF_LIBRARY) find_package(Protobuf) + if (Protobuf_LIBRARY AND Protobuf_INCLUDE_DIR AND Protobuf_PROTOC_EXECUTABLE) + set(EXTERNAL_PROTOBUF_LIBRARY_FOUND 1) + set(USE_PROTOBUF 1) + else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system protobuf") + set(EXTERNAL_PROTOBUF_LIBRARY_FOUND 0) + endif() endif() -if (Protobuf_LIBRARY AND Protobuf_INCLUDE_DIR) - set(USE_PROTOBUF 1) -elseif(NOT MISSING_INTERNAL_PROTOBUF_LIBRARY) - set(Protobuf_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/protobuf/src) +if (NOT EXTERNAL_PROTOBUF_LIBRARY_FOUND AND NOT MISSING_INTERNAL_PROTOBUF_LIBRARY) + set(Protobuf_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/protobuf/src") set(USE_PROTOBUF 1) set(USE_INTERNAL_PROTOBUF_LIBRARY 1) @@ -34,13 +45,13 @@ if(OS_FREEBSD AND SANITIZE STREQUAL "address") # ../contrib/protobuf/src/google/protobuf/arena_impl.h:45:10: fatal error: 'sanitizer/asan_interface.h' file not found # #include if(LLVM_INCLUDE_DIRS) - set(Protobuf_INCLUDE_DIR ${Protobuf_INCLUDE_DIR} ${LLVM_INCLUDE_DIRS}) + set(Protobuf_INCLUDE_DIR "${Protobuf_INCLUDE_DIR}" ${LLVM_INCLUDE_DIRS}) else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use protobuf on FreeBSD with address sanitizer without LLVM") set(USE_PROTOBUF 0) endif() endif() -include (${ClickHouse_SOURCE_DIR}/cmake/protobuf_generate_cpp.cmake) -endif() +include ("${ClickHouse_SOURCE_DIR}/cmake/protobuf_generate_cpp.cmake") message(STATUS "Using protobuf=${USE_PROTOBUF}: ${Protobuf_INCLUDE_DIR} : ${Protobuf_LIBRARY} : ${Protobuf_PROTOC_EXECUTABLE}") diff --git a/cmake/find/rapidjson.cmake b/cmake/find/rapidjson.cmake index df896b644e5..f880d19143e 100644 --- a/cmake/find/rapidjson.cmake +++ b/cmake/find/rapidjson.cmake @@ -1,5 +1,8 @@ option(ENABLE_RAPIDJSON "Use rapidjson" ${ENABLE_LIBRARIES}) if(NOT ENABLE_RAPIDJSON) + if(USE_INTERNAL_RAPIDJSON_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal rapidjson library with ENABLE_RAPIDJSON=OFF") + endif() return() endif() @@ -8,6 +11,7 @@ option(USE_INTERNAL_RAPIDJSON_LIBRARY "Set to FALSE to use system rapidjson libr if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/rapidjson/include/rapidjson/rapidjson.h") if(USE_INTERNAL_RAPIDJSON_LIBRARY) message(WARNING "submodule contrib/rapidjson is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal rapidjson library") set(USE_INTERNAL_RAPIDJSON_LIBRARY 0) endif() set(MISSING_INTERNAL_RAPIDJSON_LIBRARY 1) @@ -15,6 +19,9 @@ endif() if(NOT USE_INTERNAL_RAPIDJSON_LIBRARY) find_path(RAPIDJSON_INCLUDE_DIR NAMES rapidjson/rapidjson.h PATHS ${RAPIDJSON_INCLUDE_PATHS}) + if(NOT RAPIDJSON_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system rapidjson") + endif() endif() if(RAPIDJSON_INCLUDE_DIR) diff --git a/cmake/find/rdkafka.cmake b/cmake/find/rdkafka.cmake index f18674dd440..d9f815dbcdd 100644 --- a/cmake/find/rdkafka.cmake +++ b/cmake/find/rdkafka.cmake @@ -1,37 +1,66 @@ # Freebsd: contrib/cppkafka/include/cppkafka/detail/endianness.h:53:23: error: 'betoh16' was not declared in this scope if (NOT ARCH_ARM AND NOT OS_FREEBSD AND OPENSSL_FOUND) option (ENABLE_RDKAFKA "Enable kafka" ${ENABLE_LIBRARIES}) +elseif(ENABLE_RDKAFKA AND NOT OPENSSL_FOUND) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use librdkafka without SSL") +elseif(ENABLE_RDKAFKA) + message (${RECONFIGURE_MESSAGE_LEVEL} "librdafka is not supported on ARM and on FreeBSD") endif () -if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cppkafka/CMakeLists.txt") - message (WARNING "submodule contrib/cppkafka is missing. to fix try run: \n git submodule update --init --recursive") - set (ENABLE_RDKAFKA 0) -endif () - -if (ENABLE_RDKAFKA) +if (NOT ENABLE_RDKAFKA) + if (USE_INTERNAL_RDKAFKA_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal librdkafka with ENABLE_RDKAFKA=OFF") + endif() + return() +endif() if (NOT ARCH_ARM AND USE_LIBGSASL) option (USE_INTERNAL_RDKAFKA_LIBRARY "Set to FALSE to use system librdkafka instead of the bundled" ${NOT_UNBUNDLED}) +elseif(USE_INTERNAL_RDKAFKA_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal librdkafka with ARCH_ARM=${ARCH_ARM} AND USE_LIBGSASL=${USE_LIBGSASL}") endif () -if (USE_INTERNAL_RDKAFKA_LIBRARY AND NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/librdkafka/CMakeLists.txt") - message (WARNING "submodule contrib/librdkafka is missing. to fix try run: \n git submodule update --init --recursive") - set (USE_INTERNAL_RDKAFKA_LIBRARY 0) - set (MISSING_INTERNAL_RDKAFKA_LIBRARY 1) +if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cppkafka/CMakeLists.txt") + if(USE_INTERNAL_RDKAFKA_LIBRARY) + message (WARNING "submodule contrib/cppkafka is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal cppkafka") + set (USE_INTERNAL_RDKAFKA_LIBRARY 0) + endif() + set (MISSING_INTERNAL_CPPKAFKA_LIBRARY 1) +endif () + +if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/librdkafka/CMakeLists.txt") + if(USE_INTERNAL_RDKAFKA_LIBRARY OR MISSING_INTERNAL_CPPKAFKA_LIBRARY) + message (WARNING "submodule contrib/librdkafka is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal rdkafka") + set (USE_INTERNAL_RDKAFKA_LIBRARY 0) + endif() + set (MISSING_INTERNAL_RDKAFKA_LIBRARY 1) endif () if (NOT USE_INTERNAL_RDKAFKA_LIBRARY) find_library (RDKAFKA_LIB rdkafka) find_path (RDKAFKA_INCLUDE_DIR NAMES librdkafka/rdkafka.h PATHS ${RDKAFKA_INCLUDE_PATHS}) + if (NOT RDKAFKA_LIB OR NOT RDKAFKA_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system librdkafka") + endif() + if (USE_STATIC_LIBRARIES AND NOT OS_FREEBSD) find_library (SASL2_LIBRARY sasl2) + if (NOT SASL2_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system sasl2 library needed for static librdkafka") + endif() endif () set (CPPKAFKA_LIBRARY cppkafka) # TODO: try to use unbundled version. endif () if (RDKAFKA_LIB AND RDKAFKA_INCLUDE_DIR) set (USE_RDKAFKA 1) - set (RDKAFKA_LIBRARY ${RDKAFKA_LIB} ${OPENSSL_LIBRARIES}) + add_library (rdkafka_imp UNKNOWN IMPORTED) + set_target_properties (rdkafka_imp PROPERTIES IMPORTED_LOCATION ${RDKAFKA_LIB}) + set_target_properties (rdkafka_imp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${RDKAFKA_INCLUDE_DIR}) + + set (RDKAFKA_LIBRARY rdkafka_imp ${OPENSSL_LIBRARIES}) set (CPPKAFKA_LIBRARY cppkafka) if (SASL2_LIBRARY) list (APPEND RDKAFKA_LIBRARY ${SASL2_LIBRARY}) @@ -39,14 +68,14 @@ if (RDKAFKA_LIB AND RDKAFKA_INCLUDE_DIR) if (LZ4_LIBRARY) list (APPEND RDKAFKA_LIBRARY ${LZ4_LIBRARY}) endif () -elseif (NOT MISSING_INTERNAL_RDKAFKA_LIBRARY AND NOT ARCH_ARM) +elseif (NOT MISSING_INTERNAL_RDKAFKA_LIBRARY AND NOT MISSING_INTERNAL_CPPKAFKA_LIBRARY AND NOT ARCH_ARM) set (USE_INTERNAL_RDKAFKA_LIBRARY 1) set (RDKAFKA_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/librdkafka/src") set (RDKAFKA_LIBRARY rdkafka) set (CPPKAFKA_LIBRARY cppkafka) set (USE_RDKAFKA 1) -endif () - +elseif(ARCH_ARM) + message (${RECONFIGURE_MESSAGE_LEVEL} "Using internal rdkafka on ARM is not supported") endif () message (STATUS "Using librdkafka=${USE_RDKAFKA}: ${RDKAFKA_INCLUDE_DIR} : ${RDKAFKA_LIBRARY} ${CPPKAFKA_LIBRARY}") diff --git a/cmake/find/re2.cmake b/cmake/find/re2.cmake index 05ba80f143f..87bc974c788 100644 --- a/cmake/find/re2.cmake +++ b/cmake/find/re2.cmake @@ -3,6 +3,7 @@ option (USE_INTERNAL_RE2_LIBRARY "Set to FALSE to use system re2 library instead if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/re2/CMakeLists.txt") if(USE_INTERNAL_RE2_LIBRARY) message(WARNING "submodule contrib/re2 is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal re2 library") endif() set(USE_INTERNAL_RE2_LIBRARY 0) set(MISSING_INTERNAL_RE2_LIBRARY 1) @@ -11,6 +12,9 @@ endif() if (NOT USE_INTERNAL_RE2_LIBRARY) find_library (RE2_LIBRARY re2) find_path (RE2_INCLUDE_DIR NAMES re2/re2.h PATHS ${RE2_INCLUDE_PATHS}) + if (NOT RE2_LIBRARY OR NOT RE2_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system re2 library") + endif () endif () string(FIND ${CMAKE_CURRENT_BINARY_DIR} " " _have_space) @@ -24,12 +28,13 @@ if (RE2_LIBRARY AND RE2_INCLUDE_DIR) elseif (NOT MISSING_INTERNAL_RE2_LIBRARY) set (USE_INTERNAL_RE2_LIBRARY 1) set (RE2_LIBRARY re2) - set (RE2_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/re2) + set (RE2_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/re2") if (NOT MISSING_INTERNAL_RE2_ST_LIBRARY) set (RE2_ST_LIBRARY re2_st) set (USE_RE2_ST 1) else () set (RE2_ST_LIBRARY ${RE2_LIBRARY}) + message (${RECONFIGURE_MESSAGE_LEVEL} "Using internal re2 library instead of re2_st") endif () endif () diff --git a/cmake/find/s3.cmake b/cmake/find/s3.cmake index af53dc80feb..1bbf48fd6b0 100644 --- a/cmake/find/s3.cmake +++ b/cmake/find/s3.cmake @@ -1,26 +1,45 @@ if(NOT OS_FREEBSD AND NOT APPLE AND NOT ARCH_ARM) option(ENABLE_S3 "Enable S3" ${ENABLE_LIBRARIES}) +elseif(ENABLE_S3 OR USE_INTERNAL_AWS_S3_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use S3 on ARM, Apple or FreeBSD") endif() -if(ENABLE_S3) - option(USE_INTERNAL_AWS_S3_LIBRARY "Set to FALSE to use system S3 instead of bundled" ${NOT_UNBUNDLED}) - - if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-s3") - message (WARNING "submodule contrib/aws is missing. to fix try run: \n git submodule update --init --recursive") - set (MISSING_AWS_S3 1) - endif () - - if (USE_INTERNAL_AWS_S3_LIBRARY AND NOT MISSING_AWS_S3) - set(AWS_S3_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-s3/include") - set(AWS_S3_CORE_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-core/include") - set(AWS_S3_LIBRARY aws_s3) - set(USE_INTERNAL_AWS_S3_LIBRARY 1) - set(USE_AWS_S3 1) - else() - set(USE_INTERNAL_AWS_S3_LIBRARY 0) - set(USE_AWS_S3 0) - endif () - +if(NOT ENABLE_S3) + if(USE_INTERNAL_AWS_S3_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal S3 library with ENABLE_S3=OFF") + endif() + return() endif() +option(USE_INTERNAL_AWS_S3_LIBRARY "Set to FALSE to use system S3 instead of bundled (experimental set to OFF on your own risk)" + ON) + +if (NOT USE_INTERNAL_POCO_LIBRARY AND USE_INTERNAL_AWS_S3_LIBRARY) + message (FATAL_ERROR "Currently S3 support can be built only with internal POCO library") +endif() + +if (NOT USE_INTERNAL_AWS_S3_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Compilation with external S3 library is not supported yet") +endif() + +if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-s3") + message (WARNING "submodule contrib/aws is missing. to fix try run: \n git submodule update --init --recursive") + if (USE_INTERNAL_AWS_S3_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal S3 library") + endif () + set (MISSING_AWS_S3 1) +endif () + +if (USE_INTERNAL_AWS_S3_LIBRARY AND NOT MISSING_AWS_S3) + set(AWS_S3_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-s3/include") + set(AWS_S3_CORE_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-core/include") + set(AWS_S3_LIBRARY aws_s3) + set(USE_INTERNAL_AWS_S3_LIBRARY 1) + set(USE_AWS_S3 1) +else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't enable S3") + set(USE_INTERNAL_AWS_S3_LIBRARY 0) + set(USE_AWS_S3 0) +endif () + message (STATUS "Using aws_s3=${USE_AWS_S3}: ${AWS_S3_INCLUDE_DIR} : ${AWS_S3_LIBRARY}") diff --git a/cmake/find/sentry.cmake b/cmake/find/sentry.cmake index 84425220f12..2936c045f99 100644 --- a/cmake/find/sentry.cmake +++ b/cmake/find/sentry.cmake @@ -2,6 +2,9 @@ set (SENTRY_LIBRARY "sentry") set (SENTRY_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/sentry-native/include") if (NOT EXISTS "${SENTRY_INCLUDE_DIR}/sentry.h") message (WARNING "submodule contrib/sentry-native is missing. to fix try run: \n git submodule update --init --recursive") + if (USE_SENTRY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal sentry library") + endif() return() endif () @@ -16,4 +19,6 @@ if (NOT OS_FREEBSD AND NOT SPLIT_SHARED_LIBRARIES AND NOT_UNBUNDLED AND NOT (OS_ message (STATUS "Using sentry=${USE_SENTRY}: ${SENTRY_LIBRARY}") include_directories("${SENTRY_INCLUDE_DIR}") +elseif (USE_SENTRY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Sentry is not supported in current configuration") endif () diff --git a/cmake/find/simdjson.cmake b/cmake/find/simdjson.cmake index 4b1f3224076..cffe20bdb2d 100644 --- a/cmake/find/simdjson.cmake +++ b/cmake/find/simdjson.cmake @@ -1,8 +1,11 @@ +option (USE_SIMDJSON "Use simdjson" ${ENABLE_LIBRARIES}) + if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/simdjson/include/simdjson.h") message (WARNING "submodule contrib/simdjson is missing. to fix try run: \n git submodule update --init --recursive") + if (USE_SIMDJSON) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal simdjson library") + endif() return() endif () -option (USE_SIMDJSON "Use simdjson" ON) - message(STATUS "Using simdjson=${USE_SIMDJSON}") diff --git a/cmake/find/snappy.cmake b/cmake/find/snappy.cmake index 504db87d613..e719231c338 100644 --- a/cmake/find/snappy.cmake +++ b/cmake/find/snappy.cmake @@ -1,13 +1,21 @@ option(USE_SNAPPY "Enable support of snappy library" ${ENABLE_LIBRARIES}) -if(USE_SNAPPY) - option (USE_INTERNAL_SNAPPY_LIBRARY "Set to FALSE to use system snappy library instead of bundled" ${NOT_UNBUNDLED}) - - if(NOT USE_INTERNAL_SNAPPY_LIBRARY) - find_library(SNAPPY_LIBRARY snappy) - else () - set(SNAPPY_LIBRARY snappy) +if(NOT USE_SNAPPY) + if (USE_INTERNAL_SNAPPY_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal snappy library with USE_SNAPPY=OFF") endif() + return() +endif() - message (STATUS "Using snappy: ${SNAPPY_LIBRARY}") -endif () +option (USE_INTERNAL_SNAPPY_LIBRARY "Set to FALSE to use system snappy library instead of bundled" ${NOT_UNBUNDLED}) + +if(NOT USE_INTERNAL_SNAPPY_LIBRARY) + find_library(SNAPPY_LIBRARY snappy) + if (NOT SNAPPY_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system snappy library") + endif() +else () + set(SNAPPY_LIBRARY snappy) +endif() + +message (STATUS "Using snappy: ${SNAPPY_LIBRARY}") diff --git a/cmake/find/sparsehash.cmake b/cmake/find/sparsehash.cmake index d34ed8e048b..f258f6c1c5b 100644 --- a/cmake/find/sparsehash.cmake +++ b/cmake/find/sparsehash.cmake @@ -1,7 +1,11 @@ -option (USE_INTERNAL_SPARSEHASH_LIBRARY "Set to FALSE to use system sparsehash library instead of bundled" ${NOT_UNBUNDLED}) +option (USE_INTERNAL_SPARSEHASH_LIBRARY "Set to FALSE to use system sparsehash library instead of bundled" + ON) # ON by default as we are not aware of any system providing package for sparsehash-c11 if (NOT USE_INTERNAL_SPARSEHASH_LIBRARY) find_path (SPARSEHASH_INCLUDE_DIR NAMES sparsehash/sparse_hash_map PATHS ${SPARSEHASH_INCLUDE_PATHS}) + if (NOT SPARSEHASH_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system sparsehash library") + endif () endif () if (SPARSEHASH_INCLUDE_DIR) diff --git a/cmake/find/ssl.cmake b/cmake/find/ssl.cmake index efc9127309c..9058857c173 100644 --- a/cmake/find/ssl.cmake +++ b/cmake/find/ssl.cmake @@ -1,12 +1,18 @@ option(ENABLE_SSL "Enable ssl" ${ENABLE_LIBRARIES}) -if(ENABLE_SSL) +if(NOT ENABLE_SSL) + if (USE_INTERNAL_SSL_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal ssl library with ENABLE_SSL=OFF") + endif() + return() +endif() option(USE_INTERNAL_SSL_LIBRARY "Set to FALSE to use system *ssl library instead of bundled" ${NOT_UNBUNDLED}) if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/openssl/README") if(USE_INTERNAL_SSL_LIBRARY) message(WARNING "submodule contrib/openssl is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal ssl library") endif() set(USE_INTERNAL_SSL_LIBRARY 0) set(MISSING_INTERNAL_SSL_LIBRARY 1) @@ -36,6 +42,10 @@ if (NOT USE_INTERNAL_SSL_LIBRARY) set (OPENSSL_FOUND 1) endif () endif () + + if (NOT OPENSSL_FOUND) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system ssl") + endif() endif () if (NOT OPENSSL_FOUND AND NOT MISSING_INTERNAL_SSL_LIBRARY) @@ -123,7 +133,4 @@ if(OPENSSL_FOUND AND NOT USE_INTERNAL_SSL_LIBRARY) endif() endif() - -endif () - message (STATUS "Using ssl=${USE_SSL}: ${OPENSSL_INCLUDE_DIR} : ${OPENSSL_LIBRARIES}") diff --git a/cmake/find/stats.cmake b/cmake/find/stats.cmake index ef5b1a73659..339e8524598 100644 --- a/cmake/find/stats.cmake +++ b/cmake/find/stats.cmake @@ -14,6 +14,10 @@ if (ENABLE_STATS) set(GCEM_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/gcem/include) set (USE_STATS 1) endif() + + if (NOT USE_STATS) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't enable stats library") + endif() endif() message (STATUS "Using stats=${USE_STATS} : ${STATS_INCLUDE_DIR}") diff --git a/cmake/find/termcap.cmake b/cmake/find/termcap.cmake new file mode 100644 index 00000000000..58454165785 --- /dev/null +++ b/cmake/find/termcap.cmake @@ -0,0 +1,17 @@ +if (ENABLE_EMBEDDED_COMPILER AND NOT USE_INTERNAL_LLVM_LIBRARY AND USE_STATIC_LIBRARIES) + find_library (TERMCAP_LIBRARY tinfo) + if (NOT TERMCAP_LIBRARY) + find_library (TERMCAP_LIBRARY ncurses) + endif() + if (NOT TERMCAP_LIBRARY) + find_library (TERMCAP_LIBRARY termcap) + endif() + + if (NOT TERMCAP_LIBRARY) + message (FATAL_ERROR "Statically Linking external LLVM requires termcap") + endif() + + target_link_libraries(LLVMSupport INTERFACE ${TERMCAP_LIBRARY}) + + message (STATUS "Using termcap: ${TERMCAP_LIBRARY}") +endif() diff --git a/cmake/find/zlib.cmake b/cmake/find/zlib.cmake index f65d379f577..9a82699dc3a 100644 --- a/cmake/find/zlib.cmake +++ b/cmake/find/zlib.cmake @@ -6,12 +6,14 @@ else () set (INTERNAL_ZLIB_NAME "zlib" CACHE INTERNAL "") if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/${INTERNAL_ZLIB_NAME}") message (WARNING "Will use standard zlib, please clone manually:\n git clone https://github.com/madler/zlib.git ${ClickHouse_SOURCE_DIR}/contrib/${INTERNAL_ZLIB_NAME}") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal zlib library") endif () endif () if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/${INTERNAL_ZLIB_NAME}/zlib.h") if(USE_INTERNAL_ZLIB_LIBRARY) message(WARNING "submodule contrib/${INTERNAL_ZLIB_NAME} is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal zlib library") endif() set(USE_INTERNAL_ZLIB_LIBRARY 0) set(MISSING_INTERNAL_ZLIB_LIBRARY 1) @@ -19,6 +21,11 @@ endif() if (NOT USE_INTERNAL_ZLIB_LIBRARY) find_package (ZLIB) + if (NOT ZLIB_FOUND) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system zlib library") + else() + set (ZLIB_NAME "libz") + endif() endif () if (NOT ZLIB_FOUND AND NOT MISSING_INTERNAL_ZLIB_LIBRARY) @@ -28,6 +35,7 @@ if (NOT ZLIB_FOUND AND NOT MISSING_INTERNAL_ZLIB_LIBRARY) set (ZLIB_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIR}) # for protobuf set (ZLIB_FOUND 1) # for poco set (ZLIB_LIBRARIES zlib CACHE INTERNAL "") + set (ZLIB_NAME "${INTERNAL_ZLIB_NAME}") endif () -message (STATUS "Using ${INTERNAL_ZLIB_NAME}: ${ZLIB_INCLUDE_DIR} : ${ZLIB_LIBRARIES}") +message (STATUS "Using ${ZLIB_NAME}: ${ZLIB_INCLUDE_DIR} : ${ZLIB_LIBRARIES}") diff --git a/cmake/find/zstd.cmake b/cmake/find/zstd.cmake index e4f32d4b170..b12bb701e0e 100644 --- a/cmake/find/zstd.cmake +++ b/cmake/find/zstd.cmake @@ -3,14 +3,18 @@ option (USE_INTERNAL_ZSTD_LIBRARY "Set to FALSE to use system zstd library inste if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/zstd/lib/zstd.h") if(USE_INTERNAL_ZSTD_LIBRARY) message(WARNING "submodule contrib/zstd is missing. to fix try run: \n git submodule update --init --recursive") + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal zstd library") + set(USE_INTERNAL_ZSTD_LIBRARY 0) endif() - set(USE_INTERNAL_ZSTD_LIBRARY 0) set(MISSING_INTERNAL_ZSTD_LIBRARY 1) endif() if (NOT USE_INTERNAL_ZSTD_LIBRARY) find_library (ZSTD_LIBRARY zstd) find_path (ZSTD_INCLUDE_DIR NAMES zstd.h PATHS ${ZSTD_INCLUDE_PATHS}) + if (NOT ZSTD_LIBRARY OR NOT ZSTD_INCLUDE_DIR) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system zstd library") + endif () endif () if (ZSTD_LIBRARY AND ZSTD_INCLUDE_DIR) diff --git a/cmake/target.cmake b/cmake/target.cmake index 35040e48956..7174ca3c2a9 100644 --- a/cmake/target.cmake +++ b/cmake/target.cmake @@ -17,21 +17,33 @@ endif () if (CMAKE_CROSSCOMPILING) if (OS_DARWIN) # FIXME: broken dependencies - set (USE_SNAPPY OFF CACHE INTERNAL "") set (ENABLE_PROTOBUF OFF CACHE INTERNAL "") - set (ENABLE_PARQUET OFF CACHE INTERNAL "") + set (ENABLE_GRPC OFF CACHE INTERNAL "") # no protobuf -> no grpc + + set (USE_SNAPPY OFF CACHE INTERNAL "") + set (ENABLE_PARQUET OFF CACHE INTERNAL "") # no snappy and protobuf -> no parquet + set (ENABLE_ORC OFF CACHE INTERNAL "") # no arrow (parquet) -> no orc + set (ENABLE_ICU OFF CACHE INTERNAL "") set (ENABLE_FASTOPS OFF CACHE INTERNAL "") elseif (OS_LINUX OR OS_ANDROID) if (ARCH_AARCH64) # FIXME: broken dependencies set (ENABLE_PROTOBUF OFF CACHE INTERNAL "") + set (ENABLE_GRPC OFF CACHE INTERNAL "") + set (ENABLE_PARQUET OFF CACHE INTERNAL "") + set (ENABLE_ORC OFF CACHE INTERNAL "") + set (ENABLE_MYSQL OFF CACHE INTERNAL "") endif () elseif (OS_FREEBSD) # FIXME: broken dependencies set (ENABLE_PROTOBUF OFF CACHE INTERNAL "") + set (ENABLE_GRPC OFF CACHE INTERNAL "") + + set (ENABLE_ORC OFF CACHE INTERNAL "") # no protobuf -> no parquet -> no orc + set (ENABLE_EMBEDDED_COMPILER OFF CACHE INTERNAL "") else () message (FATAL_ERROR "Trying to cross-compile to unsupported system: ${CMAKE_SYSTEM_NAME}!") diff --git a/cmake/tools.cmake b/cmake/tools.cmake index 95e00ad9951..a6ea573a59d 100644 --- a/cmake/tools.cmake +++ b/cmake/tools.cmake @@ -41,25 +41,23 @@ STRING(REGEX MATCHALL "[0-9]+" COMPILER_VERSION_LIST ${CMAKE_CXX_COMPILER_VERSIO LIST(GET COMPILER_VERSION_LIST 0 COMPILER_VERSION_MAJOR) option (LINKER_NAME "Linker name or full path") -if (COMPILER_GCC) +if (COMPILER_GCC AND NOT LINKER_NAME) find_program (LLD_PATH NAMES "ld.lld") find_program (GOLD_PATH NAMES "ld.gold") -else () +elseif (NOT LINKER_NAME) find_program (LLD_PATH NAMES "ld.lld-${COMPILER_VERSION_MAJOR}" "lld-${COMPILER_VERSION_MAJOR}" "ld.lld" "lld") find_program (GOLD_PATH NAMES "ld.gold" "gold") endif () -if (OS_LINUX) +if (OS_LINUX AND NOT LINKER_NAME) # We prefer LLD linker over Gold or BFD on Linux. - if (NOT LINKER_NAME) - if (LLD_PATH) - if (COMPILER_GCC) - # GCC driver requires one of supported linker names like "lld". - set (LINKER_NAME "lld") - else () - # Clang driver simply allows full linker path. - set (LINKER_NAME ${LLD_PATH}) - endif () + if (LLD_PATH) + if (COMPILER_GCC) + # GCC driver requires one of supported linker names like "lld". + set (LINKER_NAME "lld") + else () + # Clang driver simply allows full linker path. + set (LINKER_NAME ${LLD_PATH}) endif () endif () diff --git a/contrib/arrow-cmake/CMakeLists.txt b/contrib/arrow-cmake/CMakeLists.txt index be8cb9a9708..442f2534f6a 100644 --- a/contrib/arrow-cmake/CMakeLists.txt +++ b/contrib/arrow-cmake/CMakeLists.txt @@ -80,7 +80,7 @@ set(FLATBUFFERS_BINARY_DIR ${ClickHouse_BINARY_DIR}/contrib/flatbuffers) set(FLATBUFFERS_INCLUDE_DIR ${FLATBUFFERS_SRC_DIR}/include) # set flatbuffers CMake options -if (${USE_STATIC_LIBRARIES}) +if (MAKE_STATIC_LIBRARIES) set(FLATBUFFERS_BUILD_FLATLIB ON CACHE BOOL "Enable the build of the flatbuffers library") set(FLATBUFFERS_BUILD_SHAREDLIB OFF CACHE BOOL "Disable the build of the flatbuffers shared library") else () diff --git a/contrib/boost-cmake/CMakeLists.txt b/contrib/boost-cmake/CMakeLists.txt index e92fe4b7159..fd860c9f9b0 100644 --- a/contrib/boost-cmake/CMakeLists.txt +++ b/contrib/boost-cmake/CMakeLists.txt @@ -1,6 +1,52 @@ option (USE_INTERNAL_BOOST_LIBRARY "Use internal Boost library" ${NOT_UNBUNDLED}) -if (USE_INTERNAL_BOOST_LIBRARY) +if (NOT USE_INTERNAL_BOOST_LIBRARY) + # 1.70 like in contrib/boost + # 1.71 on CI + set(BOOST_VERSION 1.71) + + find_package(Boost ${BOOST_VERSION} COMPONENTS + system + filesystem + iostreams + program_options + regex + ) + + if(Boost_INCLUDE_DIR AND Boost_FILESYSTEM_LIBRARY AND Boost_FILESYSTEM_LIBRARY AND + Boost_PROGRAM_OPTIONS_LIBRARY AND Boost_REGEX_LIBRARY AND Boost_SYSTEM_LIBRARY) + + set(EXTERNAL_BOOST_FOUND 1) + + add_library (_boost_headers_only INTERFACE) + add_library (boost::headers_only ALIAS _boost_headers_only) + target_include_directories (_boost_headers_only SYSTEM BEFORE INTERFACE ${Boost_INCLUDE_DIR}) + + add_library (_boost_filesystem INTERFACE) + add_library (_boost_iostreams INTERFACE) + add_library (_boost_program_options INTERFACE) + add_library (_boost_regex INTERFACE) + add_library (_boost_system INTERFACE) + + target_link_libraries (_boost_filesystem INTERFACE ${Boost_FILESYSTEM_LIBRARY}) + target_link_libraries (_boost_iostreams INTERFACE ${Boost_IOSTREAMS_LIBRARY}) + target_link_libraries (_boost_program_options INTERFACE ${Boost_PROGRAM_OPTIONS_LIBRARY}) + target_link_libraries (_boost_regex INTERFACE ${Boost_REGEX_LIBRARY}) + target_link_libraries (_boost_system INTERFACE ${Boost_SYSTEM_LIBRARY}) + + add_library (boost::filesystem ALIAS _boost_filesystem) + add_library (boost::iostreams ALIAS _boost_iostreams) + add_library (boost::program_options ALIAS _boost_program_options) + add_library (boost::regex ALIAS _boost_regex) + add_library (boost::system ALIAS _boost_system) + else() + set(EXTERNAL_BOOST_FOUND 0) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system boost") + endif() +endif() + +if (NOT EXTERNAL_BOOST_FOUND) + set (USE_INTERNAL_BOOST_LIBRARY 1) set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/boost) # filesystem @@ -38,7 +84,7 @@ if (USE_INTERNAL_BOOST_LIBRARY) add_library (_boost_iostreams ${SRCS_IOSTREAMS}) add_library (boost::iostreams ALIAS _boost_iostreams) target_include_directories (_boost_iostreams PRIVATE ${LIBRARY_DIR}) - target_link_libraries (_boost_iostreams PRIVATE zlib) + target_link_libraries (_boost_iostreams PRIVATE ${ZLIB_LIBRARIES}) # program_options @@ -96,38 +142,4 @@ if (USE_INTERNAL_BOOST_LIBRARY) add_library (_boost_system ${SRCS_SYSTEM}) add_library (boost::system ALIAS _boost_system) target_include_directories (_boost_system PRIVATE ${LIBRARY_DIR}) -else () - # 1.70 like in contrib/boost - # 1.67 on CI - set(BOOST_VERSION 1.67) - - find_package(Boost ${BOOST_VERSION} COMPONENTS - system - filesystem - iostreams - program_options - regex - REQUIRED) - - add_library (_boost_headers_only INTERFACE) - add_library (boost::headers_only ALIAS _boost_headers_only) - target_include_directories (_boost_headers_only SYSTEM BEFORE INTERFACE ${Boost_INCLUDE_DIR}) - - add_library (_boost_filesystem INTERFACE) - add_library (_boost_iostreams INTERFACE) - add_library (_boost_program_options INTERFACE) - add_library (_boost_regex INTERFACE) - add_library (_boost_system INTERFACE) - - target_link_libraries (_boost_filesystem INTERFACE ${Boost_FILESYSTEM_LIBRARY}) - target_link_libraries (_boost_iostreams INTERFACE ${Boost_IOSTREAMS_LIBRARY}) - target_link_libraries (_boost_program_options INTERFACE ${Boost_PROGRAM_OPTIONS_LIBRARY}) - target_link_libraries (_boost_regex INTERFACE ${Boost_REGEX_LIBRARY}) - target_link_libraries (_boost_system INTERFACE ${Boost_SYSTEM_LIBRARY}) - - add_library (boost::filesystem ALIAS _boost_filesystem) - add_library (boost::iostreams ALIAS _boost_iostreams) - add_library (boost::program_options ALIAS _boost_program_options) - add_library (boost::regex ALIAS _boost_regex) - add_library (boost::system ALIAS _boost_system) endif () diff --git a/contrib/cctz-cmake/CMakeLists.txt b/contrib/cctz-cmake/CMakeLists.txt index ee87b3233ad..90e33dc9f62 100644 --- a/contrib/cctz-cmake/CMakeLists.txt +++ b/contrib/cctz-cmake/CMakeLists.txt @@ -1,9 +1,48 @@ -option (USE_INTERNAL_CCTZ "Use internal cctz library" ${NOT_UNBUNDLED}) +option (USE_INTERNAL_CCTZ_LIBRARY "Use internal cctz library" ${NOT_UNBUNDLED}) -if (USE_INTERNAL_CCTZ) - SET(LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/cctz) +if (NOT USE_INTERNAL_CCTZ_LIBRARY) + find_library (LIBRARY_CCTZ cctz) + find_path (INCLUDE_CCTZ NAMES cctz/civil_time.h) - SET (SRCS + if (LIBRARY_CCTZ AND INCLUDE_CCTZ) + set (EXTERNAL_CCTZ_LIBRARY_FOUND 1) + + set(CMAKE_REQUIRED_LIBRARIES ${LIBRARY_CCTZ}) + set(CMAKE_REQUIRED_INCLUDES ${INCLUDE_CCTZ}) + check_cxx_source_compiles( + " + #include + int main() { + cctz::civil_day date; + } + " + EXTERNAL_CCTZ_LIBRARY_WORKS + ) + + if (NOT EXTERNAL_CCTZ_LIBRARY_WORKS) + message (${RECONFIGURE_MESSAGE_LEVEL} "External cctz is not working: ${LIBRARY_CCTZ} ${INCLUDE_CCTZ}") + else() + add_library (cctz UNKNOWN IMPORTED) + set_property (TARGET cctz PROPERTY IMPORTED_LOCATION ${LIBRARY_CCTZ}) + set_property (TARGET cctz PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_CCTZ}) + endif() + + set(SYSTEM_STORAGE_TZ_FILE "${CMAKE_BINARY_DIR}/src/Storages/System/StorageSystemTimeZones.generated.cpp") + file(REMOVE ${SYSTEM_STORAGE_TZ_FILE}) + file(APPEND ${SYSTEM_STORAGE_TZ_FILE} "// autogenerated by ClickHouse/contrib/cctz-cmake/CMakeLists.txt\n") + file(APPEND ${SYSTEM_STORAGE_TZ_FILE} "const char * auto_time_zones[] {nullptr};\n" ) + + else() + set (EXTERNAL_CCTZ_LIBRARY_FOUND 0) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system cctz") + endif() +endif() + +if (NOT EXTERNAL_CCTZ_LIBRARY_FOUND OR NOT EXTERNAL_CCTZ_LIBRARY_WORKS) + set(USE_INTERNAL_CCTZ_LIBRARY 1) + set(LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/cctz) + + set (SRCS ${LIBRARY_DIR}/src/civil_time_detail.cc ${LIBRARY_DIR}/src/time_zone_fixed.cc ${LIBRARY_DIR}/src/time_zone_format.cc @@ -24,591 +63,51 @@ if (USE_INTERNAL_CCTZ) target_compile_definitions (cctz PRIVATE __USE_BSD linux _XOPEN_SOURCE=600) endif () + # Related to time_zones table: + # StorageSystemTimeZones.generated.cpp is autogenerated each time during a build + # data in this file will be used to populate the system.time_zones table, this is specific to OS_LINUX + # as the library that's built using embedded tzdata is also specific to OS_LINUX + set(SYSTEM_STORAGE_TZ_FILE "${CMAKE_BINARY_DIR}/src/Storages/System/StorageSystemTimeZones.generated.cpp") + # remove existing copies so that its generated fresh on each build. + file(REMOVE ${SYSTEM_STORAGE_TZ_FILE}) # Build a libray with embedded tzdata - if (OS_LINUX) - - set (TIMEZONES - Africa/Abidjan - Africa/Accra - Africa/Addis_Ababa - Africa/Algiers - Africa/Asmara - Africa/Asmera - Africa/Bamako - Africa/Bangui - Africa/Banjul - Africa/Bissau - Africa/Blantyre - Africa/Brazzaville - Africa/Bujumbura - Africa/Cairo - Africa/Casablanca - Africa/Ceuta - Africa/Conakry - Africa/Dakar - Africa/Dar_es_Salaam - Africa/Djibouti - Africa/Douala - Africa/El_Aaiun - Africa/Freetown - Africa/Gaborone - Africa/Harare - Africa/Johannesburg - Africa/Juba - Africa/Kampala - Africa/Khartoum - Africa/Kigali - Africa/Kinshasa - Africa/Lagos - Africa/Libreville - Africa/Lome - Africa/Luanda - Africa/Lubumbashi - Africa/Lusaka - Africa/Malabo - Africa/Maputo - Africa/Maseru - Africa/Mbabane - Africa/Mogadishu - Africa/Monrovia - Africa/Nairobi - Africa/Ndjamena - Africa/Niamey - Africa/Nouakchott - Africa/Ouagadougou - Africa/Porto-Novo - Africa/Sao_Tome - Africa/Timbuktu - Africa/Tripoli - Africa/Tunis - Africa/Windhoek - America/Adak - America/Anchorage - America/Anguilla - America/Antigua - America/Araguaina - America/Argentina/Buenos_Aires - America/Argentina/Catamarca - America/Argentina/ComodRivadavia - America/Argentina/Cordoba - America/Argentina/Jujuy - America/Argentina/La_Rioja - America/Argentina/Mendoza - America/Argentina/Rio_Gallegos - America/Argentina/Salta - America/Argentina/San_Juan - America/Argentina/San_Luis - America/Argentina/Tucuman - America/Argentina/Ushuaia - America/Aruba - America/Asuncion - America/Atikokan - America/Atka - America/Bahia - America/Bahia_Banderas - America/Barbados - America/Belem - America/Belize - America/Blanc-Sablon - America/Boa_Vista - America/Bogota - America/Boise - America/Buenos_Aires - America/Cambridge_Bay - America/Campo_Grande - America/Cancun - America/Caracas - America/Catamarca - America/Cayenne - America/Cayman - America/Chicago - America/Chihuahua - America/Coral_Harbour - America/Cordoba - America/Costa_Rica - America/Creston - America/Cuiaba - America/Curacao - America/Danmarkshavn - America/Dawson - America/Dawson_Creek - America/Denver - America/Detroit - America/Dominica - America/Edmonton - America/Eirunepe - America/El_Salvador - America/Ensenada - America/Fortaleza - America/Fort_Nelson - America/Fort_Wayne - America/Glace_Bay - America/Godthab - America/Goose_Bay - America/Grand_Turk - America/Grenada - America/Guadeloupe - America/Guatemala - America/Guayaquil - America/Guyana - America/Halifax - America/Havana - America/Hermosillo - America/Indiana/Indianapolis - America/Indiana/Knox - America/Indiana/Marengo - America/Indiana/Petersburg - America/Indianapolis - America/Indiana/Tell_City - America/Indiana/Vevay - America/Indiana/Vincennes - America/Indiana/Winamac - America/Inuvik - America/Iqaluit - America/Jamaica - America/Jujuy - America/Juneau - America/Kentucky/Louisville - America/Kentucky/Monticello - America/Knox_IN - America/Kralendijk - America/La_Paz - America/Lima - America/Los_Angeles - America/Louisville - America/Lower_Princes - America/Maceio - America/Managua - America/Manaus - America/Marigot - America/Martinique - America/Matamoros - America/Mazatlan - America/Mendoza - America/Menominee - America/Merida - America/Metlakatla - America/Mexico_City - America/Miquelon - America/Moncton - America/Monterrey - America/Montevideo - America/Montreal - America/Montserrat - America/Nassau - America/New_York - America/Nipigon - America/Nome - America/Noronha - America/North_Dakota/Beulah - America/North_Dakota/Center - America/North_Dakota/New_Salem - America/Ojinaga - America/Panama - America/Pangnirtung - America/Paramaribo - America/Phoenix - America/Port-au-Prince - America/Porto_Acre - America/Port_of_Spain - America/Porto_Velho - America/Puerto_Rico - America/Punta_Arenas - America/Rainy_River - America/Rankin_Inlet - America/Recife - America/Regina - America/Resolute - America/Rio_Branco - America/Rosario - America/Santa_Isabel - America/Santarem - America/Santiago - America/Santo_Domingo - America/Sao_Paulo - America/Scoresbysund - America/Shiprock - America/Sitka - America/St_Barthelemy - America/St_Johns - America/St_Kitts - America/St_Lucia - America/St_Thomas - America/St_Vincent - America/Swift_Current - America/Tegucigalpa - America/Thule - America/Thunder_Bay - America/Tijuana - America/Toronto - America/Tortola - America/Vancouver - America/Virgin - America/Whitehorse - America/Winnipeg - America/Yakutat - America/Yellowknife - Antarctica/Casey - Antarctica/Davis - Antarctica/DumontDUrville - Antarctica/Macquarie - Antarctica/Mawson - Antarctica/McMurdo - Antarctica/Palmer - Antarctica/Rothera - Antarctica/South_Pole - Antarctica/Syowa - Antarctica/Troll - Antarctica/Vostok - Arctic/Longyearbyen - Asia/Aden - Asia/Almaty - Asia/Amman - Asia/Anadyr - Asia/Aqtau - Asia/Aqtobe - Asia/Ashgabat - Asia/Ashkhabad - Asia/Atyrau - Asia/Baghdad - Asia/Bahrain - Asia/Baku - Asia/Bangkok - Asia/Barnaul - Asia/Beirut - Asia/Bishkek - Asia/Brunei - Asia/Calcutta - Asia/Chita - Asia/Choibalsan - Asia/Chongqing - Asia/Chungking - Asia/Colombo - Asia/Dacca - Asia/Damascus - Asia/Dhaka - Asia/Dili - Asia/Dubai - Asia/Dushanbe - Asia/Famagusta - Asia/Gaza - Asia/Harbin - Asia/Hebron - Asia/Ho_Chi_Minh - Asia/Hong_Kong - Asia/Hovd - Asia/Irkutsk - Asia/Istanbul - Asia/Jakarta - Asia/Jayapura - Asia/Jerusalem - Asia/Kabul - Asia/Kamchatka - Asia/Karachi - Asia/Kashgar - Asia/Kathmandu - Asia/Katmandu - Asia/Khandyga - Asia/Kolkata - Asia/Krasnoyarsk - Asia/Kuala_Lumpur - Asia/Kuching - Asia/Kuwait - Asia/Macao - Asia/Macau - Asia/Magadan - Asia/Makassar - Asia/Manila - Asia/Muscat - Asia/Nicosia - Asia/Novokuznetsk - Asia/Novosibirsk - Asia/Omsk - Asia/Oral - Asia/Phnom_Penh - Asia/Pontianak - Asia/Pyongyang - Asia/Qatar - Asia/Qostanay - Asia/Qyzylorda - Asia/Rangoon - Asia/Riyadh - Asia/Saigon - Asia/Sakhalin - Asia/Samarkand - Asia/Seoul - Asia/Shanghai - Asia/Singapore - Asia/Srednekolymsk - Asia/Taipei - Asia/Tashkent - Asia/Tbilisi - Asia/Tehran - Asia/Tel_Aviv - Asia/Thimbu - Asia/Thimphu - Asia/Tokyo - Asia/Tomsk - Asia/Ujung_Pandang - Asia/Ulaanbaatar - Asia/Ulan_Bator - Asia/Urumqi - Asia/Ust-Nera - Asia/Vientiane - Asia/Vladivostok - Asia/Yakutsk - Asia/Yangon - Asia/Yekaterinburg - Asia/Yerevan - Atlantic/Azores - Atlantic/Bermuda - Atlantic/Canary - Atlantic/Cape_Verde - Atlantic/Faeroe - Atlantic/Faroe - Atlantic/Jan_Mayen - Atlantic/Madeira - Atlantic/Reykjavik - Atlantic/South_Georgia - Atlantic/Stanley - Atlantic/St_Helena - Australia/ACT - Australia/Adelaide - Australia/Brisbane - Australia/Broken_Hill - Australia/Canberra - Australia/Currie - Australia/Darwin - Australia/Eucla - Australia/Hobart - Australia/LHI - Australia/Lindeman - Australia/Lord_Howe - Australia/Melbourne - Australia/North - Australia/NSW - Australia/Perth - Australia/Queensland - Australia/South - Australia/Sydney - Australia/Tasmania - Australia/Victoria - Australia/West - Australia/Yancowinna - Brazil/Acre - Brazil/DeNoronha - Brazil/East - Brazil/West - Canada/Atlantic - Canada/Central - Canada/Eastern - Canada/Mountain - Canada/Newfoundland - Canada/Pacific - Canada/Saskatchewan - Canada/Yukon - CET - Chile/Continental - Chile/EasterIsland - CST6CDT - Cuba - EET - Egypt - Eire - EST - EST5EDT - Etc/GMT - Etc/Greenwich - Etc/UCT - Etc/Universal - Etc/UTC - Etc/Zulu - Europe/Amsterdam - Europe/Andorra - Europe/Astrakhan - Europe/Athens - Europe/Belfast - Europe/Belgrade - Europe/Berlin - Europe/Bratislava - Europe/Brussels - Europe/Bucharest - Europe/Budapest - Europe/Busingen - Europe/Chisinau - Europe/Copenhagen - Europe/Dublin - Europe/Gibraltar - Europe/Guernsey - Europe/Helsinki - Europe/Isle_of_Man - Europe/Istanbul - Europe/Jersey - Europe/Kaliningrad - Europe/Kiev - Europe/Kirov - Europe/Lisbon - Europe/Ljubljana - Europe/London - Europe/Luxembourg - Europe/Madrid - Europe/Malta - Europe/Mariehamn - Europe/Minsk - Europe/Monaco - Europe/Moscow - Europe/Nicosia - Europe/Oslo - Europe/Paris - Europe/Podgorica - Europe/Prague - Europe/Riga - Europe/Rome - Europe/Samara - Europe/San_Marino - Europe/Sarajevo - Europe/Saratov - Europe/Simferopol - Europe/Skopje - Europe/Sofia - Europe/Stockholm - Europe/Tallinn - Europe/Tirane - Europe/Tiraspol - Europe/Ulyanovsk - Europe/Uzhgorod - Europe/Vaduz - Europe/Vatican - Europe/Vienna - Europe/Vilnius - Europe/Volgograd - Europe/Warsaw - Europe/Zagreb - Europe/Zaporozhye - Europe/Zurich - Factory - GB - GB-Eire - GMT - GMT0 - Greenwich - Hongkong - HST - Iceland - Indian/Antananarivo - Indian/Chagos - Indian/Christmas - Indian/Cocos - Indian/Comoro - Indian/Kerguelen - Indian/Mahe - Indian/Maldives - Indian/Mauritius - Indian/Mayotte - Indian/Reunion - Iran - Israel - Jamaica - Japan - Kwajalein - Libya - MET - Mexico/BajaNorte - Mexico/BajaSur - Mexico/General - MST - MST7MDT - Navajo - NZ - NZ-CHAT - Pacific/Apia - Pacific/Auckland - Pacific/Bougainville - Pacific/Chatham - Pacific/Chuuk - Pacific/Easter - Pacific/Efate - Pacific/Enderbury - Pacific/Fakaofo - Pacific/Fiji - Pacific/Funafuti - Pacific/Galapagos - Pacific/Gambier - Pacific/Guadalcanal - Pacific/Guam - Pacific/Honolulu - Pacific/Johnston - Pacific/Kiritimati - Pacific/Kosrae - Pacific/Kwajalein - Pacific/Majuro - Pacific/Marquesas - Pacific/Midway - Pacific/Nauru - Pacific/Niue - Pacific/Norfolk - Pacific/Noumea - Pacific/Pago_Pago - Pacific/Palau - Pacific/Pitcairn - Pacific/Pohnpei - Pacific/Ponape - Pacific/Port_Moresby - Pacific/Rarotonga - Pacific/Saipan - Pacific/Samoa - Pacific/Tahiti - Pacific/Tarawa - Pacific/Tongatapu - Pacific/Truk - Pacific/Wake - Pacific/Wallis - Pacific/Yap - Poland - Portugal - PRC - PST8PDT - ROC - ROK - Singapore - Turkey - UCT - Universal - US/Alaska - US/Aleutian - US/Arizona - US/Central - US/Eastern - US/East-Indiana - US/Hawaii - US/Indiana-Starke - US/Michigan - US/Mountain - US/Pacific - US/Samoa - UTC - WET - W-SU - Zulu) - + # get the list of timezones from tzdata shipped with cctz set(TZDIR ${LIBRARY_DIR}/testdata/zoneinfo) + file(STRINGS ${LIBRARY_DIR}/testdata/version TZDATA_VERSION) + set_property(GLOBAL PROPERTY TZDATA_VERSION_PROP "${TZDATA_VERSION}") + message(STATUS "Packaging with tzdata version: ${TZDATA_VERSION}") + set(TZ_OBJS) + # each file in that dir (except of tab and localtime) store the info about timezone + execute_process(COMMAND + bash -c "cd ${TZDIR} && find * -type f -and ! -name '*.tab' -and ! -name 'localtime' | sort | paste -sd ';'" + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE TIMEZONES) + + file(APPEND ${SYSTEM_STORAGE_TZ_FILE} "// autogenerated by ClickHouse/contrib/cctz-cmake/CMakeLists.txt\n") + file(APPEND ${SYSTEM_STORAGE_TZ_FILE} "const char * auto_time_zones[] {\n" ) + foreach(TIMEZONE ${TIMEZONES}) + file(APPEND ${SYSTEM_STORAGE_TZ_FILE} " \"${TIMEZONE}\",\n") string(REPLACE "/" "_" TIMEZONE_ID ${TIMEZONE}) + string(REPLACE "+" "_PLUS_" TIMEZONE_ID ${TIMEZONE_ID}) set(TZ_OBJ ${TIMEZONE_ID}.o) set(TZ_OBJS ${TZ_OBJS} ${TZ_OBJ}) # https://stackoverflow.com/questions/14776463/compile-and-add-an-object-file-from-a-binary-with-cmake add_custom_command(OUTPUT ${TZ_OBJ} - COMMAND cd ${TZDIR} && ${OBJCOPY_PATH} -I binary ${OBJCOPY_ARCH_OPTIONS} ${TIMEZONE} ${CMAKE_CURRENT_BINARY_DIR}/${TZ_OBJ} - COMMAND ${OBJCOPY_PATH} --rename-section .data=.rodata,alloc,load,readonly,data,contents - ${CMAKE_CURRENT_BINARY_DIR}/${TZ_OBJ} ${CMAKE_CURRENT_BINARY_DIR}/${TZ_OBJ}) + COMMAND cp ${TZDIR}/${TIMEZONE} ${CMAKE_CURRENT_BINARY_DIR}/${TIMEZONE_ID} + COMMAND cd ${CMAKE_CURRENT_BINARY_DIR} && ${OBJCOPY_PATH} -I binary ${OBJCOPY_ARCH_OPTIONS} + --rename-section .data=.rodata,alloc,load,readonly,data,contents ${TIMEZONE_ID} ${TZ_OBJ} + COMMAND rm ${CMAKE_CURRENT_BINARY_DIR}/${TIMEZONE_ID}) set_source_files_properties(${TZ_OBJ} PROPERTIES EXTERNAL_OBJECT true GENERATED true) endforeach(TIMEZONE) + file(APPEND ${SYSTEM_STORAGE_TZ_FILE} " nullptr};\n") + add_library(tzdata STATIC ${TZ_OBJS}) set_target_properties(tzdata PROPERTIES LINKER_LANGUAGE C) # whole-archive prevents symbols from being discarded for unknown reason @@ -617,29 +116,9 @@ if (USE_INTERNAL_CCTZ) # library into single string. add_dependencies(cctz tzdata) target_link_libraries(cctz INTERFACE "-Wl,${WHOLE_ARCHIVE} $ -Wl,${NO_WHOLE_ARCHIVE}") - endif () - -else () - find_library (LIBRARY_CCTZ cctz) - find_path (INCLUDE_CCTZ NAMES cctz/civil_time.h) - - add_library (cctz UNKNOWN IMPORTED) - set_property (TARGET cctz PROPERTY IMPORTED_LOCATION ${LIBRARY_CCTZ}) - set_property (TARGET cctz PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_CCTZ}) - - set(CMAKE_REQUIRED_LIBRARIES cctz) - check_cxx_source_compiles( - " - #include - int main() { - cctz::civil_day date; - } - " - EXTERNAL_CCTZ_WORKS - ) - - if (NOT EXTERNAL_CCTZ_WORKS) - message (FATAL_ERROR "cctz is unusable: ${LIBRARY_CCTZ} ${INCLUDE_CCTZ}") + else () + file(APPEND ${SYSTEM_STORAGE_TZ_FILE} "// autogenerated by ClickHouse/contrib/cctz-cmake/CMakeLists.txt\n") + file(APPEND ${SYSTEM_STORAGE_TZ_FILE} "const char * auto_time_zones[] {nullptr};\n" ) endif () endif () diff --git a/contrib/curl-cmake/CMakeLists.txt b/contrib/curl-cmake/CMakeLists.txt index 3c3226cae9e..a24c9fa8765 100644 --- a/contrib/curl-cmake/CMakeLists.txt +++ b/contrib/curl-cmake/CMakeLists.txt @@ -1,187 +1,179 @@ -option (ENABLE_CURL "Enable curl" ${ENABLE_LIBRARIES}) +if (NOT USE_INTERNAL_CURL) + return() +endif() -if (ENABLE_CURL) - option (USE_INTERNAL_CURL "Use internal curl library" ${NOT_UNBUNDLED}) +set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/curl") - if (USE_INTERNAL_CURL) - set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/curl") +set (SRCS + ${LIBRARY_DIR}/lib/file.c + ${LIBRARY_DIR}/lib/timeval.c + ${LIBRARY_DIR}/lib/base64.c + ${LIBRARY_DIR}/lib/hostip.c + ${LIBRARY_DIR}/lib/progress.c + ${LIBRARY_DIR}/lib/formdata.c + ${LIBRARY_DIR}/lib/cookie.c + ${LIBRARY_DIR}/lib/http.c + ${LIBRARY_DIR}/lib/sendf.c + ${LIBRARY_DIR}/lib/url.c + ${LIBRARY_DIR}/lib/dict.c + ${LIBRARY_DIR}/lib/if2ip.c + ${LIBRARY_DIR}/lib/speedcheck.c + ${LIBRARY_DIR}/lib/ldap.c + ${LIBRARY_DIR}/lib/version.c + ${LIBRARY_DIR}/lib/getenv.c + ${LIBRARY_DIR}/lib/escape.c + ${LIBRARY_DIR}/lib/mprintf.c + ${LIBRARY_DIR}/lib/telnet.c + ${LIBRARY_DIR}/lib/netrc.c + ${LIBRARY_DIR}/lib/getinfo.c + ${LIBRARY_DIR}/lib/transfer.c + ${LIBRARY_DIR}/lib/strcase.c + ${LIBRARY_DIR}/lib/easy.c + ${LIBRARY_DIR}/lib/security.c + ${LIBRARY_DIR}/lib/curl_fnmatch.c + ${LIBRARY_DIR}/lib/fileinfo.c + ${LIBRARY_DIR}/lib/wildcard.c + ${LIBRARY_DIR}/lib/krb5.c + ${LIBRARY_DIR}/lib/memdebug.c + ${LIBRARY_DIR}/lib/http_chunks.c + ${LIBRARY_DIR}/lib/strtok.c + ${LIBRARY_DIR}/lib/connect.c + ${LIBRARY_DIR}/lib/llist.c + ${LIBRARY_DIR}/lib/hash.c + ${LIBRARY_DIR}/lib/multi.c + ${LIBRARY_DIR}/lib/content_encoding.c + ${LIBRARY_DIR}/lib/share.c + ${LIBRARY_DIR}/lib/http_digest.c + ${LIBRARY_DIR}/lib/md4.c + ${LIBRARY_DIR}/lib/md5.c + ${LIBRARY_DIR}/lib/http_negotiate.c + ${LIBRARY_DIR}/lib/inet_pton.c + ${LIBRARY_DIR}/lib/strtoofft.c + ${LIBRARY_DIR}/lib/strerror.c + ${LIBRARY_DIR}/lib/amigaos.c + ${LIBRARY_DIR}/lib/hostasyn.c + ${LIBRARY_DIR}/lib/hostip4.c + ${LIBRARY_DIR}/lib/hostip6.c + ${LIBRARY_DIR}/lib/hostsyn.c + ${LIBRARY_DIR}/lib/inet_ntop.c + ${LIBRARY_DIR}/lib/parsedate.c + ${LIBRARY_DIR}/lib/select.c + ${LIBRARY_DIR}/lib/splay.c + ${LIBRARY_DIR}/lib/strdup.c + ${LIBRARY_DIR}/lib/socks.c + ${LIBRARY_DIR}/lib/curl_addrinfo.c + ${LIBRARY_DIR}/lib/socks_gssapi.c + ${LIBRARY_DIR}/lib/socks_sspi.c + ${LIBRARY_DIR}/lib/curl_sspi.c + ${LIBRARY_DIR}/lib/slist.c + ${LIBRARY_DIR}/lib/nonblock.c + ${LIBRARY_DIR}/lib/curl_memrchr.c + ${LIBRARY_DIR}/lib/imap.c + ${LIBRARY_DIR}/lib/pop3.c + ${LIBRARY_DIR}/lib/smtp.c + ${LIBRARY_DIR}/lib/pingpong.c + ${LIBRARY_DIR}/lib/rtsp.c + ${LIBRARY_DIR}/lib/curl_threads.c + ${LIBRARY_DIR}/lib/warnless.c + ${LIBRARY_DIR}/lib/hmac.c + ${LIBRARY_DIR}/lib/curl_rtmp.c + ${LIBRARY_DIR}/lib/openldap.c + ${LIBRARY_DIR}/lib/curl_gethostname.c + ${LIBRARY_DIR}/lib/gopher.c + ${LIBRARY_DIR}/lib/idn_win32.c + ${LIBRARY_DIR}/lib/http_proxy.c + ${LIBRARY_DIR}/lib/non-ascii.c + ${LIBRARY_DIR}/lib/asyn-thread.c + ${LIBRARY_DIR}/lib/curl_gssapi.c + ${LIBRARY_DIR}/lib/http_ntlm.c + ${LIBRARY_DIR}/lib/curl_ntlm_wb.c + ${LIBRARY_DIR}/lib/curl_ntlm_core.c + ${LIBRARY_DIR}/lib/curl_sasl.c + ${LIBRARY_DIR}/lib/rand.c + ${LIBRARY_DIR}/lib/curl_multibyte.c + ${LIBRARY_DIR}/lib/hostcheck.c + ${LIBRARY_DIR}/lib/conncache.c + ${LIBRARY_DIR}/lib/dotdot.c + ${LIBRARY_DIR}/lib/x509asn1.c + ${LIBRARY_DIR}/lib/http2.c + ${LIBRARY_DIR}/lib/smb.c + ${LIBRARY_DIR}/lib/curl_endian.c + ${LIBRARY_DIR}/lib/curl_des.c + ${LIBRARY_DIR}/lib/system_win32.c + ${LIBRARY_DIR}/lib/mime.c + ${LIBRARY_DIR}/lib/sha256.c + ${LIBRARY_DIR}/lib/setopt.c + ${LIBRARY_DIR}/lib/curl_path.c + ${LIBRARY_DIR}/lib/curl_ctype.c + ${LIBRARY_DIR}/lib/curl_range.c + ${LIBRARY_DIR}/lib/psl.c + ${LIBRARY_DIR}/lib/doh.c + ${LIBRARY_DIR}/lib/urlapi.c + ${LIBRARY_DIR}/lib/curl_get_line.c + ${LIBRARY_DIR}/lib/altsvc.c + ${LIBRARY_DIR}/lib/socketpair.c + ${LIBRARY_DIR}/lib/vauth/vauth.c + ${LIBRARY_DIR}/lib/vauth/cleartext.c + ${LIBRARY_DIR}/lib/vauth/cram.c + ${LIBRARY_DIR}/lib/vauth/digest.c + ${LIBRARY_DIR}/lib/vauth/digest_sspi.c + ${LIBRARY_DIR}/lib/vauth/krb5_gssapi.c + ${LIBRARY_DIR}/lib/vauth/krb5_sspi.c + ${LIBRARY_DIR}/lib/vauth/ntlm.c + ${LIBRARY_DIR}/lib/vauth/ntlm_sspi.c + ${LIBRARY_DIR}/lib/vauth/oauth2.c + ${LIBRARY_DIR}/lib/vauth/spnego_gssapi.c + ${LIBRARY_DIR}/lib/vauth/spnego_sspi.c + ${LIBRARY_DIR}/lib/vtls/openssl.c + ${LIBRARY_DIR}/lib/vtls/gtls.c + ${LIBRARY_DIR}/lib/vtls/vtls.c + ${LIBRARY_DIR}/lib/vtls/nss.c + ${LIBRARY_DIR}/lib/vtls/polarssl.c + ${LIBRARY_DIR}/lib/vtls/polarssl_threadlock.c + ${LIBRARY_DIR}/lib/vtls/wolfssl.c + ${LIBRARY_DIR}/lib/vtls/schannel.c + ${LIBRARY_DIR}/lib/vtls/schannel_verify.c + ${LIBRARY_DIR}/lib/vtls/sectransp.c + ${LIBRARY_DIR}/lib/vtls/gskit.c + ${LIBRARY_DIR}/lib/vtls/mbedtls.c + ${LIBRARY_DIR}/lib/vtls/mesalink.c + ${LIBRARY_DIR}/lib/vtls/bearssl.c + ${LIBRARY_DIR}/lib/vquic/ngtcp2.c + ${LIBRARY_DIR}/lib/vquic/quiche.c + ${LIBRARY_DIR}/lib/vssh/libssh2.c + ${LIBRARY_DIR}/lib/vssh/libssh.c +) - set (SRCS - ${LIBRARY_DIR}/lib/file.c - ${LIBRARY_DIR}/lib/timeval.c - ${LIBRARY_DIR}/lib/base64.c - ${LIBRARY_DIR}/lib/hostip.c - ${LIBRARY_DIR}/lib/progress.c - ${LIBRARY_DIR}/lib/formdata.c - ${LIBRARY_DIR}/lib/cookie.c - ${LIBRARY_DIR}/lib/http.c - ${LIBRARY_DIR}/lib/sendf.c - ${LIBRARY_DIR}/lib/url.c - ${LIBRARY_DIR}/lib/dict.c - ${LIBRARY_DIR}/lib/if2ip.c - ${LIBRARY_DIR}/lib/speedcheck.c - ${LIBRARY_DIR}/lib/ldap.c - ${LIBRARY_DIR}/lib/version.c - ${LIBRARY_DIR}/lib/getenv.c - ${LIBRARY_DIR}/lib/escape.c - ${LIBRARY_DIR}/lib/mprintf.c - ${LIBRARY_DIR}/lib/telnet.c - ${LIBRARY_DIR}/lib/netrc.c - ${LIBRARY_DIR}/lib/getinfo.c - ${LIBRARY_DIR}/lib/transfer.c - ${LIBRARY_DIR}/lib/strcase.c - ${LIBRARY_DIR}/lib/easy.c - ${LIBRARY_DIR}/lib/security.c - ${LIBRARY_DIR}/lib/curl_fnmatch.c - ${LIBRARY_DIR}/lib/fileinfo.c - ${LIBRARY_DIR}/lib/wildcard.c - ${LIBRARY_DIR}/lib/krb5.c - ${LIBRARY_DIR}/lib/memdebug.c - ${LIBRARY_DIR}/lib/http_chunks.c - ${LIBRARY_DIR}/lib/strtok.c - ${LIBRARY_DIR}/lib/connect.c - ${LIBRARY_DIR}/lib/llist.c - ${LIBRARY_DIR}/lib/hash.c - ${LIBRARY_DIR}/lib/multi.c - ${LIBRARY_DIR}/lib/content_encoding.c - ${LIBRARY_DIR}/lib/share.c - ${LIBRARY_DIR}/lib/http_digest.c - ${LIBRARY_DIR}/lib/md4.c - ${LIBRARY_DIR}/lib/md5.c - ${LIBRARY_DIR}/lib/http_negotiate.c - ${LIBRARY_DIR}/lib/inet_pton.c - ${LIBRARY_DIR}/lib/strtoofft.c - ${LIBRARY_DIR}/lib/strerror.c - ${LIBRARY_DIR}/lib/amigaos.c - ${LIBRARY_DIR}/lib/hostasyn.c - ${LIBRARY_DIR}/lib/hostip4.c - ${LIBRARY_DIR}/lib/hostip6.c - ${LIBRARY_DIR}/lib/hostsyn.c - ${LIBRARY_DIR}/lib/inet_ntop.c - ${LIBRARY_DIR}/lib/parsedate.c - ${LIBRARY_DIR}/lib/select.c - ${LIBRARY_DIR}/lib/splay.c - ${LIBRARY_DIR}/lib/strdup.c - ${LIBRARY_DIR}/lib/socks.c - ${LIBRARY_DIR}/lib/curl_addrinfo.c - ${LIBRARY_DIR}/lib/socks_gssapi.c - ${LIBRARY_DIR}/lib/socks_sspi.c - ${LIBRARY_DIR}/lib/curl_sspi.c - ${LIBRARY_DIR}/lib/slist.c - ${LIBRARY_DIR}/lib/nonblock.c - ${LIBRARY_DIR}/lib/curl_memrchr.c - ${LIBRARY_DIR}/lib/imap.c - ${LIBRARY_DIR}/lib/pop3.c - ${LIBRARY_DIR}/lib/smtp.c - ${LIBRARY_DIR}/lib/pingpong.c - ${LIBRARY_DIR}/lib/rtsp.c - ${LIBRARY_DIR}/lib/curl_threads.c - ${LIBRARY_DIR}/lib/warnless.c - ${LIBRARY_DIR}/lib/hmac.c - ${LIBRARY_DIR}/lib/curl_rtmp.c - ${LIBRARY_DIR}/lib/openldap.c - ${LIBRARY_DIR}/lib/curl_gethostname.c - ${LIBRARY_DIR}/lib/gopher.c - ${LIBRARY_DIR}/lib/idn_win32.c - ${LIBRARY_DIR}/lib/http_proxy.c - ${LIBRARY_DIR}/lib/non-ascii.c - ${LIBRARY_DIR}/lib/asyn-thread.c - ${LIBRARY_DIR}/lib/curl_gssapi.c - ${LIBRARY_DIR}/lib/http_ntlm.c - ${LIBRARY_DIR}/lib/curl_ntlm_wb.c - ${LIBRARY_DIR}/lib/curl_ntlm_core.c - ${LIBRARY_DIR}/lib/curl_sasl.c - ${LIBRARY_DIR}/lib/rand.c - ${LIBRARY_DIR}/lib/curl_multibyte.c - ${LIBRARY_DIR}/lib/hostcheck.c - ${LIBRARY_DIR}/lib/conncache.c - ${LIBRARY_DIR}/lib/dotdot.c - ${LIBRARY_DIR}/lib/x509asn1.c - ${LIBRARY_DIR}/lib/http2.c - ${LIBRARY_DIR}/lib/smb.c - ${LIBRARY_DIR}/lib/curl_endian.c - ${LIBRARY_DIR}/lib/curl_des.c - ${LIBRARY_DIR}/lib/system_win32.c - ${LIBRARY_DIR}/lib/mime.c - ${LIBRARY_DIR}/lib/sha256.c - ${LIBRARY_DIR}/lib/setopt.c - ${LIBRARY_DIR}/lib/curl_path.c - ${LIBRARY_DIR}/lib/curl_ctype.c - ${LIBRARY_DIR}/lib/curl_range.c - ${LIBRARY_DIR}/lib/psl.c - ${LIBRARY_DIR}/lib/doh.c - ${LIBRARY_DIR}/lib/urlapi.c - ${LIBRARY_DIR}/lib/curl_get_line.c - ${LIBRARY_DIR}/lib/altsvc.c - ${LIBRARY_DIR}/lib/socketpair.c - ${LIBRARY_DIR}/lib/vauth/vauth.c - ${LIBRARY_DIR}/lib/vauth/cleartext.c - ${LIBRARY_DIR}/lib/vauth/cram.c - ${LIBRARY_DIR}/lib/vauth/digest.c - ${LIBRARY_DIR}/lib/vauth/digest_sspi.c - ${LIBRARY_DIR}/lib/vauth/krb5_gssapi.c - ${LIBRARY_DIR}/lib/vauth/krb5_sspi.c - ${LIBRARY_DIR}/lib/vauth/ntlm.c - ${LIBRARY_DIR}/lib/vauth/ntlm_sspi.c - ${LIBRARY_DIR}/lib/vauth/oauth2.c - ${LIBRARY_DIR}/lib/vauth/spnego_gssapi.c - ${LIBRARY_DIR}/lib/vauth/spnego_sspi.c - ${LIBRARY_DIR}/lib/vtls/openssl.c - ${LIBRARY_DIR}/lib/vtls/gtls.c - ${LIBRARY_DIR}/lib/vtls/vtls.c - ${LIBRARY_DIR}/lib/vtls/nss.c - ${LIBRARY_DIR}/lib/vtls/polarssl.c - ${LIBRARY_DIR}/lib/vtls/polarssl_threadlock.c - ${LIBRARY_DIR}/lib/vtls/wolfssl.c - ${LIBRARY_DIR}/lib/vtls/schannel.c - ${LIBRARY_DIR}/lib/vtls/schannel_verify.c - ${LIBRARY_DIR}/lib/vtls/sectransp.c - ${LIBRARY_DIR}/lib/vtls/gskit.c - ${LIBRARY_DIR}/lib/vtls/mbedtls.c - ${LIBRARY_DIR}/lib/vtls/mesalink.c - ${LIBRARY_DIR}/lib/vtls/bearssl.c - ${LIBRARY_DIR}/lib/vquic/ngtcp2.c - ${LIBRARY_DIR}/lib/vquic/quiche.c - ${LIBRARY_DIR}/lib/vssh/libssh2.c - ${LIBRARY_DIR}/lib/vssh/libssh.c - ) +add_library (curl ${SRCS}) - add_library (curl ${SRCS}) +target_compile_definitions (curl PRIVATE + HAVE_CONFIG_H + BUILDING_LIBCURL + CURL_HIDDEN_SYMBOLS + libcurl_EXPORTS + OS="${CMAKE_SYSTEM_NAME}" +) +target_include_directories (curl PUBLIC + ${LIBRARY_DIR}/include + ${LIBRARY_DIR}/lib + . # curl_config.h +) - target_compile_definitions (curl PRIVATE - HAVE_CONFIG_H - BUILDING_LIBCURL - CURL_HIDDEN_SYMBOLS - libcurl_EXPORTS - OS="${CMAKE_SYSTEM_NAME}" - ) - target_include_directories (curl PUBLIC - ${LIBRARY_DIR}/include - ${LIBRARY_DIR}/lib - . # curl_config.h - ) +target_link_libraries (curl PRIVATE ssl) - target_link_libraries (curl PRIVATE ssl) +# The library is large - avoid bloat (XXX: is it?) +target_compile_options (curl PRIVATE -g0) - # The library is large - avoid bloat (XXX: is it?) - target_compile_options (curl PRIVATE -g0) - - # find_package(CURL) compatibility for the following packages that uses - # find_package(CURL)/include(FindCURL): - # - mariadb-connector-c - # - aws-s3-cmake - # - sentry-native - set (CURL_FOUND ON CACHE BOOL "") - set (CURL_ROOT_DIR ${LIBRARY_DIR} CACHE PATH "") - set (CURL_INCLUDE_DIR ${LIBRARY_DIR}/include CACHE PATH "") - set (CURL_INCLUDE_DIRS ${LIBRARY_DIR}/include CACHE PATH "") - set (CURL_LIBRARY curl CACHE STRING "") - set (CURL_LIBRARIES ${CURL_LIBRARY} CACHE STRING "") - set (CURL_VERSION_STRING 7.67.0 CACHE STRING "") - add_library (CURL::libcurl ALIAS ${CURL_LIBRARY}) - else () - find_package (CURL REQUIRED) - endif () -endif () - -message (STATUS "Using curl: ${CURL_INCLUDE_DIRS} : ${CURL_LIBRARIES}") +# find_package(CURL) compatibility for the following packages that uses +# find_package(CURL)/include(FindCURL): +# - mariadb-connector-c +# - aws-s3-cmake +# - sentry-native +set (CURL_FOUND ON CACHE BOOL "") +set (CURL_ROOT_DIR ${LIBRARY_DIR} CACHE PATH "") +set (CURL_INCLUDE_DIR ${LIBRARY_DIR}/include CACHE PATH "") +set (CURL_INCLUDE_DIRS ${LIBRARY_DIR}/include CACHE PATH "") +set (CURL_LIBRARY curl CACHE STRING "") +set (CURL_LIBRARIES ${CURL_LIBRARY} CACHE STRING "") +set (CURL_VERSION_STRING 7.67.0 CACHE STRING "") +add_library (CURL::libcurl ALIAS ${CURL_LIBRARY}) diff --git a/contrib/hyperscan-cmake/CMakeLists.txt b/contrib/hyperscan-cmake/CMakeLists.txt index bc2f6c4e89d..e403eeb9d3e 100644 --- a/contrib/hyperscan-cmake/CMakeLists.txt +++ b/contrib/hyperscan-cmake/CMakeLists.txt @@ -1,252 +1,272 @@ -option (ENABLE_HYPERSCAN "Enable hyperscan library" ${ENABLE_LIBRARIES}) - -if (NOT HAVE_SSSE3) +if (HAVE_SSSE3) + option (ENABLE_HYPERSCAN "Enable hyperscan library" ${ENABLE_LIBRARIES}) +elseif(ENABLE_HYPERSCAN) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use hyperscan without SSSE3") set (ENABLE_HYPERSCAN OFF) endif () -if (ENABLE_HYPERSCAN) - option (USE_INTERNAL_HYPERSCAN_LIBRARY "Use internal hyperscan library" ${NOT_UNBUNDLED}) - +if (NOT ENABLE_HYPERSCAN) if (USE_INTERNAL_HYPERSCAN_LIBRARY) - set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/hyperscan) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal hyperscan with ENABLE_HYPERSCAN=OFF") + endif() - set (SRCS - ${LIBRARY_DIR}/src/alloc.c - ${LIBRARY_DIR}/src/compiler/asserts.cpp - ${LIBRARY_DIR}/src/compiler/compiler.cpp - ${LIBRARY_DIR}/src/compiler/error.cpp - ${LIBRARY_DIR}/src/crc32.c - ${LIBRARY_DIR}/src/database.c - ${LIBRARY_DIR}/src/fdr/engine_description.cpp - ${LIBRARY_DIR}/src/fdr/fdr_compile_util.cpp - ${LIBRARY_DIR}/src/fdr/fdr_compile.cpp - ${LIBRARY_DIR}/src/fdr/fdr_confirm_compile.cpp - ${LIBRARY_DIR}/src/fdr/fdr_engine_description.cpp - ${LIBRARY_DIR}/src/fdr/fdr.c - ${LIBRARY_DIR}/src/fdr/flood_compile.cpp - ${LIBRARY_DIR}/src/fdr/teddy_compile.cpp - ${LIBRARY_DIR}/src/fdr/teddy_engine_description.cpp - ${LIBRARY_DIR}/src/fdr/teddy.c - ${LIBRARY_DIR}/src/grey.cpp - ${LIBRARY_DIR}/src/hs_valid_platform.c - ${LIBRARY_DIR}/src/hs_version.c - ${LIBRARY_DIR}/src/hs.cpp - ${LIBRARY_DIR}/src/hwlm/hwlm_build.cpp - ${LIBRARY_DIR}/src/hwlm/hwlm_literal.cpp - ${LIBRARY_DIR}/src/hwlm/hwlm.c - ${LIBRARY_DIR}/src/hwlm/noodle_build.cpp - ${LIBRARY_DIR}/src/hwlm/noodle_engine.c - ${LIBRARY_DIR}/src/nfa/accel_dfa_build_strat.cpp - ${LIBRARY_DIR}/src/nfa/accel.c - ${LIBRARY_DIR}/src/nfa/accelcompile.cpp - ${LIBRARY_DIR}/src/nfa/castle.c - ${LIBRARY_DIR}/src/nfa/castlecompile.cpp - ${LIBRARY_DIR}/src/nfa/dfa_build_strat.cpp - ${LIBRARY_DIR}/src/nfa/dfa_min.cpp - ${LIBRARY_DIR}/src/nfa/gough.c - ${LIBRARY_DIR}/src/nfa/goughcompile_accel.cpp - ${LIBRARY_DIR}/src/nfa/goughcompile_reg.cpp - ${LIBRARY_DIR}/src/nfa/goughcompile.cpp - ${LIBRARY_DIR}/src/nfa/lbr.c - ${LIBRARY_DIR}/src/nfa/limex_64.c - ${LIBRARY_DIR}/src/nfa/limex_accel.c - ${LIBRARY_DIR}/src/nfa/limex_compile.cpp - ${LIBRARY_DIR}/src/nfa/limex_native.c - ${LIBRARY_DIR}/src/nfa/limex_simd128.c - ${LIBRARY_DIR}/src/nfa/limex_simd256.c - ${LIBRARY_DIR}/src/nfa/limex_simd384.c - ${LIBRARY_DIR}/src/nfa/limex_simd512.c - ${LIBRARY_DIR}/src/nfa/mcclellan.c - ${LIBRARY_DIR}/src/nfa/mcclellancompile_util.cpp - ${LIBRARY_DIR}/src/nfa/mcclellancompile.cpp - ${LIBRARY_DIR}/src/nfa/mcsheng_compile.cpp - ${LIBRARY_DIR}/src/nfa/mcsheng_data.c - ${LIBRARY_DIR}/src/nfa/mcsheng.c - ${LIBRARY_DIR}/src/nfa/mpv.c - ${LIBRARY_DIR}/src/nfa/mpvcompile.cpp - ${LIBRARY_DIR}/src/nfa/nfa_api_dispatch.c - ${LIBRARY_DIR}/src/nfa/nfa_build_util.cpp - ${LIBRARY_DIR}/src/nfa/rdfa_graph.cpp - ${LIBRARY_DIR}/src/nfa/rdfa_merge.cpp - ${LIBRARY_DIR}/src/nfa/rdfa.cpp - ${LIBRARY_DIR}/src/nfa/repeat.c - ${LIBRARY_DIR}/src/nfa/repeatcompile.cpp - ${LIBRARY_DIR}/src/nfa/sheng.c - ${LIBRARY_DIR}/src/nfa/shengcompile.cpp - ${LIBRARY_DIR}/src/nfa/shufti.c - ${LIBRARY_DIR}/src/nfa/shufticompile.cpp - ${LIBRARY_DIR}/src/nfa/tamarama.c - ${LIBRARY_DIR}/src/nfa/tamaramacompile.cpp - ${LIBRARY_DIR}/src/nfa/truffle.c - ${LIBRARY_DIR}/src/nfa/trufflecompile.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_anchored_acyclic.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_anchored_dots.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_asserts.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_builder.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_calc_components.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_cyclic_redundancy.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_depth.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_dominators.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_edge_redundancy.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_equivalence.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_execute.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_expr_info.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_extparam.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_fixed_width.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_fuzzy.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_haig.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_holder.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_is_equal.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_lbr.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_limex_accel.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_limex.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_literal_analysis.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_literal_component.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_literal_decorated.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_mcclellan.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_misc_opt.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_netflow.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_prefilter.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_prune.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_puff.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_redundancy.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_region_redundancy.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_region.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_repeat.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_reports.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_restructuring.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_revacc.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_sep.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_small_literal_set.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_som_add_redundancy.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_som_util.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_som.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_split.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_squash.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_stop.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_uncalc_components.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_utf8.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_util.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_vacuous.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_violet.cpp - ${LIBRARY_DIR}/src/nfagraph/ng_width.cpp - ${LIBRARY_DIR}/src/nfagraph/ng.cpp - ${LIBRARY_DIR}/src/parser/AsciiComponentClass.cpp - ${LIBRARY_DIR}/src/parser/buildstate.cpp - ${LIBRARY_DIR}/src/parser/check_refs.cpp - ${LIBRARY_DIR}/src/parser/Component.cpp - ${LIBRARY_DIR}/src/parser/ComponentAlternation.cpp - ${LIBRARY_DIR}/src/parser/ComponentAssertion.cpp - ${LIBRARY_DIR}/src/parser/ComponentAtomicGroup.cpp - ${LIBRARY_DIR}/src/parser/ComponentBackReference.cpp - ${LIBRARY_DIR}/src/parser/ComponentBoundary.cpp - ${LIBRARY_DIR}/src/parser/ComponentByte.cpp - ${LIBRARY_DIR}/src/parser/ComponentClass.cpp - ${LIBRARY_DIR}/src/parser/ComponentCondReference.cpp - ${LIBRARY_DIR}/src/parser/ComponentEmpty.cpp - ${LIBRARY_DIR}/src/parser/ComponentEUS.cpp - ${LIBRARY_DIR}/src/parser/ComponentRepeat.cpp - ${LIBRARY_DIR}/src/parser/ComponentSequence.cpp - ${LIBRARY_DIR}/src/parser/ComponentVisitor.cpp - ${LIBRARY_DIR}/src/parser/ComponentWordBoundary.cpp - ${LIBRARY_DIR}/src/parser/ConstComponentVisitor.cpp - ${LIBRARY_DIR}/src/parser/control_verbs.cpp - ${LIBRARY_DIR}/src/parser/logical_combination.cpp - ${LIBRARY_DIR}/src/parser/parse_error.cpp - ${LIBRARY_DIR}/src/parser/parser_util.cpp - ${LIBRARY_DIR}/src/parser/Parser.cpp - ${LIBRARY_DIR}/src/parser/prefilter.cpp - ${LIBRARY_DIR}/src/parser/shortcut_literal.cpp - ${LIBRARY_DIR}/src/parser/ucp_table.cpp - ${LIBRARY_DIR}/src/parser/unsupported.cpp - ${LIBRARY_DIR}/src/parser/utf8_validate.cpp - ${LIBRARY_DIR}/src/parser/Utf8ComponentClass.cpp - ${LIBRARY_DIR}/src/rose/block.c - ${LIBRARY_DIR}/src/rose/catchup.c - ${LIBRARY_DIR}/src/rose/init.c - ${LIBRARY_DIR}/src/rose/match.c - ${LIBRARY_DIR}/src/rose/program_runtime.c - ${LIBRARY_DIR}/src/rose/rose_build_add_mask.cpp - ${LIBRARY_DIR}/src/rose/rose_build_add.cpp - ${LIBRARY_DIR}/src/rose/rose_build_anchored.cpp - ${LIBRARY_DIR}/src/rose/rose_build_bytecode.cpp - ${LIBRARY_DIR}/src/rose/rose_build_castle.cpp - ${LIBRARY_DIR}/src/rose/rose_build_compile.cpp - ${LIBRARY_DIR}/src/rose/rose_build_convert.cpp - ${LIBRARY_DIR}/src/rose/rose_build_dedupe.cpp - ${LIBRARY_DIR}/src/rose/rose_build_engine_blob.cpp - ${LIBRARY_DIR}/src/rose/rose_build_exclusive.cpp - ${LIBRARY_DIR}/src/rose/rose_build_groups.cpp - ${LIBRARY_DIR}/src/rose/rose_build_infix.cpp - ${LIBRARY_DIR}/src/rose/rose_build_instructions.cpp - ${LIBRARY_DIR}/src/rose/rose_build_lit_accel.cpp - ${LIBRARY_DIR}/src/rose/rose_build_long_lit.cpp - ${LIBRARY_DIR}/src/rose/rose_build_lookaround.cpp - ${LIBRARY_DIR}/src/rose/rose_build_matchers.cpp - ${LIBRARY_DIR}/src/rose/rose_build_merge.cpp - ${LIBRARY_DIR}/src/rose/rose_build_misc.cpp - ${LIBRARY_DIR}/src/rose/rose_build_program.cpp - ${LIBRARY_DIR}/src/rose/rose_build_role_aliasing.cpp - ${LIBRARY_DIR}/src/rose/rose_build_scatter.cpp - ${LIBRARY_DIR}/src/rose/rose_build_width.cpp - ${LIBRARY_DIR}/src/rose/rose_in_util.cpp - ${LIBRARY_DIR}/src/rose/stream.c - ${LIBRARY_DIR}/src/runtime.c - ${LIBRARY_DIR}/src/scratch.c - ${LIBRARY_DIR}/src/smallwrite/smallwrite_build.cpp - ${LIBRARY_DIR}/src/som/slot_manager.cpp - ${LIBRARY_DIR}/src/som/som_runtime.c - ${LIBRARY_DIR}/src/som/som_stream.c - ${LIBRARY_DIR}/src/stream_compress.c - ${LIBRARY_DIR}/src/util/alloc.cpp - ${LIBRARY_DIR}/src/util/charreach.cpp - ${LIBRARY_DIR}/src/util/clique.cpp - ${LIBRARY_DIR}/src/util/compile_context.cpp - ${LIBRARY_DIR}/src/util/compile_error.cpp - ${LIBRARY_DIR}/src/util/cpuid_flags.c - ${LIBRARY_DIR}/src/util/depth.cpp - ${LIBRARY_DIR}/src/util/fatbit_build.cpp - ${LIBRARY_DIR}/src/util/multibit_build.cpp - ${LIBRARY_DIR}/src/util/multibit.c - ${LIBRARY_DIR}/src/util/report_manager.cpp - ${LIBRARY_DIR}/src/util/simd_utils.c - ${LIBRARY_DIR}/src/util/state_compress.c - ${LIBRARY_DIR}/src/util/target_info.cpp - ${LIBRARY_DIR}/src/util/ue2string.cpp - ) + add_library (hyperscan INTERFACE) + target_compile_definitions (hyperscan INTERFACE USE_HYPERSCAN=0) - add_library (hyperscan ${SRCS}) + message (STATUS "Not using hyperscan") + return() +endif() - target_compile_definitions (hyperscan PUBLIC USE_HYPERSCAN=1) - target_compile_options (hyperscan - PRIVATE -g0 # Library has too much debug information - -march=corei7 -O2 -fno-strict-aliasing -fno-omit-frame-pointer -fvisibility=hidden # The options from original build system - -fno-sanitize=undefined # Assume the library takes care of itself - ) - target_include_directories (hyperscan - PRIVATE - common - ${LIBRARY_DIR}/include - ) - target_include_directories (hyperscan SYSTEM PUBLIC ${LIBRARY_DIR}/src) - if (ARCH_AMD64) - target_include_directories (hyperscan PRIVATE x86_64) - endif () - target_link_libraries (hyperscan PRIVATE boost::headers_only) - else () - find_library (LIBRARY_HYPERSCAN hs) - find_path (INCLUDE_HYPERSCAN NAMES hs.h HINTS /usr/include/hs) # Ubuntu puts headers in this folder +option (USE_INTERNAL_HYPERSCAN_LIBRARY "Use internal hyperscan library" ${NOT_UNBUNDLED}) + +if (NOT USE_INTERNAL_HYPERSCAN_LIBRARY) + find_library (LIBRARY_HYPERSCAN hs) + find_path (INCLUDE_HYPERSCAN NAMES hs.h HINTS /usr/include/hs) # Ubuntu puts headers in this folder + + if (LIBRARY_HYPERSCAN AND INCLUDE_HYPERSCAN) + set (EXTERNAL_HYPERSCAN_LIBRARY_FOUND 1) add_library (hyperscan UNKNOWN IMPORTED GLOBAL) set_target_properties (hyperscan PROPERTIES IMPORTED_LOCATION ${LIBRARY_HYPERSCAN}) set_target_properties (hyperscan PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_HYPERSCAN}) set_property(TARGET hyperscan APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USE_HYPERSCAN=1) + else () + set (EXTERNAL_HYPERSCAN_LIBRARY_FOUND 0) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system hyperscan library") endif () - message (STATUS "Using hyperscan") -else () - add_library (hyperscan INTERFACE) - target_compile_definitions (hyperscan INTERFACE USE_HYPERSCAN=0) - - message (STATUS "Not using hyperscan") endif () + +if (NOT EXTERNAL_HYPERSCAN_LIBRARY_FOUND) + set (USE_INTERNAL_HYPERSCAN_LIBRARY 1) + + set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/hyperscan) + + set (SRCS + ${LIBRARY_DIR}/src/alloc.c + ${LIBRARY_DIR}/src/compiler/asserts.cpp + ${LIBRARY_DIR}/src/compiler/compiler.cpp + ${LIBRARY_DIR}/src/compiler/error.cpp + ${LIBRARY_DIR}/src/crc32.c + ${LIBRARY_DIR}/src/database.c + ${LIBRARY_DIR}/src/fdr/engine_description.cpp + ${LIBRARY_DIR}/src/fdr/fdr_compile_util.cpp + ${LIBRARY_DIR}/src/fdr/fdr_compile.cpp + ${LIBRARY_DIR}/src/fdr/fdr_confirm_compile.cpp + ${LIBRARY_DIR}/src/fdr/fdr_engine_description.cpp + ${LIBRARY_DIR}/src/fdr/fdr.c + ${LIBRARY_DIR}/src/fdr/flood_compile.cpp + ${LIBRARY_DIR}/src/fdr/teddy_compile.cpp + ${LIBRARY_DIR}/src/fdr/teddy_engine_description.cpp + ${LIBRARY_DIR}/src/fdr/teddy.c + ${LIBRARY_DIR}/src/grey.cpp + ${LIBRARY_DIR}/src/hs_valid_platform.c + ${LIBRARY_DIR}/src/hs_version.c + ${LIBRARY_DIR}/src/hs.cpp + ${LIBRARY_DIR}/src/hwlm/hwlm_build.cpp + ${LIBRARY_DIR}/src/hwlm/hwlm_literal.cpp + ${LIBRARY_DIR}/src/hwlm/hwlm.c + ${LIBRARY_DIR}/src/hwlm/noodle_build.cpp + ${LIBRARY_DIR}/src/hwlm/noodle_engine.c + ${LIBRARY_DIR}/src/nfa/accel_dfa_build_strat.cpp + ${LIBRARY_DIR}/src/nfa/accel.c + ${LIBRARY_DIR}/src/nfa/accelcompile.cpp + ${LIBRARY_DIR}/src/nfa/castle.c + ${LIBRARY_DIR}/src/nfa/castlecompile.cpp + ${LIBRARY_DIR}/src/nfa/dfa_build_strat.cpp + ${LIBRARY_DIR}/src/nfa/dfa_min.cpp + ${LIBRARY_DIR}/src/nfa/gough.c + ${LIBRARY_DIR}/src/nfa/goughcompile_accel.cpp + ${LIBRARY_DIR}/src/nfa/goughcompile_reg.cpp + ${LIBRARY_DIR}/src/nfa/goughcompile.cpp + ${LIBRARY_DIR}/src/nfa/lbr.c + ${LIBRARY_DIR}/src/nfa/limex_64.c + ${LIBRARY_DIR}/src/nfa/limex_accel.c + ${LIBRARY_DIR}/src/nfa/limex_compile.cpp + ${LIBRARY_DIR}/src/nfa/limex_native.c + ${LIBRARY_DIR}/src/nfa/limex_simd128.c + ${LIBRARY_DIR}/src/nfa/limex_simd256.c + ${LIBRARY_DIR}/src/nfa/limex_simd384.c + ${LIBRARY_DIR}/src/nfa/limex_simd512.c + ${LIBRARY_DIR}/src/nfa/mcclellan.c + ${LIBRARY_DIR}/src/nfa/mcclellancompile_util.cpp + ${LIBRARY_DIR}/src/nfa/mcclellancompile.cpp + ${LIBRARY_DIR}/src/nfa/mcsheng_compile.cpp + ${LIBRARY_DIR}/src/nfa/mcsheng_data.c + ${LIBRARY_DIR}/src/nfa/mcsheng.c + ${LIBRARY_DIR}/src/nfa/mpv.c + ${LIBRARY_DIR}/src/nfa/mpvcompile.cpp + ${LIBRARY_DIR}/src/nfa/nfa_api_dispatch.c + ${LIBRARY_DIR}/src/nfa/nfa_build_util.cpp + ${LIBRARY_DIR}/src/nfa/rdfa_graph.cpp + ${LIBRARY_DIR}/src/nfa/rdfa_merge.cpp + ${LIBRARY_DIR}/src/nfa/rdfa.cpp + ${LIBRARY_DIR}/src/nfa/repeat.c + ${LIBRARY_DIR}/src/nfa/repeatcompile.cpp + ${LIBRARY_DIR}/src/nfa/sheng.c + ${LIBRARY_DIR}/src/nfa/shengcompile.cpp + ${LIBRARY_DIR}/src/nfa/shufti.c + ${LIBRARY_DIR}/src/nfa/shufticompile.cpp + ${LIBRARY_DIR}/src/nfa/tamarama.c + ${LIBRARY_DIR}/src/nfa/tamaramacompile.cpp + ${LIBRARY_DIR}/src/nfa/truffle.c + ${LIBRARY_DIR}/src/nfa/trufflecompile.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_anchored_acyclic.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_anchored_dots.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_asserts.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_builder.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_calc_components.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_cyclic_redundancy.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_depth.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_dominators.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_edge_redundancy.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_equivalence.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_execute.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_expr_info.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_extparam.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_fixed_width.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_fuzzy.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_haig.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_holder.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_is_equal.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_lbr.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_limex_accel.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_limex.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_literal_analysis.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_literal_component.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_literal_decorated.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_mcclellan.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_misc_opt.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_netflow.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_prefilter.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_prune.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_puff.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_redundancy.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_region_redundancy.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_region.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_repeat.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_reports.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_restructuring.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_revacc.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_sep.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_small_literal_set.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_som_add_redundancy.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_som_util.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_som.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_split.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_squash.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_stop.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_uncalc_components.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_utf8.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_util.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_vacuous.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_violet.cpp + ${LIBRARY_DIR}/src/nfagraph/ng_width.cpp + ${LIBRARY_DIR}/src/nfagraph/ng.cpp + ${LIBRARY_DIR}/src/parser/AsciiComponentClass.cpp + ${LIBRARY_DIR}/src/parser/buildstate.cpp + ${LIBRARY_DIR}/src/parser/check_refs.cpp + ${LIBRARY_DIR}/src/parser/Component.cpp + ${LIBRARY_DIR}/src/parser/ComponentAlternation.cpp + ${LIBRARY_DIR}/src/parser/ComponentAssertion.cpp + ${LIBRARY_DIR}/src/parser/ComponentAtomicGroup.cpp + ${LIBRARY_DIR}/src/parser/ComponentBackReference.cpp + ${LIBRARY_DIR}/src/parser/ComponentBoundary.cpp + ${LIBRARY_DIR}/src/parser/ComponentByte.cpp + ${LIBRARY_DIR}/src/parser/ComponentClass.cpp + ${LIBRARY_DIR}/src/parser/ComponentCondReference.cpp + ${LIBRARY_DIR}/src/parser/ComponentEmpty.cpp + ${LIBRARY_DIR}/src/parser/ComponentEUS.cpp + ${LIBRARY_DIR}/src/parser/ComponentRepeat.cpp + ${LIBRARY_DIR}/src/parser/ComponentSequence.cpp + ${LIBRARY_DIR}/src/parser/ComponentVisitor.cpp + ${LIBRARY_DIR}/src/parser/ComponentWordBoundary.cpp + ${LIBRARY_DIR}/src/parser/ConstComponentVisitor.cpp + ${LIBRARY_DIR}/src/parser/control_verbs.cpp + ${LIBRARY_DIR}/src/parser/logical_combination.cpp + ${LIBRARY_DIR}/src/parser/parse_error.cpp + ${LIBRARY_DIR}/src/parser/parser_util.cpp + ${LIBRARY_DIR}/src/parser/Parser.cpp + ${LIBRARY_DIR}/src/parser/prefilter.cpp + ${LIBRARY_DIR}/src/parser/shortcut_literal.cpp + ${LIBRARY_DIR}/src/parser/ucp_table.cpp + ${LIBRARY_DIR}/src/parser/unsupported.cpp + ${LIBRARY_DIR}/src/parser/utf8_validate.cpp + ${LIBRARY_DIR}/src/parser/Utf8ComponentClass.cpp + ${LIBRARY_DIR}/src/rose/block.c + ${LIBRARY_DIR}/src/rose/catchup.c + ${LIBRARY_DIR}/src/rose/init.c + ${LIBRARY_DIR}/src/rose/match.c + ${LIBRARY_DIR}/src/rose/program_runtime.c + ${LIBRARY_DIR}/src/rose/rose_build_add_mask.cpp + ${LIBRARY_DIR}/src/rose/rose_build_add.cpp + ${LIBRARY_DIR}/src/rose/rose_build_anchored.cpp + ${LIBRARY_DIR}/src/rose/rose_build_bytecode.cpp + ${LIBRARY_DIR}/src/rose/rose_build_castle.cpp + ${LIBRARY_DIR}/src/rose/rose_build_compile.cpp + ${LIBRARY_DIR}/src/rose/rose_build_convert.cpp + ${LIBRARY_DIR}/src/rose/rose_build_dedupe.cpp + ${LIBRARY_DIR}/src/rose/rose_build_engine_blob.cpp + ${LIBRARY_DIR}/src/rose/rose_build_exclusive.cpp + ${LIBRARY_DIR}/src/rose/rose_build_groups.cpp + ${LIBRARY_DIR}/src/rose/rose_build_infix.cpp + ${LIBRARY_DIR}/src/rose/rose_build_instructions.cpp + ${LIBRARY_DIR}/src/rose/rose_build_lit_accel.cpp + ${LIBRARY_DIR}/src/rose/rose_build_long_lit.cpp + ${LIBRARY_DIR}/src/rose/rose_build_lookaround.cpp + ${LIBRARY_DIR}/src/rose/rose_build_matchers.cpp + ${LIBRARY_DIR}/src/rose/rose_build_merge.cpp + ${LIBRARY_DIR}/src/rose/rose_build_misc.cpp + ${LIBRARY_DIR}/src/rose/rose_build_program.cpp + ${LIBRARY_DIR}/src/rose/rose_build_role_aliasing.cpp + ${LIBRARY_DIR}/src/rose/rose_build_scatter.cpp + ${LIBRARY_DIR}/src/rose/rose_build_width.cpp + ${LIBRARY_DIR}/src/rose/rose_in_util.cpp + ${LIBRARY_DIR}/src/rose/stream.c + ${LIBRARY_DIR}/src/runtime.c + ${LIBRARY_DIR}/src/scratch.c + ${LIBRARY_DIR}/src/smallwrite/smallwrite_build.cpp + ${LIBRARY_DIR}/src/som/slot_manager.cpp + ${LIBRARY_DIR}/src/som/som_runtime.c + ${LIBRARY_DIR}/src/som/som_stream.c + ${LIBRARY_DIR}/src/stream_compress.c + ${LIBRARY_DIR}/src/util/alloc.cpp + ${LIBRARY_DIR}/src/util/charreach.cpp + ${LIBRARY_DIR}/src/util/clique.cpp + ${LIBRARY_DIR}/src/util/compile_context.cpp + ${LIBRARY_DIR}/src/util/compile_error.cpp + ${LIBRARY_DIR}/src/util/cpuid_flags.c + ${LIBRARY_DIR}/src/util/depth.cpp + ${LIBRARY_DIR}/src/util/fatbit_build.cpp + ${LIBRARY_DIR}/src/util/multibit_build.cpp + ${LIBRARY_DIR}/src/util/multibit.c + ${LIBRARY_DIR}/src/util/report_manager.cpp + ${LIBRARY_DIR}/src/util/simd_utils.c + ${LIBRARY_DIR}/src/util/state_compress.c + ${LIBRARY_DIR}/src/util/target_info.cpp + ${LIBRARY_DIR}/src/util/ue2string.cpp + ) + + add_library (hyperscan ${SRCS}) + + target_compile_definitions (hyperscan PUBLIC USE_HYPERSCAN=1) + target_compile_options (hyperscan + PRIVATE -g0 # Library has too much debug information + -march=corei7 -O2 -fno-strict-aliasing -fno-omit-frame-pointer -fvisibility=hidden # The options from original build system + -fno-sanitize=undefined # Assume the library takes care of itself + ) + target_include_directories (hyperscan + PRIVATE + common + ${LIBRARY_DIR}/include + ) + target_include_directories (hyperscan SYSTEM PUBLIC ${LIBRARY_DIR}/src) + if (ARCH_AMD64) + target_include_directories (hyperscan PRIVATE x86_64) + endif () + target_link_libraries (hyperscan PRIVATE boost::headers_only) + + set (USE_INTERNAL_HYPERSCAN_LIBRARY 1) +endif () + +message (STATUS "Using hyperscan") diff --git a/contrib/jemalloc-cmake/CMakeLists.txt b/contrib/jemalloc-cmake/CMakeLists.txt index 13f7ea3326b..dd7f9f3e2bb 100644 --- a/contrib/jemalloc-cmake/CMakeLists.txt +++ b/contrib/jemalloc-cmake/CMakeLists.txt @@ -1,141 +1,43 @@ -option (ENABLE_JEMALLOC "Enable jemalloc allocator" ${ENABLE_LIBRARIES}) - if (SANITIZE OR NOT (ARCH_AMD64 OR ARCH_ARM) OR NOT (OS_LINUX OR OS_FREEBSD OR OS_DARWIN)) + if (ENABLE_JEMALLOC) + message (${RECONFIGURE_MESSAGE_LEVEL} + "jemalloc is disabled implicitly: it doesn't work with sanitizers and can only be used with x86_64 or aarch64 on linux or freebsd.") + endif() set (ENABLE_JEMALLOC OFF) - message (STATUS "jemalloc is disabled implicitly: it doesn't work with sanitizers and can only be used with x86_64 or aarch64 on linux or freebsd.") +else() + option (ENABLE_JEMALLOC "Enable jemalloc allocator" ${ENABLE_LIBRARIES}) endif () -if (ENABLE_JEMALLOC) - if (NOT OS_LINUX) - message (WARNING "jemalloc support on non-linux is EXPERIMENTAL") +if (NOT ENABLE_JEMALLOC) + if(USE_INTERNAL_JEMALLOC_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal jemalloc with ENABLE_JEMALLOC=OFF") endif() - option (USE_INTERNAL_JEMALLOC "Use internal jemalloc library" ${NOT_UNBUNDLED}) + add_library(jemalloc INTERFACE) + target_compile_definitions(jemalloc INTERFACE USE_JEMALLOC=0) - if (USE_INTERNAL_JEMALLOC) - if (OS_LINUX) - # ThreadPool select job randomly, and there can be some threads that had been - # performed some memory heavy task before and will be inactive for some time, - # but until it will became active again, the memory will not be freed since by - # default each thread has it's own arena, but there should be not more then - # 4*CPU arenas (see opt.nareans description). - # - # By enabling percpu_arena number of arenas limited to number of CPUs and hence - # this problem should go away. - # - # muzzy_decay_ms -- use MADV_FREE when available on newer Linuxes, to - # avoid spurious latencies and additional work associated with - # MADV_DONTNEED. See - # https://github.com/ClickHouse/ClickHouse/issues/11121 for motivation. - set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:10000") - else() - set (JEMALLOC_CONFIG_MALLOC_CONF "oversize_threshold:0,muzzy_decay_ms:10000") - endif() - # CACHE variable is empty, to allow changing defaults without necessity - # to purge cache - set (JEMALLOC_CONFIG_MALLOC_CONF_OVERRIDE "" CACHE STRING "Change default configuration string of JEMalloc" ) - if (JEMALLOC_CONFIG_MALLOC_CONF_OVERRIDE) - set (JEMALLOC_CONFIG_MALLOC_CONF "${JEMALLOC_CONFIG_MALLOC_CONF_OVERRIDE}") - endif() - message (STATUS "jemalloc malloc_conf: ${JEMALLOC_CONFIG_MALLOC_CONF}") + message (STATUS "Not using jemalloc") + return() +endif () - set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/jemalloc") +if (NOT OS_LINUX) + message (WARNING "jemalloc support on non-linux is EXPERIMENTAL") +endif() - set (SRCS - ${LIBRARY_DIR}/src/arena.c - ${LIBRARY_DIR}/src/background_thread.c - ${LIBRARY_DIR}/src/base.c - ${LIBRARY_DIR}/src/bin.c - ${LIBRARY_DIR}/src/bitmap.c - ${LIBRARY_DIR}/src/ckh.c - ${LIBRARY_DIR}/src/ctl.c - ${LIBRARY_DIR}/src/div.c - ${LIBRARY_DIR}/src/extent.c - ${LIBRARY_DIR}/src/extent_dss.c - ${LIBRARY_DIR}/src/extent_mmap.c - ${LIBRARY_DIR}/src/hash.c - ${LIBRARY_DIR}/src/hook.c - ${LIBRARY_DIR}/src/jemalloc.c - ${LIBRARY_DIR}/src/large.c - ${LIBRARY_DIR}/src/log.c - ${LIBRARY_DIR}/src/malloc_io.c - ${LIBRARY_DIR}/src/mutex.c - ${LIBRARY_DIR}/src/mutex_pool.c - ${LIBRARY_DIR}/src/nstime.c - ${LIBRARY_DIR}/src/pages.c - ${LIBRARY_DIR}/src/prng.c - ${LIBRARY_DIR}/src/prof.c - ${LIBRARY_DIR}/src/rtree.c - ${LIBRARY_DIR}/src/sc.c - ${LIBRARY_DIR}/src/stats.c - ${LIBRARY_DIR}/src/sz.c - ${LIBRARY_DIR}/src/tcache.c - ${LIBRARY_DIR}/src/test_hooks.c - ${LIBRARY_DIR}/src/ticker.c - ${LIBRARY_DIR}/src/tsd.c - ${LIBRARY_DIR}/src/witness.c - ${LIBRARY_DIR}/src/safety_check.c - ) - if (OS_DARWIN) - list(APPEND SRCS ${LIBRARY_DIR}/src/zone.c) - endif () +option (USE_INTERNAL_JEMALLOC_LIBRARY "Use internal jemalloc library" ${NOT_UNBUNDLED}) - add_library(jemalloc ${SRCS}) - target_include_directories(jemalloc PRIVATE ${LIBRARY_DIR}/include) - target_include_directories(jemalloc SYSTEM PUBLIC include) +if (NOT USE_INTERNAL_JEMALLOC_LIBRARY) + find_library(LIBRARY_JEMALLOC jemalloc) + find_path(INCLUDE_JEMALLOC jemalloc/jemalloc.h) - set (JEMALLOC_INCLUDE_PREFIX) - # OS_ - if (OS_LINUX) - set (JEMALLOC_INCLUDE_PREFIX "include_linux") - elseif (OS_FREEBSD) - set (JEMALLOC_INCLUDE_PREFIX "include_freebsd") - elseif (OS_DARWIN) - set (JEMALLOC_INCLUDE_PREFIX "include_darwin") - else () - message (FATAL_ERROR "This OS is not supported") - endif () - # ARCH_ - if (ARCH_AMD64) - set(JEMALLOC_INCLUDE_PREFIX "${JEMALLOC_INCLUDE_PREFIX}_x86_64") - elseif (ARCH_ARM) - set(JEMALLOC_INCLUDE_PREFIX "${JEMALLOC_INCLUDE_PREFIX}_aarch64") - else () - message (FATAL_ERROR "This arch is not supported") - endif () - - configure_file(${JEMALLOC_INCLUDE_PREFIX}/jemalloc/internal/jemalloc_internal_defs.h.in - ${JEMALLOC_INCLUDE_PREFIX}/jemalloc/internal/jemalloc_internal_defs.h) - target_include_directories(jemalloc SYSTEM PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/${JEMALLOC_INCLUDE_PREFIX}/jemalloc/internal) - - target_compile_definitions(jemalloc PRIVATE -DJEMALLOC_NO_PRIVATE_NAMESPACE) - - if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG") - target_compile_definitions(jemalloc PRIVATE -DJEMALLOC_DEBUG=1 -DJEMALLOC_PROF=1) - - if (USE_UNWIND) - target_compile_definitions (jemalloc PRIVATE -DJEMALLOC_PROF_LIBUNWIND=1) - target_link_libraries (jemalloc PRIVATE unwind) - endif () - endif () - - target_compile_options(jemalloc PRIVATE -Wno-redundant-decls) - # for RTLD_NEXT - target_compile_options(jemalloc PRIVATE -D_GNU_SOURCE) - else () - find_library(LIBRARY_JEMALLOC jemalloc) - find_path(INCLUDE_JEMALLOC jemalloc/jemalloc.h) + if (LIBRARY_JEMALLOC AND INCLUDE_JEMALLOC) + set(EXTERNAL_JEMALLOC_LIBRARY_FOUND 1) set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) + find_package(Threads) - add_library (jemalloc STATIC IMPORTED) - set_property (TARGET jemalloc PROPERTY IMPORTED_LOCATION ${LIBRARY_JEMALLOC}) - set_property (TARGET jemalloc PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_JEMALLOC}) - set_property (TARGET jemalloc PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads dl) - - set (CMAKE_REQUIRED_LIBRARIES jemalloc) + set (CMAKE_REQUIRED_LIBRARIES ${LIBRARY_JEMALLOC} Threads::Threads "dl") + set (CMAKE_REQUIRED_INCLUDES ${INCLUDE_JEMALLOC}) check_cxx_source_compiles ( " #include @@ -144,24 +46,145 @@ if (ENABLE_JEMALLOC) free(mallocx(1, 0)); } " - EXTERNAL_JEMALLOC_WORKS + EXTERNAL_JEMALLOC_LIBRARY_WORKS ) - if (NOT EXTERNAL_JEMALLOC_WORKS) - message (FATAL_ERROR "jemalloc is unusable: ${LIBRARY_JEMALLOC} ${INCLUDE_JEMALLOC}") + if (EXTERNAL_JEMALLOC_LIBRARY_WORKS) + add_library (jemalloc STATIC IMPORTED) + set_property (TARGET jemalloc PROPERTY IMPORTED_LOCATION ${LIBRARY_JEMALLOC}) + set_property (TARGET jemalloc PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_JEMALLOC}) + set_property (TARGET jemalloc PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads dl) + else() + message (${RECONFIGURE_MESSAGE_LEVEL} "External jemalloc is unusable: ${LIBRARY_JEMALLOC} ${INCLUDE_JEMALLOC}") + endif () + + else() + set(EXTERNAL_JEMALLOC_LIBRARY_FOUND 0) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system jemalloc") + endif() +endif () + +if (NOT EXTERNAL_JEMALLOC_LIBRARY_FOUND OR NOT EXTERNAL_JEMALLOC_LIBRARY_WORKS) + set(USE_INTERNAL_JEMALLOC_LIBRARY 1) + + if (OS_LINUX) + # ThreadPool select job randomly, and there can be some threads that had been + # performed some memory heavy task before and will be inactive for some time, + # but until it will became active again, the memory will not be freed since by + # default each thread has it's own arena, but there should be not more then + # 4*CPU arenas (see opt.nareans description). + # + # By enabling percpu_arena number of arenas limited to number of CPUs and hence + # this problem should go away. + # + # muzzy_decay_ms -- use MADV_FREE when available on newer Linuxes, to + # avoid spurious latencies and additional work associated with + # MADV_DONTNEED. See + # https://github.com/ClickHouse/ClickHouse/issues/11121 for motivation. + set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:10000") + else() + set (JEMALLOC_CONFIG_MALLOC_CONF "oversize_threshold:0,muzzy_decay_ms:10000") + endif() + # CACHE variable is empty, to allow changing defaults without necessity + # to purge cache + set (JEMALLOC_CONFIG_MALLOC_CONF_OVERRIDE "" CACHE STRING "Change default configuration string of JEMalloc" ) + if (JEMALLOC_CONFIG_MALLOC_CONF_OVERRIDE) + set (JEMALLOC_CONFIG_MALLOC_CONF "${JEMALLOC_CONFIG_MALLOC_CONF_OVERRIDE}") + endif() + message (STATUS "jemalloc malloc_conf: ${JEMALLOC_CONFIG_MALLOC_CONF}") + + set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/jemalloc") + + set (SRCS + ${LIBRARY_DIR}/src/arena.c + ${LIBRARY_DIR}/src/background_thread.c + ${LIBRARY_DIR}/src/base.c + ${LIBRARY_DIR}/src/bin.c + ${LIBRARY_DIR}/src/bitmap.c + ${LIBRARY_DIR}/src/ckh.c + ${LIBRARY_DIR}/src/ctl.c + ${LIBRARY_DIR}/src/div.c + ${LIBRARY_DIR}/src/extent.c + ${LIBRARY_DIR}/src/extent_dss.c + ${LIBRARY_DIR}/src/extent_mmap.c + ${LIBRARY_DIR}/src/hash.c + ${LIBRARY_DIR}/src/hook.c + ${LIBRARY_DIR}/src/jemalloc.c + ${LIBRARY_DIR}/src/large.c + ${LIBRARY_DIR}/src/log.c + ${LIBRARY_DIR}/src/malloc_io.c + ${LIBRARY_DIR}/src/mutex.c + ${LIBRARY_DIR}/src/mutex_pool.c + ${LIBRARY_DIR}/src/nstime.c + ${LIBRARY_DIR}/src/pages.c + ${LIBRARY_DIR}/src/prng.c + ${LIBRARY_DIR}/src/prof.c + ${LIBRARY_DIR}/src/rtree.c + ${LIBRARY_DIR}/src/sc.c + ${LIBRARY_DIR}/src/stats.c + ${LIBRARY_DIR}/src/sz.c + ${LIBRARY_DIR}/src/tcache.c + ${LIBRARY_DIR}/src/test_hooks.c + ${LIBRARY_DIR}/src/ticker.c + ${LIBRARY_DIR}/src/tsd.c + ${LIBRARY_DIR}/src/witness.c + ${LIBRARY_DIR}/src/safety_check.c + ) + if (OS_DARWIN) + list(APPEND SRCS ${LIBRARY_DIR}/src/zone.c) + endif () + + add_library(jemalloc ${SRCS}) + target_include_directories(jemalloc PRIVATE ${LIBRARY_DIR}/include) + target_include_directories(jemalloc SYSTEM PUBLIC include) + + set (JEMALLOC_INCLUDE_PREFIX) + # OS_ + if (OS_LINUX) + set (JEMALLOC_INCLUDE_PREFIX "include_linux") + elseif (OS_FREEBSD) + set (JEMALLOC_INCLUDE_PREFIX "include_freebsd") + elseif (OS_DARWIN) + set (JEMALLOC_INCLUDE_PREFIX "include_darwin") + else () + message (FATAL_ERROR "internal jemalloc: This OS is not supported") + endif () + # ARCH_ + if (ARCH_AMD64) + set(JEMALLOC_INCLUDE_PREFIX "${JEMALLOC_INCLUDE_PREFIX}_x86_64") + elseif (ARCH_ARM) + set(JEMALLOC_INCLUDE_PREFIX "${JEMALLOC_INCLUDE_PREFIX}_aarch64") + else () + message (FATAL_ERROR "internal jemalloc: This arch is not supported") + endif () + + configure_file(${JEMALLOC_INCLUDE_PREFIX}/jemalloc/internal/jemalloc_internal_defs.h.in + ${JEMALLOC_INCLUDE_PREFIX}/jemalloc/internal/jemalloc_internal_defs.h) + target_include_directories(jemalloc SYSTEM PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/${JEMALLOC_INCLUDE_PREFIX}/jemalloc/internal) + + target_compile_definitions(jemalloc PRIVATE -DJEMALLOC_NO_PRIVATE_NAMESPACE) + + if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG") + target_compile_definitions(jemalloc PRIVATE -DJEMALLOC_DEBUG=1 -DJEMALLOC_PROF=1) + + if (USE_UNWIND) + target_compile_definitions (jemalloc PRIVATE -DJEMALLOC_PROF_LIBUNWIND=1) + target_link_libraries (jemalloc PRIVATE unwind) endif () endif () - set_property(TARGET jemalloc APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USE_JEMALLOC=1) - if (MAKE_STATIC_LIBRARIES) - # To detect whether we need to register jemalloc for osx as default zone. - set_property(TARGET jemalloc APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BUNDLED_STATIC_JEMALLOC=1) - endif() + target_compile_options(jemalloc PRIVATE -Wno-redundant-decls) + # for RTLD_NEXT + target_compile_options(jemalloc PRIVATE -D_GNU_SOURCE) - message (STATUS "Using jemalloc") -else () - add_library(jemalloc INTERFACE) - target_compile_definitions(jemalloc INTERFACE USE_JEMALLOC=0) - - message (STATUS "Not using jemalloc") + set (USE_INTERNAL_JEMALLOC_LIBRARY 1) endif () + +set_property(TARGET jemalloc APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USE_JEMALLOC=1) +if (MAKE_STATIC_LIBRARIES) + # To detect whether we need to register jemalloc for osx as default zone. + set_property(TARGET jemalloc APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BUNDLED_STATIC_JEMALLOC=1) +endif() + +message (STATUS "Using jemalloc") diff --git a/contrib/libcpuid-cmake/CMakeLists.txt b/contrib/libcpuid-cmake/CMakeLists.txt index cb28cbd21da..8c1be50b4e6 100644 --- a/contrib/libcpuid-cmake/CMakeLists.txt +++ b/contrib/libcpuid-cmake/CMakeLists.txt @@ -1,35 +1,40 @@ -option (ENABLE_CPUID "Enable libcpuid library (only internal)" ${ENABLE_LIBRARIES}) +if (NOT ARCH_ARM) + option (ENABLE_CPUID "Enable libcpuid library (only internal)" ${ENABLE_LIBRARIES}) +endif() -if (ARCH_ARM) +if (ARCH_ARM AND ENABLE_CPUID) + message (${RECONFIGURE_MESSAGE_LEVEL} "cpuid is not supported on ARM") set (ENABLE_CPUID 0) endif () -if (ENABLE_CPUID) - set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/libcpuid) - - set (SRCS - ${LIBRARY_DIR}/libcpuid/asm-bits.c - ${LIBRARY_DIR}/libcpuid/cpuid_main.c - ${LIBRARY_DIR}/libcpuid/libcpuid_util.c - ${LIBRARY_DIR}/libcpuid/msrdriver.c - ${LIBRARY_DIR}/libcpuid/rdmsr.c - ${LIBRARY_DIR}/libcpuid/rdtsc.c - ${LIBRARY_DIR}/libcpuid/recog_amd.c - ${LIBRARY_DIR}/libcpuid/recog_intel.c - ) - - add_library (cpuid ${SRCS}) - - target_include_directories (cpuid SYSTEM PUBLIC ${LIBRARY_DIR}) - target_compile_definitions (cpuid PUBLIC USE_CPUID=1) - target_compile_definitions (cpuid PRIVATE VERSION="v0.4.1") - if (COMPILER_CLANG) - target_compile_options (cpuid PRIVATE -Wno-reserved-id-macro) - endif () - - message (STATUS "Using cpuid") -else () +if (NOT ENABLE_CPUID) add_library (cpuid INTERFACE) target_compile_definitions (cpuid INTERFACE USE_CPUID=0) + + return() +endif() + +set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/libcpuid") + +set (SRCS + "${LIBRARY_DIR}/libcpuid/asm-bits.c" + "${LIBRARY_DIR}/libcpuid/cpuid_main.c" + "${LIBRARY_DIR}/libcpuid/libcpuid_util.c" + "${LIBRARY_DIR}/libcpuid/msrdriver.c" + "${LIBRARY_DIR}/libcpuid/rdmsr.c" + "${LIBRARY_DIR}/libcpuid/rdtsc.c" + "${LIBRARY_DIR}/libcpuid/recog_amd.c" + "${LIBRARY_DIR}/libcpuid/recog_intel.c" +) + +add_library (cpuid ${SRCS}) + +target_include_directories (cpuid SYSTEM PUBLIC "${LIBRARY_DIR}") +target_compile_definitions (cpuid PUBLIC USE_CPUID=1) +target_compile_definitions (cpuid PRIVATE VERSION="v0.4.1") +if (COMPILER_CLANG) + target_compile_options (cpuid PRIVATE -Wno-reserved-id-macro) endif () + +message (STATUS "Using cpuid") diff --git a/contrib/libhdfs3-cmake/CMakeLists.txt b/contrib/libhdfs3-cmake/CMakeLists.txt index 4c71770f5b6..ab4857f0387 100644 --- a/contrib/libhdfs3-cmake/CMakeLists.txt +++ b/contrib/libhdfs3-cmake/CMakeLists.txt @@ -1,4 +1,14 @@ -if (NOT USE_INTERNAL_PROTOBUF_LIBRARY) +if (ENABLE_PROTOBUF AND NOT USE_INTERNAL_PROTOBUF_LIBRARY) + option(PROTOBUF_OLD_ABI_COMPAT "Set to ON for compatiability with external protobuf which was compiled old C++ ABI" OFF) +endif() + +if (PROTOBUF_OLD_ABI_COMPAT) + if (NOT ENABLE_PROTOBUF OR USE_INTERNAL_PROTOBUF_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "PROTOBUF_OLD_ABI_COMPAT option is ignored") + endif() +endif() + +if (NOT USE_INTERNAL_PROTOBUF_LIBRARY AND PROTOBUF_OLD_ABI_COMPAT) # compatiable with protobuf which was compiled old C++ ABI set(CMAKE_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0") set(CMAKE_C_FLAGS "") @@ -7,7 +17,7 @@ if (NOT USE_INTERNAL_PROTOBUF_LIBRARY) endif () endif() -SET(WITH_KERBEROS false) +set(WITH_KERBEROS false) # project and source dir set(HDFS3_ROOT_DIR ${ClickHouse_SOURCE_DIR}/contrib/libhdfs3) set(HDFS3_SOURCE_DIR ${HDFS3_ROOT_DIR}/src) @@ -206,7 +216,7 @@ target_link_libraries(hdfs3 PRIVATE ${LIBGSASL_LIBRARY}) if (WITH_KERBEROS) target_link_libraries(hdfs3 PRIVATE ${KERBEROS_LIBRARIES}) endif() -target_link_libraries(hdfs3 PRIVATE ${LIBXML2_LIBRARY}) +target_link_libraries(hdfs3 PRIVATE ${LIBXML2_LIBRARIES}) # inherit from parent cmake target_include_directories(hdfs3 PRIVATE ${Protobuf_INCLUDE_DIR}) diff --git a/contrib/librdkafka-cmake/CMakeLists.txt b/contrib/librdkafka-cmake/CMakeLists.txt index 4a67ebadba6..c8d8d2070b0 100644 --- a/contrib/librdkafka-cmake/CMakeLists.txt +++ b/contrib/librdkafka-cmake/CMakeLists.txt @@ -6,7 +6,7 @@ set(SRCS # ${RDKAFKA_SOURCE_DIR}/lz4.c # ${RDKAFKA_SOURCE_DIR}/lz4frame.c # ${RDKAFKA_SOURCE_DIR}/lz4hc.c -# ${RDKAFKA_SOURCE_DIR}/rdxxhash.c + ${RDKAFKA_SOURCE_DIR}/rdxxhash.c # ${RDKAFKA_SOURCE_DIR}/regexp.c ${RDKAFKA_SOURCE_DIR}/rdaddr.c ${RDKAFKA_SOURCE_DIR}/rdavl.c diff --git a/contrib/lz4-cmake/CMakeLists.txt b/contrib/lz4-cmake/CMakeLists.txt index b8121976213..374837fbe58 100644 --- a/contrib/lz4-cmake/CMakeLists.txt +++ b/contrib/lz4-cmake/CMakeLists.txt @@ -1,13 +1,30 @@ option (USE_INTERNAL_LZ4_LIBRARY "Use internal lz4 library" ${NOT_UNBUNDLED}) -if (USE_INTERNAL_LZ4_LIBRARY) - set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/lz4) +if (NOT USE_INTERNAL_LZ4_LIBRARY) + find_library (LIBRARY_LZ4 lz4) + find_path (INCLUDE_LZ4 lz4.h) + + if (LIBRARY_LZ4 AND INCLUDE_LZ4) + set(EXTERNAL_LZ4_LIBRARY_FOUND 1) + add_library (lz4 UNKNOWN IMPORTED) + set_property (TARGET lz4 PROPERTY IMPORTED_LOCATION ${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() + +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 + "${LIBRARY_DIR}/lib/lz4.c" + "${LIBRARY_DIR}/lib/lz4hc.c" + "${LIBRARY_DIR}/lib/lz4frame.c" + "${LIBRARY_DIR}/lib/xxhash.c" ) add_library (lz4 ${SRCS}) @@ -17,12 +34,4 @@ if (USE_INTERNAL_LZ4_LIBRARY) target_compile_options (lz4 PRIVATE -fno-sanitize=undefined) endif () target_include_directories(lz4 PUBLIC ${LIBRARY_DIR}/lib) -else () - find_library (LIBRARY_LZ4 lz4) - find_path (INCLUDE_LZ4 lz4.h) - - add_library (lz4 UNKNOWN IMPORTED) - set_property (TARGET lz4 PROPERTY IMPORTED_LOCATION ${LIBRARY_LZ4}) - set_property (TARGET lz4 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_LZ4}) - set_property (TARGET lz4 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USE_XXHASH=0) endif () diff --git a/contrib/poco b/contrib/poco index 74c93443342..297fc905e16 160000 --- a/contrib/poco +++ b/contrib/poco @@ -1 +1 @@ -Subproject commit 74c93443342f6028fa6402057684733b316aa737 +Subproject commit 297fc905e166392156f83b96aaa5f44e8a6a35c4 diff --git a/contrib/poco-cmake/CMakeLists.txt b/contrib/poco-cmake/CMakeLists.txt index 59b6c84a1d1..fff9051f40f 100644 --- a/contrib/poco-cmake/CMakeLists.txt +++ b/contrib/poco-cmake/CMakeLists.txt @@ -1,11 +1,3 @@ -option (USE_INTERNAL_POCO_LIBRARY "Use internal Poco library" ${NOT_UNBUNDLED}) - -if (USE_INTERNAL_POCO_LIBRARY) - set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/poco) -else () - find_path (ROOT_DIR NAMES Foundation/include/Poco/Poco.h include/Poco/Poco.h) -endif () - add_subdirectory (Crypto) add_subdirectory (Data) add_subdirectory (Data/ODBC) diff --git a/contrib/poco-cmake/Data/ODBC/CMakeLists.txt b/contrib/poco-cmake/Data/ODBC/CMakeLists.txt index b53b58b0d54..cd7c5ef2863 100644 --- a/contrib/poco-cmake/Data/ODBC/CMakeLists.txt +++ b/contrib/poco-cmake/Data/ODBC/CMakeLists.txt @@ -1,4 +1,8 @@ if (ENABLE_ODBC) + if (NOT TARGET unixodbc) + message(FATAL_ERROR "Configuration error: unixodbc is not a target") + endif() + if (USE_INTERNAL_POCO_LIBRARY) set (SRCS ${LIBRARY_DIR}/Data/ODBC/src/Binder.cpp diff --git a/contrib/poco-cmake/Foundation/CMakeLists.txt b/contrib/poco-cmake/Foundation/CMakeLists.txt index 740fe53db1b..f4647461ec0 100644 --- a/contrib/poco-cmake/Foundation/CMakeLists.txt +++ b/contrib/poco-cmake/Foundation/CMakeLists.txt @@ -222,7 +222,7 @@ 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 zlib) + target_link_libraries (_poco_foundation PRIVATE Poco::Foundation::PCRE ${ZLIB_LIBRARIES}) else () add_library (Poco::Foundation UNKNOWN IMPORTED GLOBAL) diff --git a/contrib/protobuf-cmake/CMakeLists.txt b/contrib/protobuf-cmake/CMakeLists.txt index 3cb9053d647..683429194fc 100644 --- a/contrib/protobuf-cmake/CMakeLists.txt +++ b/contrib/protobuf-cmake/CMakeLists.txt @@ -1,5 +1,5 @@ -set(protobuf_SOURCE_DIR ${ClickHouse_SOURCE_DIR}/contrib/protobuf) -set(protobuf_BINARY_DIR ${ClickHouse_BINARY_DIR}/contrib/protobuf) +set(protobuf_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/protobuf") +set(protobuf_BINARY_DIR "${ClickHouse_BINARY_DIR}/contrib/protobuf") set(protobuf_WITH_ZLIB 0 CACHE INTERNAL "" FORCE) # actually will use zlib, but skip find set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "" FORCE) @@ -10,4 +10,4 @@ else () set(protobuf_BUILD_SHARED_LIBS ON CACHE INTERNAL "" FORCE) endif () -add_subdirectory(${protobuf_SOURCE_DIR}/cmake ${protobuf_BINARY_DIR}) +add_subdirectory("${protobuf_SOURCE_DIR}/cmake" "${protobuf_BINARY_DIR}") diff --git a/contrib/replxx-cmake/CMakeLists.txt b/contrib/replxx-cmake/CMakeLists.txt index 48d7e8bb36b..2c0ad86e583 100644 --- a/contrib/replxx-cmake/CMakeLists.txt +++ b/contrib/replxx-cmake/CMakeLists.txt @@ -1,35 +1,26 @@ option (ENABLE_REPLXX "Enable replxx support" ${ENABLE_LIBRARIES}) -if (ENABLE_REPLXX) - option (USE_INTERNAL_REPLXX "Use internal replxx library" ${NOT_UNBUNDLED}) +if (NOT ENABLE_REPLXX) + if (USE_INTERNAL_REPLXX_LIBRARY) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal replxx with ENABLE_REPLXX=OFF") + endif() - if (USE_INTERNAL_REPLXX) - set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/replxx") + add_library(replxx INTERFACE) + target_compile_definitions(replxx INTERFACE USE_REPLXX=0) - set(SRCS - ${LIBRARY_DIR}/src/conversion.cxx - ${LIBRARY_DIR}/src/ConvertUTF.cpp - ${LIBRARY_DIR}/src/escape.cxx - ${LIBRARY_DIR}/src/history.cxx - ${LIBRARY_DIR}/src/io.cxx - ${LIBRARY_DIR}/src/prompt.cxx - ${LIBRARY_DIR}/src/replxx_impl.cxx - ${LIBRARY_DIR}/src/replxx.cxx - ${LIBRARY_DIR}/src/util.cxx - ${LIBRARY_DIR}/src/wcwidth.cpp - ) + message (STATUS "Not using replxx (Beware! Runtime fallback to readline is possible!)") + return() +endif() - add_library (replxx ${SRCS}) - target_include_directories(replxx SYSTEM PUBLIC ${LIBRARY_DIR}/include) - else () - find_library(LIBRARY_REPLXX NAMES replxx replxx-static) - find_path(INCLUDE_REPLXX replxx.hxx) +option (USE_INTERNAL_REPLXX_LIBRARY "Use internal replxx library (Experimental: set to OFF on your own risk)" ON) - add_library(replxx UNKNOWN IMPORTED) - set_property(TARGET replxx PROPERTY IMPORTED_LOCATION ${LIBRARY_REPLXX}) - target_include_directories(replxx SYSTEM PUBLIC ${INCLUDE_REPLXX}) +if (NOT USE_INTERNAL_REPLXX_LIBRARY) + find_library(LIBRARY_REPLXX NAMES replxx replxx-static) + find_path(INCLUDE_REPLXX replxx.hxx) - set(CMAKE_REQUIRED_LIBRARIES replxx) + if (LIBRARY_REPLXX AND INCLUDE_REPLXX) + set(CMAKE_REQUIRED_LIBRARIES ${LIBRARY_REPLXX}) + set(CMAKE_REQUIRED_INCLUDES ${INCLUDE_REPLXX}) check_cxx_source_compiles( " #include @@ -41,20 +32,43 @@ if (ENABLE_REPLXX) ) if (NOT EXTERNAL_REPLXX_WORKS) - message (FATAL_ERROR "replxx is unusable: ${LIBRARY_REPLXX} ${INCLUDE_REPLXX}") - endif () - endif () + message (${RECONFIGURE_MESSAGE_LEVEL} "replxx is unusable: ${LIBRARY_REPLXX} ${INCLUDE_REPLXX}") + else() + add_library(replxx UNKNOWN IMPORTED) + set_property(TARGET replxx PROPERTY IMPORTED_LOCATION ${LIBRARY_REPLXX}) + target_include_directories(replxx SYSTEM PUBLIC ${INCLUDE_REPLXX}) + endif() + else() + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system replxx") + endif() +endif() - if (COMPILER_CLANG) - target_compile_options(replxx PRIVATE -Wno-documentation) - endif () - target_compile_definitions(replxx PUBLIC USE_REPLXX=1) +if (NOT LIBRARY_REPLXX OR NOT INCLUDE_REPLXX OR NOT EXTERNAL_REPLXX_WORKS) + set(USE_INTERNAL_REPLXX_LIBRARY 1) + set (LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/replxx") - message (STATUS "Using replxx") -else () - add_library(replxx INTERFACE) - target_compile_definitions(replxx INTERFACE USE_REPLXX=0) + set(SRCS + "${LIBRARY_DIR}/src/conversion.cxx" + "${LIBRARY_DIR}/src/ConvertUTF.cpp" + "${LIBRARY_DIR}/src/escape.cxx" + "${LIBRARY_DIR}/src/history.cxx" + "${LIBRARY_DIR}/src/io.cxx" + "${LIBRARY_DIR}/src/prompt.cxx" + "${LIBRARY_DIR}/src/replxx_impl.cxx" + "${LIBRARY_DIR}/src/replxx.cxx" + "${LIBRARY_DIR}/src/util.cxx" + "${LIBRARY_DIR}/src/wcwidth.cpp" + ) - message (STATUS "Not using replxx (Beware! Runtime fallback to readline is possible!)") + add_library (replxx ${SRCS}) + target_include_directories(replxx SYSTEM PUBLIC ${LIBRARY_DIR}/include) endif () + +if (COMPILER_CLANG) + target_compile_options(replxx PRIVATE -Wno-documentation) +endif () + +target_compile_definitions(replxx PUBLIC USE_REPLXX=1) + +message (STATUS "Using replxx") diff --git a/contrib/unixodbc-cmake/CMakeLists.txt b/contrib/unixodbc-cmake/CMakeLists.txt index 658fa3329d3..c971c4bdd89 100644 --- a/contrib/unixodbc-cmake/CMakeLists.txt +++ b/contrib/unixodbc-cmake/CMakeLists.txt @@ -1,318 +1,295 @@ -option (ENABLE_ODBC "Enable ODBC library" ${ENABLE_LIBRARIES}) +if (NOT USE_INTERNAL_ODBC_LIBRARY) + return() +endif() -if (NOT OS_LINUX) - set (ENABLE_ODBC OFF CACHE INTERNAL "") -endif () +set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/unixodbc) -if (ENABLE_ODBC) - option (USE_INTERNAL_ODBC_LIBRARY "Use internal ODBC library" ${NOT_UNBUNDLED}) +# ltdl - if (USE_INTERNAL_ODBC_LIBRARY) - set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/unixodbc) +set (SRCS_LTDL + # This file is generated by 'libtool' inside libltdl directory and then removed. + linux_x86_64/libltdl/libltdlcS.c - # ltdl + ${LIBRARY_DIR}/libltdl/lt__alloc.c + ${LIBRARY_DIR}/libltdl/lt__strl.c + ${LIBRARY_DIR}/libltdl/ltdl.c + ${LIBRARY_DIR}/libltdl/lt_dlloader.c + ${LIBRARY_DIR}/libltdl/slist.c + ${LIBRARY_DIR}/libltdl/lt_error.c + ${LIBRARY_DIR}/libltdl/loaders/dlopen.c + ${LIBRARY_DIR}/libltdl/loaders/preopen.c +) - set (SRCS_LTDL - # This file is generated by 'libtool' inside libltdl directory and then removed. - linux_x86_64/libltdl/libltdlcS.c +add_library (ltdl ${SRCS_LTDL}) - ${LIBRARY_DIR}/libltdl/lt__alloc.c - ${LIBRARY_DIR}/libltdl/lt__strl.c - ${LIBRARY_DIR}/libltdl/ltdl.c - ${LIBRARY_DIR}/libltdl/lt_dlloader.c - ${LIBRARY_DIR}/libltdl/slist.c - ${LIBRARY_DIR}/libltdl/lt_error.c - ${LIBRARY_DIR}/libltdl/loaders/dlopen.c - ${LIBRARY_DIR}/libltdl/loaders/preopen.c - ) +target_include_directories(ltdl + PRIVATE + linux_x86_64/libltdl + PUBLIC + ${LIBRARY_DIR}/libltdl + ${LIBRARY_DIR}/libltdl/libltdl +) +target_compile_definitions(ltdl PRIVATE -DHAVE_CONFIG_H -DLTDL -DLTDLOPEN=libltdlc) +target_compile_options(ltdl PRIVATE -Wno-constant-logical-operand -Wno-unknown-warning-option -O2) - add_library (ltdl ${SRCS_LTDL}) +# odbc - target_include_directories(ltdl - PRIVATE - linux_x86_64/libltdl - PUBLIC - ${LIBRARY_DIR}/libltdl - ${LIBRARY_DIR}/libltdl/libltdl - ) - target_compile_definitions(ltdl PRIVATE -DHAVE_CONFIG_H -DLTDL -DLTDLOPEN=libltdlc) - target_compile_options(ltdl PRIVATE -Wno-constant-logical-operand -Wno-unknown-warning-option -O2) +set (SRCS + ${LIBRARY_DIR}/DriverManager/__attribute.c + ${LIBRARY_DIR}/DriverManager/__connection.c + ${LIBRARY_DIR}/DriverManager/__handles.c + ${LIBRARY_DIR}/DriverManager/__info.c + ${LIBRARY_DIR}/DriverManager/__stats.c + ${LIBRARY_DIR}/DriverManager/SQLAllocConnect.c + ${LIBRARY_DIR}/DriverManager/SQLAllocEnv.c + ${LIBRARY_DIR}/DriverManager/SQLAllocHandle.c + ${LIBRARY_DIR}/DriverManager/SQLAllocHandleStd.c + ${LIBRARY_DIR}/DriverManager/SQLAllocStmt.c + ${LIBRARY_DIR}/DriverManager/SQLBindCol.c + ${LIBRARY_DIR}/DriverManager/SQLBindParam.c + ${LIBRARY_DIR}/DriverManager/SQLBindParameter.c + ${LIBRARY_DIR}/DriverManager/SQLBrowseConnect.c + ${LIBRARY_DIR}/DriverManager/SQLBrowseConnectW.c + ${LIBRARY_DIR}/DriverManager/SQLBulkOperations.c + ${LIBRARY_DIR}/DriverManager/SQLCancel.c + ${LIBRARY_DIR}/DriverManager/SQLCancelHandle.c + ${LIBRARY_DIR}/DriverManager/SQLCloseCursor.c + ${LIBRARY_DIR}/DriverManager/SQLColAttribute.c + ${LIBRARY_DIR}/DriverManager/SQLColAttributes.c + ${LIBRARY_DIR}/DriverManager/SQLColAttributesW.c + ${LIBRARY_DIR}/DriverManager/SQLColAttributeW.c + ${LIBRARY_DIR}/DriverManager/SQLColumnPrivileges.c + ${LIBRARY_DIR}/DriverManager/SQLColumnPrivilegesW.c + ${LIBRARY_DIR}/DriverManager/SQLColumns.c + ${LIBRARY_DIR}/DriverManager/SQLColumnsW.c + ${LIBRARY_DIR}/DriverManager/SQLConnect.c + ${LIBRARY_DIR}/DriverManager/SQLConnectW.c + ${LIBRARY_DIR}/DriverManager/SQLCopyDesc.c + ${LIBRARY_DIR}/DriverManager/SQLDataSources.c + ${LIBRARY_DIR}/DriverManager/SQLDataSourcesW.c + ${LIBRARY_DIR}/DriverManager/SQLDescribeCol.c + ${LIBRARY_DIR}/DriverManager/SQLDescribeColW.c + ${LIBRARY_DIR}/DriverManager/SQLDescribeParam.c + ${LIBRARY_DIR}/DriverManager/SQLDisconnect.c + ${LIBRARY_DIR}/DriverManager/SQLDriverConnect.c + ${LIBRARY_DIR}/DriverManager/SQLDriverConnectW.c + ${LIBRARY_DIR}/DriverManager/SQLDrivers.c + ${LIBRARY_DIR}/DriverManager/SQLDriversW.c + ${LIBRARY_DIR}/DriverManager/SQLEndTran.c + ${LIBRARY_DIR}/DriverManager/SQLError.c + ${LIBRARY_DIR}/DriverManager/SQLErrorW.c + ${LIBRARY_DIR}/DriverManager/SQLExecDirect.c + ${LIBRARY_DIR}/DriverManager/SQLExecDirectW.c + ${LIBRARY_DIR}/DriverManager/SQLExecute.c + ${LIBRARY_DIR}/DriverManager/SQLExtendedFetch.c + ${LIBRARY_DIR}/DriverManager/SQLFetch.c + ${LIBRARY_DIR}/DriverManager/SQLFetchScroll.c + ${LIBRARY_DIR}/DriverManager/SQLForeignKeys.c + ${LIBRARY_DIR}/DriverManager/SQLForeignKeysW.c + ${LIBRARY_DIR}/DriverManager/SQLFreeConnect.c + ${LIBRARY_DIR}/DriverManager/SQLFreeEnv.c + ${LIBRARY_DIR}/DriverManager/SQLFreeHandle.c + ${LIBRARY_DIR}/DriverManager/SQLFreeStmt.c + ${LIBRARY_DIR}/DriverManager/SQLGetConnectAttr.c + ${LIBRARY_DIR}/DriverManager/SQLGetConnectAttrW.c + ${LIBRARY_DIR}/DriverManager/SQLGetConnectOption.c + ${LIBRARY_DIR}/DriverManager/SQLGetConnectOptionW.c + ${LIBRARY_DIR}/DriverManager/SQLGetCursorName.c + ${LIBRARY_DIR}/DriverManager/SQLGetCursorNameW.c + ${LIBRARY_DIR}/DriverManager/SQLGetData.c + ${LIBRARY_DIR}/DriverManager/SQLGetDescField.c + ${LIBRARY_DIR}/DriverManager/SQLGetDescFieldW.c + ${LIBRARY_DIR}/DriverManager/SQLGetDescRec.c + ${LIBRARY_DIR}/DriverManager/SQLGetDescRecW.c + ${LIBRARY_DIR}/DriverManager/SQLGetDiagField.c + ${LIBRARY_DIR}/DriverManager/SQLGetDiagFieldW.c + ${LIBRARY_DIR}/DriverManager/SQLGetDiagRec.c + ${LIBRARY_DIR}/DriverManager/SQLGetDiagRecW.c + ${LIBRARY_DIR}/DriverManager/SQLGetEnvAttr.c + ${LIBRARY_DIR}/DriverManager/SQLGetFunctions.c + ${LIBRARY_DIR}/DriverManager/SQLGetInfo.c + ${LIBRARY_DIR}/DriverManager/SQLGetInfoW.c + ${LIBRARY_DIR}/DriverManager/SQLGetStmtAttr.c + ${LIBRARY_DIR}/DriverManager/SQLGetStmtAttrW.c + ${LIBRARY_DIR}/DriverManager/SQLGetStmtOption.c + ${LIBRARY_DIR}/DriverManager/SQLGetTypeInfo.c + ${LIBRARY_DIR}/DriverManager/SQLGetTypeInfoW.c + ${LIBRARY_DIR}/DriverManager/SQLMoreResults.c + ${LIBRARY_DIR}/DriverManager/SQLNativeSql.c + ${LIBRARY_DIR}/DriverManager/SQLNativeSqlW.c + ${LIBRARY_DIR}/DriverManager/SQLNumParams.c + ${LIBRARY_DIR}/DriverManager/SQLNumResultCols.c + ${LIBRARY_DIR}/DriverManager/SQLParamData.c + ${LIBRARY_DIR}/DriverManager/SQLParamOptions.c + ${LIBRARY_DIR}/DriverManager/SQLPrepare.c + ${LIBRARY_DIR}/DriverManager/SQLPrepareW.c + ${LIBRARY_DIR}/DriverManager/SQLPrimaryKeys.c + ${LIBRARY_DIR}/DriverManager/SQLPrimaryKeysW.c + ${LIBRARY_DIR}/DriverManager/SQLProcedureColumns.c + ${LIBRARY_DIR}/DriverManager/SQLProcedureColumnsW.c + ${LIBRARY_DIR}/DriverManager/SQLProcedures.c + ${LIBRARY_DIR}/DriverManager/SQLProceduresW.c + ${LIBRARY_DIR}/DriverManager/SQLPutData.c + ${LIBRARY_DIR}/DriverManager/SQLRowCount.c + ${LIBRARY_DIR}/DriverManager/SQLSetConnectAttr.c + ${LIBRARY_DIR}/DriverManager/SQLSetConnectAttrW.c + ${LIBRARY_DIR}/DriverManager/SQLSetConnectOption.c + ${LIBRARY_DIR}/DriverManager/SQLSetConnectOptionW.c + ${LIBRARY_DIR}/DriverManager/SQLSetCursorName.c + ${LIBRARY_DIR}/DriverManager/SQLSetCursorNameW.c + ${LIBRARY_DIR}/DriverManager/SQLSetDescField.c + ${LIBRARY_DIR}/DriverManager/SQLSetDescFieldW.c + ${LIBRARY_DIR}/DriverManager/SQLSetDescRec.c + ${LIBRARY_DIR}/DriverManager/SQLSetEnvAttr.c + ${LIBRARY_DIR}/DriverManager/SQLSetParam.c + ${LIBRARY_DIR}/DriverManager/SQLSetPos.c + ${LIBRARY_DIR}/DriverManager/SQLSetScrollOptions.c + ${LIBRARY_DIR}/DriverManager/SQLSetStmtAttr.c + ${LIBRARY_DIR}/DriverManager/SQLSetStmtAttrW.c + ${LIBRARY_DIR}/DriverManager/SQLSetStmtOption.c + ${LIBRARY_DIR}/DriverManager/SQLSetStmtOptionW.c + ${LIBRARY_DIR}/DriverManager/SQLSpecialColumns.c + ${LIBRARY_DIR}/DriverManager/SQLSpecialColumnsW.c + ${LIBRARY_DIR}/DriverManager/SQLStatistics.c + ${LIBRARY_DIR}/DriverManager/SQLStatisticsW.c + ${LIBRARY_DIR}/DriverManager/SQLTablePrivileges.c + ${LIBRARY_DIR}/DriverManager/SQLTablePrivilegesW.c + ${LIBRARY_DIR}/DriverManager/SQLTables.c + ${LIBRARY_DIR}/DriverManager/SQLTablesW.c + ${LIBRARY_DIR}/DriverManager/SQLTransact.c + ${LIBRARY_DIR}/ini/_iniDump.c + ${LIBRARY_DIR}/ini/_iniObjectRead.c + ${LIBRARY_DIR}/ini/_iniPropertyRead.c + ${LIBRARY_DIR}/ini/_iniScanUntilObject.c + ${LIBRARY_DIR}/ini/iniAllTrim.c + ${LIBRARY_DIR}/ini/iniAppend.c + ${LIBRARY_DIR}/ini/iniClose.c + ${LIBRARY_DIR}/ini/iniCommit.c + ${LIBRARY_DIR}/ini/iniCursor.c + ${LIBRARY_DIR}/ini/iniDelete.c + ${LIBRARY_DIR}/ini/iniElement.c + ${LIBRARY_DIR}/ini/iniElementCount.c + ${LIBRARY_DIR}/ini/iniGetBookmark.c + ${LIBRARY_DIR}/ini/iniGotoBookmark.c + ${LIBRARY_DIR}/ini/iniObject.c + ${LIBRARY_DIR}/ini/iniObjectDelete.c + ${LIBRARY_DIR}/ini/iniObjectEOL.c + ${LIBRARY_DIR}/ini/iniObjectFirst.c + ${LIBRARY_DIR}/ini/iniObjectInsert.c + ${LIBRARY_DIR}/ini/iniObjectLast.c + ${LIBRARY_DIR}/ini/iniObjectNext.c + ${LIBRARY_DIR}/ini/iniObjectSeek.c + ${LIBRARY_DIR}/ini/iniObjectSeekSure.c + ${LIBRARY_DIR}/ini/iniObjectUpdate.c + ${LIBRARY_DIR}/ini/iniOpen.c + ${LIBRARY_DIR}/ini/iniProperty.c + ${LIBRARY_DIR}/ini/iniPropertyDelete.c + ${LIBRARY_DIR}/ini/iniPropertyEOL.c + ${LIBRARY_DIR}/ini/iniPropertyFirst.c + ${LIBRARY_DIR}/ini/iniPropertyInsert.c + ${LIBRARY_DIR}/ini/iniPropertyLast.c + ${LIBRARY_DIR}/ini/iniPropertyNext.c + ${LIBRARY_DIR}/ini/iniPropertySeek.c + ${LIBRARY_DIR}/ini/iniPropertySeekSure.c + ${LIBRARY_DIR}/ini/iniPropertyUpdate.c + ${LIBRARY_DIR}/ini/iniPropertyValue.c + ${LIBRARY_DIR}/ini/iniToUpper.c + ${LIBRARY_DIR}/ini/iniValue.c + ${LIBRARY_DIR}/log/_logFreeMsg.c + ${LIBRARY_DIR}/log/logClear.c + ${LIBRARY_DIR}/log/logClose.c + ${LIBRARY_DIR}/log/logOn.c + ${LIBRARY_DIR}/log/logOpen.c + ${LIBRARY_DIR}/log/logPeekMsg.c + ${LIBRARY_DIR}/log/logPopMsg.c + ${LIBRARY_DIR}/log/logPushMsg.c + ${LIBRARY_DIR}/lst/_lstAdjustCurrent.c + ${LIBRARY_DIR}/lst/_lstDump.c + ${LIBRARY_DIR}/lst/_lstFreeItem.c + ${LIBRARY_DIR}/lst/_lstNextValidItem.c + ${LIBRARY_DIR}/lst/_lstPrevValidItem.c + ${LIBRARY_DIR}/lst/_lstVisible.c + ${LIBRARY_DIR}/lst/lstAppend.c + ${LIBRARY_DIR}/lst/lstClose.c + ${LIBRARY_DIR}/lst/lstDelete.c + ${LIBRARY_DIR}/lst/lstEOL.c + ${LIBRARY_DIR}/lst/lstFirst.c + ${LIBRARY_DIR}/lst/lstGet.c + ${LIBRARY_DIR}/lst/lstGetBookMark.c + ${LIBRARY_DIR}/lst/lstGoto.c + ${LIBRARY_DIR}/lst/lstGotoBookMark.c + ${LIBRARY_DIR}/lst/lstInsert.c + ${LIBRARY_DIR}/lst/lstLast.c + ${LIBRARY_DIR}/lst/lstNext.c + ${LIBRARY_DIR}/lst/lstOpen.c + ${LIBRARY_DIR}/lst/lstOpenCursor.c + ${LIBRARY_DIR}/lst/lstPrev.c + ${LIBRARY_DIR}/lst/lstSeek.c + ${LIBRARY_DIR}/lst/lstSeekItem.c + ${LIBRARY_DIR}/lst/lstSet.c + ${LIBRARY_DIR}/lst/lstSetFreeFunc.c + ${LIBRARY_DIR}/odbcinst/_logging.c + ${LIBRARY_DIR}/odbcinst/_odbcinst_ConfigModeINI.c + ${LIBRARY_DIR}/odbcinst/_odbcinst_GetEntries.c + ${LIBRARY_DIR}/odbcinst/_odbcinst_GetSections.c + ${LIBRARY_DIR}/odbcinst/_odbcinst_SystemINI.c + ${LIBRARY_DIR}/odbcinst/_odbcinst_UserINI.c + ${LIBRARY_DIR}/odbcinst/_SQLDriverConnectPrompt.c + ${LIBRARY_DIR}/odbcinst/_SQLGetInstalledDrivers.c + ${LIBRARY_DIR}/odbcinst/_SQLWriteInstalledDrivers.c + ${LIBRARY_DIR}/odbcinst/ODBCINSTConstructProperties.c + ${LIBRARY_DIR}/odbcinst/ODBCINSTDestructProperties.c + ${LIBRARY_DIR}/odbcinst/ODBCINSTSetProperty.c + ${LIBRARY_DIR}/odbcinst/ODBCINSTValidateProperties.c + ${LIBRARY_DIR}/odbcinst/ODBCINSTValidateProperty.c + ${LIBRARY_DIR}/odbcinst/SQLConfigDataSource.c + ${LIBRARY_DIR}/odbcinst/SQLConfigDriver.c + ${LIBRARY_DIR}/odbcinst/SQLCreateDataSource.c + ${LIBRARY_DIR}/odbcinst/SQLGetAvailableDrivers.c + ${LIBRARY_DIR}/odbcinst/SQLGetConfigMode.c + ${LIBRARY_DIR}/odbcinst/SQLGetInstalledDrivers.c + ${LIBRARY_DIR}/odbcinst/SQLGetPrivateProfileString.c + ${LIBRARY_DIR}/odbcinst/SQLGetTranslator.c + ${LIBRARY_DIR}/odbcinst/SQLInstallDriverEx.c + ${LIBRARY_DIR}/odbcinst/SQLInstallDriverManager.c + ${LIBRARY_DIR}/odbcinst/SQLInstallerError.c + ${LIBRARY_DIR}/odbcinst/SQLInstallODBC.c + ${LIBRARY_DIR}/odbcinst/SQLInstallTranslatorEx.c + ${LIBRARY_DIR}/odbcinst/SQLManageDataSources.c + ${LIBRARY_DIR}/odbcinst/SQLPostInstallerError.c + ${LIBRARY_DIR}/odbcinst/SQLReadFileDSN.c + ${LIBRARY_DIR}/odbcinst/SQLRemoveDriver.c + ${LIBRARY_DIR}/odbcinst/SQLRemoveDriverManager.c + ${LIBRARY_DIR}/odbcinst/SQLRemoveDSNFromIni.c + ${LIBRARY_DIR}/odbcinst/SQLRemoveTranslator.c + ${LIBRARY_DIR}/odbcinst/SQLSetConfigMode.c + ${LIBRARY_DIR}/odbcinst/SQLValidDSN.c + ${LIBRARY_DIR}/odbcinst/SQLWriteDSNToIni.c + ${LIBRARY_DIR}/odbcinst/SQLWriteFileDSN.c + ${LIBRARY_DIR}/odbcinst/SQLWritePrivateProfileString.c +) - # odbc +add_library (unixodbc ${SRCS}) - set (SRCS - ${LIBRARY_DIR}/DriverManager/__attribute.c - ${LIBRARY_DIR}/DriverManager/__connection.c - ${LIBRARY_DIR}/DriverManager/__handles.c - ${LIBRARY_DIR}/DriverManager/__info.c - ${LIBRARY_DIR}/DriverManager/__stats.c - ${LIBRARY_DIR}/DriverManager/SQLAllocConnect.c - ${LIBRARY_DIR}/DriverManager/SQLAllocEnv.c - ${LIBRARY_DIR}/DriverManager/SQLAllocHandle.c - ${LIBRARY_DIR}/DriverManager/SQLAllocHandleStd.c - ${LIBRARY_DIR}/DriverManager/SQLAllocStmt.c - ${LIBRARY_DIR}/DriverManager/SQLBindCol.c - ${LIBRARY_DIR}/DriverManager/SQLBindParam.c - ${LIBRARY_DIR}/DriverManager/SQLBindParameter.c - ${LIBRARY_DIR}/DriverManager/SQLBrowseConnect.c - ${LIBRARY_DIR}/DriverManager/SQLBrowseConnectW.c - ${LIBRARY_DIR}/DriverManager/SQLBulkOperations.c - ${LIBRARY_DIR}/DriverManager/SQLCancel.c - ${LIBRARY_DIR}/DriverManager/SQLCancelHandle.c - ${LIBRARY_DIR}/DriverManager/SQLCloseCursor.c - ${LIBRARY_DIR}/DriverManager/SQLColAttribute.c - ${LIBRARY_DIR}/DriverManager/SQLColAttributes.c - ${LIBRARY_DIR}/DriverManager/SQLColAttributesW.c - ${LIBRARY_DIR}/DriverManager/SQLColAttributeW.c - ${LIBRARY_DIR}/DriverManager/SQLColumnPrivileges.c - ${LIBRARY_DIR}/DriverManager/SQLColumnPrivilegesW.c - ${LIBRARY_DIR}/DriverManager/SQLColumns.c - ${LIBRARY_DIR}/DriverManager/SQLColumnsW.c - ${LIBRARY_DIR}/DriverManager/SQLConnect.c - ${LIBRARY_DIR}/DriverManager/SQLConnectW.c - ${LIBRARY_DIR}/DriverManager/SQLCopyDesc.c - ${LIBRARY_DIR}/DriverManager/SQLDataSources.c - ${LIBRARY_DIR}/DriverManager/SQLDataSourcesW.c - ${LIBRARY_DIR}/DriverManager/SQLDescribeCol.c - ${LIBRARY_DIR}/DriverManager/SQLDescribeColW.c - ${LIBRARY_DIR}/DriverManager/SQLDescribeParam.c - ${LIBRARY_DIR}/DriverManager/SQLDisconnect.c - ${LIBRARY_DIR}/DriverManager/SQLDriverConnect.c - ${LIBRARY_DIR}/DriverManager/SQLDriverConnectW.c - ${LIBRARY_DIR}/DriverManager/SQLDrivers.c - ${LIBRARY_DIR}/DriverManager/SQLDriversW.c - ${LIBRARY_DIR}/DriverManager/SQLEndTran.c - ${LIBRARY_DIR}/DriverManager/SQLError.c - ${LIBRARY_DIR}/DriverManager/SQLErrorW.c - ${LIBRARY_DIR}/DriverManager/SQLExecDirect.c - ${LIBRARY_DIR}/DriverManager/SQLExecDirectW.c - ${LIBRARY_DIR}/DriverManager/SQLExecute.c - ${LIBRARY_DIR}/DriverManager/SQLExtendedFetch.c - ${LIBRARY_DIR}/DriverManager/SQLFetch.c - ${LIBRARY_DIR}/DriverManager/SQLFetchScroll.c - ${LIBRARY_DIR}/DriverManager/SQLForeignKeys.c - ${LIBRARY_DIR}/DriverManager/SQLForeignKeysW.c - ${LIBRARY_DIR}/DriverManager/SQLFreeConnect.c - ${LIBRARY_DIR}/DriverManager/SQLFreeEnv.c - ${LIBRARY_DIR}/DriverManager/SQLFreeHandle.c - ${LIBRARY_DIR}/DriverManager/SQLFreeStmt.c - ${LIBRARY_DIR}/DriverManager/SQLGetConnectAttr.c - ${LIBRARY_DIR}/DriverManager/SQLGetConnectAttrW.c - ${LIBRARY_DIR}/DriverManager/SQLGetConnectOption.c - ${LIBRARY_DIR}/DriverManager/SQLGetConnectOptionW.c - ${LIBRARY_DIR}/DriverManager/SQLGetCursorName.c - ${LIBRARY_DIR}/DriverManager/SQLGetCursorNameW.c - ${LIBRARY_DIR}/DriverManager/SQLGetData.c - ${LIBRARY_DIR}/DriverManager/SQLGetDescField.c - ${LIBRARY_DIR}/DriverManager/SQLGetDescFieldW.c - ${LIBRARY_DIR}/DriverManager/SQLGetDescRec.c - ${LIBRARY_DIR}/DriverManager/SQLGetDescRecW.c - ${LIBRARY_DIR}/DriverManager/SQLGetDiagField.c - ${LIBRARY_DIR}/DriverManager/SQLGetDiagFieldW.c - ${LIBRARY_DIR}/DriverManager/SQLGetDiagRec.c - ${LIBRARY_DIR}/DriverManager/SQLGetDiagRecW.c - ${LIBRARY_DIR}/DriverManager/SQLGetEnvAttr.c - ${LIBRARY_DIR}/DriverManager/SQLGetFunctions.c - ${LIBRARY_DIR}/DriverManager/SQLGetInfo.c - ${LIBRARY_DIR}/DriverManager/SQLGetInfoW.c - ${LIBRARY_DIR}/DriverManager/SQLGetStmtAttr.c - ${LIBRARY_DIR}/DriverManager/SQLGetStmtAttrW.c - ${LIBRARY_DIR}/DriverManager/SQLGetStmtOption.c - ${LIBRARY_DIR}/DriverManager/SQLGetTypeInfo.c - ${LIBRARY_DIR}/DriverManager/SQLGetTypeInfoW.c - ${LIBRARY_DIR}/DriverManager/SQLMoreResults.c - ${LIBRARY_DIR}/DriverManager/SQLNativeSql.c - ${LIBRARY_DIR}/DriverManager/SQLNativeSqlW.c - ${LIBRARY_DIR}/DriverManager/SQLNumParams.c - ${LIBRARY_DIR}/DriverManager/SQLNumResultCols.c - ${LIBRARY_DIR}/DriverManager/SQLParamData.c - ${LIBRARY_DIR}/DriverManager/SQLParamOptions.c - ${LIBRARY_DIR}/DriverManager/SQLPrepare.c - ${LIBRARY_DIR}/DriverManager/SQLPrepareW.c - ${LIBRARY_DIR}/DriverManager/SQLPrimaryKeys.c - ${LIBRARY_DIR}/DriverManager/SQLPrimaryKeysW.c - ${LIBRARY_DIR}/DriverManager/SQLProcedureColumns.c - ${LIBRARY_DIR}/DriverManager/SQLProcedureColumnsW.c - ${LIBRARY_DIR}/DriverManager/SQLProcedures.c - ${LIBRARY_DIR}/DriverManager/SQLProceduresW.c - ${LIBRARY_DIR}/DriverManager/SQLPutData.c - ${LIBRARY_DIR}/DriverManager/SQLRowCount.c - ${LIBRARY_DIR}/DriverManager/SQLSetConnectAttr.c - ${LIBRARY_DIR}/DriverManager/SQLSetConnectAttrW.c - ${LIBRARY_DIR}/DriverManager/SQLSetConnectOption.c - ${LIBRARY_DIR}/DriverManager/SQLSetConnectOptionW.c - ${LIBRARY_DIR}/DriverManager/SQLSetCursorName.c - ${LIBRARY_DIR}/DriverManager/SQLSetCursorNameW.c - ${LIBRARY_DIR}/DriverManager/SQLSetDescField.c - ${LIBRARY_DIR}/DriverManager/SQLSetDescFieldW.c - ${LIBRARY_DIR}/DriverManager/SQLSetDescRec.c - ${LIBRARY_DIR}/DriverManager/SQLSetEnvAttr.c - ${LIBRARY_DIR}/DriverManager/SQLSetParam.c - ${LIBRARY_DIR}/DriverManager/SQLSetPos.c - ${LIBRARY_DIR}/DriverManager/SQLSetScrollOptions.c - ${LIBRARY_DIR}/DriverManager/SQLSetStmtAttr.c - ${LIBRARY_DIR}/DriverManager/SQLSetStmtAttrW.c - ${LIBRARY_DIR}/DriverManager/SQLSetStmtOption.c - ${LIBRARY_DIR}/DriverManager/SQLSetStmtOptionW.c - ${LIBRARY_DIR}/DriverManager/SQLSpecialColumns.c - ${LIBRARY_DIR}/DriverManager/SQLSpecialColumnsW.c - ${LIBRARY_DIR}/DriverManager/SQLStatistics.c - ${LIBRARY_DIR}/DriverManager/SQLStatisticsW.c - ${LIBRARY_DIR}/DriverManager/SQLTablePrivileges.c - ${LIBRARY_DIR}/DriverManager/SQLTablePrivilegesW.c - ${LIBRARY_DIR}/DriverManager/SQLTables.c - ${LIBRARY_DIR}/DriverManager/SQLTablesW.c - ${LIBRARY_DIR}/DriverManager/SQLTransact.c - ${LIBRARY_DIR}/ini/_iniDump.c - ${LIBRARY_DIR}/ini/_iniObjectRead.c - ${LIBRARY_DIR}/ini/_iniPropertyRead.c - ${LIBRARY_DIR}/ini/_iniScanUntilObject.c - ${LIBRARY_DIR}/ini/iniAllTrim.c - ${LIBRARY_DIR}/ini/iniAppend.c - ${LIBRARY_DIR}/ini/iniClose.c - ${LIBRARY_DIR}/ini/iniCommit.c - ${LIBRARY_DIR}/ini/iniCursor.c - ${LIBRARY_DIR}/ini/iniDelete.c - ${LIBRARY_DIR}/ini/iniElement.c - ${LIBRARY_DIR}/ini/iniElementCount.c - ${LIBRARY_DIR}/ini/iniGetBookmark.c - ${LIBRARY_DIR}/ini/iniGotoBookmark.c - ${LIBRARY_DIR}/ini/iniObject.c - ${LIBRARY_DIR}/ini/iniObjectDelete.c - ${LIBRARY_DIR}/ini/iniObjectEOL.c - ${LIBRARY_DIR}/ini/iniObjectFirst.c - ${LIBRARY_DIR}/ini/iniObjectInsert.c - ${LIBRARY_DIR}/ini/iniObjectLast.c - ${LIBRARY_DIR}/ini/iniObjectNext.c - ${LIBRARY_DIR}/ini/iniObjectSeek.c - ${LIBRARY_DIR}/ini/iniObjectSeekSure.c - ${LIBRARY_DIR}/ini/iniObjectUpdate.c - ${LIBRARY_DIR}/ini/iniOpen.c - ${LIBRARY_DIR}/ini/iniProperty.c - ${LIBRARY_DIR}/ini/iniPropertyDelete.c - ${LIBRARY_DIR}/ini/iniPropertyEOL.c - ${LIBRARY_DIR}/ini/iniPropertyFirst.c - ${LIBRARY_DIR}/ini/iniPropertyInsert.c - ${LIBRARY_DIR}/ini/iniPropertyLast.c - ${LIBRARY_DIR}/ini/iniPropertyNext.c - ${LIBRARY_DIR}/ini/iniPropertySeek.c - ${LIBRARY_DIR}/ini/iniPropertySeekSure.c - ${LIBRARY_DIR}/ini/iniPropertyUpdate.c - ${LIBRARY_DIR}/ini/iniPropertyValue.c - ${LIBRARY_DIR}/ini/iniToUpper.c - ${LIBRARY_DIR}/ini/iniValue.c - ${LIBRARY_DIR}/log/_logFreeMsg.c - ${LIBRARY_DIR}/log/logClear.c - ${LIBRARY_DIR}/log/logClose.c - ${LIBRARY_DIR}/log/logOn.c - ${LIBRARY_DIR}/log/logOpen.c - ${LIBRARY_DIR}/log/logPeekMsg.c - ${LIBRARY_DIR}/log/logPopMsg.c - ${LIBRARY_DIR}/log/logPushMsg.c - ${LIBRARY_DIR}/lst/_lstAdjustCurrent.c - ${LIBRARY_DIR}/lst/_lstDump.c - ${LIBRARY_DIR}/lst/_lstFreeItem.c - ${LIBRARY_DIR}/lst/_lstNextValidItem.c - ${LIBRARY_DIR}/lst/_lstPrevValidItem.c - ${LIBRARY_DIR}/lst/_lstVisible.c - ${LIBRARY_DIR}/lst/lstAppend.c - ${LIBRARY_DIR}/lst/lstClose.c - ${LIBRARY_DIR}/lst/lstDelete.c - ${LIBRARY_DIR}/lst/lstEOL.c - ${LIBRARY_DIR}/lst/lstFirst.c - ${LIBRARY_DIR}/lst/lstGet.c - ${LIBRARY_DIR}/lst/lstGetBookMark.c - ${LIBRARY_DIR}/lst/lstGoto.c - ${LIBRARY_DIR}/lst/lstGotoBookMark.c - ${LIBRARY_DIR}/lst/lstInsert.c - ${LIBRARY_DIR}/lst/lstLast.c - ${LIBRARY_DIR}/lst/lstNext.c - ${LIBRARY_DIR}/lst/lstOpen.c - ${LIBRARY_DIR}/lst/lstOpenCursor.c - ${LIBRARY_DIR}/lst/lstPrev.c - ${LIBRARY_DIR}/lst/lstSeek.c - ${LIBRARY_DIR}/lst/lstSeekItem.c - ${LIBRARY_DIR}/lst/lstSet.c - ${LIBRARY_DIR}/lst/lstSetFreeFunc.c - ${LIBRARY_DIR}/odbcinst/_logging.c - ${LIBRARY_DIR}/odbcinst/_odbcinst_ConfigModeINI.c - ${LIBRARY_DIR}/odbcinst/_odbcinst_GetEntries.c - ${LIBRARY_DIR}/odbcinst/_odbcinst_GetSections.c - ${LIBRARY_DIR}/odbcinst/_odbcinst_SystemINI.c - ${LIBRARY_DIR}/odbcinst/_odbcinst_UserINI.c - ${LIBRARY_DIR}/odbcinst/_SQLDriverConnectPrompt.c - ${LIBRARY_DIR}/odbcinst/_SQLGetInstalledDrivers.c - ${LIBRARY_DIR}/odbcinst/_SQLWriteInstalledDrivers.c - ${LIBRARY_DIR}/odbcinst/ODBCINSTConstructProperties.c - ${LIBRARY_DIR}/odbcinst/ODBCINSTDestructProperties.c - ${LIBRARY_DIR}/odbcinst/ODBCINSTSetProperty.c - ${LIBRARY_DIR}/odbcinst/ODBCINSTValidateProperties.c - ${LIBRARY_DIR}/odbcinst/ODBCINSTValidateProperty.c - ${LIBRARY_DIR}/odbcinst/SQLConfigDataSource.c - ${LIBRARY_DIR}/odbcinst/SQLConfigDriver.c - ${LIBRARY_DIR}/odbcinst/SQLCreateDataSource.c - ${LIBRARY_DIR}/odbcinst/SQLGetAvailableDrivers.c - ${LIBRARY_DIR}/odbcinst/SQLGetConfigMode.c - ${LIBRARY_DIR}/odbcinst/SQLGetInstalledDrivers.c - ${LIBRARY_DIR}/odbcinst/SQLGetPrivateProfileString.c - ${LIBRARY_DIR}/odbcinst/SQLGetTranslator.c - ${LIBRARY_DIR}/odbcinst/SQLInstallDriverEx.c - ${LIBRARY_DIR}/odbcinst/SQLInstallDriverManager.c - ${LIBRARY_DIR}/odbcinst/SQLInstallerError.c - ${LIBRARY_DIR}/odbcinst/SQLInstallODBC.c - ${LIBRARY_DIR}/odbcinst/SQLInstallTranslatorEx.c - ${LIBRARY_DIR}/odbcinst/SQLManageDataSources.c - ${LIBRARY_DIR}/odbcinst/SQLPostInstallerError.c - ${LIBRARY_DIR}/odbcinst/SQLReadFileDSN.c - ${LIBRARY_DIR}/odbcinst/SQLRemoveDriver.c - ${LIBRARY_DIR}/odbcinst/SQLRemoveDriverManager.c - ${LIBRARY_DIR}/odbcinst/SQLRemoveDSNFromIni.c - ${LIBRARY_DIR}/odbcinst/SQLRemoveTranslator.c - ${LIBRARY_DIR}/odbcinst/SQLSetConfigMode.c - ${LIBRARY_DIR}/odbcinst/SQLValidDSN.c - ${LIBRARY_DIR}/odbcinst/SQLWriteDSNToIni.c - ${LIBRARY_DIR}/odbcinst/SQLWriteFileDSN.c - ${LIBRARY_DIR}/odbcinst/SQLWritePrivateProfileString.c - ) +target_link_libraries (unixodbc PRIVATE ltdl) - add_library (unixodbc ${SRCS}) +# SYSTEM_FILE_PATH was changed to /etc - target_link_libraries (unixodbc PRIVATE ltdl) - - # SYSTEM_FILE_PATH was changed to /etc - - target_include_directories (unixodbc - PRIVATE - linux_x86_64/private - PUBLIC - linux_x86_64 - ${LIBRARY_DIR}/include - ) - target_compile_definitions (unixodbc PRIVATE -DHAVE_CONFIG_H) - target_compile_options (unixodbc - PRIVATE - -Wno-dangling-else - -Wno-parentheses - -Wno-misleading-indentation - -Wno-unknown-warning-option - -Wno-reserved-id-macro - -O2 - ) - else () - add_library (unixodbc UNKNOWN IMPORTED) - - find_library (LIBRARY_ODBC unixodbc) - find_path (INCLUDE_ODBC sql.h) - set_target_properties (unixodbc PROPERTIES IMPORTED_LOCATION ${LIBRARY_ODBC}) - set_target_properties (unixodbc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_ODBC}) - endif () - - target_compile_definitions (unixodbc INTERFACE USE_ODBC=1) - - message (STATUS "Using unixodbc") -else () - add_library (unixodbc INTERFACE) - target_compile_definitions (unixodbc INTERFACE USE_ODBC=0) - - message (STATUS "Not using unixodbc") -endif () +target_include_directories (unixodbc + PRIVATE + linux_x86_64/private + PUBLIC + linux_x86_64 + ${LIBRARY_DIR}/include +) +target_compile_definitions (unixodbc PRIVATE -DHAVE_CONFIG_H) +target_compile_options (unixodbc + PRIVATE + -Wno-dangling-else + -Wno-parentheses + -Wno-misleading-indentation + -Wno-unknown-warning-option + -Wno-reserved-id-macro + -O2 +) +target_compile_definitions (unixodbc INTERFACE USE_ODBC=1) diff --git a/contrib/zlib-ng b/contrib/zlib-ng index bba56a73be2..6fd1846c8b8 160000 --- a/contrib/zlib-ng +++ b/contrib/zlib-ng @@ -1 +1 @@ -Subproject commit bba56a73be249514acfbc7d49aa2a68994dad8ab +Subproject commit 6fd1846c8b8f59436fe2dd752d0f316ddbb64df6 diff --git a/debian/changelog b/debian/changelog index c82a3c6657b..c7c20ccd6d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,5 @@ -clickhouse (20.8.1.1) unstable; urgency=low +clickhouse (20.9.1.1) unstable; urgency=low * Modified source code - -- clickhouse-release Fri, 07 Aug 2020 21:45:46 +0300 + -- clickhouse-release Mon, 31 Aug 2020 23:07:38 +0300 diff --git a/debian/clickhouse-server.init b/debian/clickhouse-server.init index 3c5b6edc05d..b82c70bd6e0 100755 --- a/debian/clickhouse-server.init +++ b/debian/clickhouse-server.init @@ -76,7 +76,7 @@ is_supported_command() is_running() { - [ -r "$CLICKHOUSE_PIDFILE" ] && pgrep -s $(cat "$CLICKHOUSE_PIDFILE") 1> /dev/null 2> /dev/null + pgrep --pidfile "$CLICKHOUSE_PIDFILE" $(echo "${PROGRAM}" | cut -c1-15) 1> /dev/null 2> /dev/null } diff --git a/docker/builder/Dockerfile b/docker/builder/Dockerfile index 53a591ca4da..b7dadc3ec6d 100644 --- a/docker/builder/Dockerfile +++ b/docker/builder/Dockerfile @@ -1,33 +1,41 @@ FROM ubuntu:19.10 -RUN apt-get --allow-unauthenticated update -y && apt-get install --yes wget gnupg -RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -RUN echo "deb [trusted=yes] http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main" >> /etc/apt/sources.list +ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=10 -RUN apt-get update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get install --yes --no-install-recommends \ - bash \ - ccache \ - cmake \ - curl \ - expect \ - g++ \ - gcc \ - ninja-build \ - perl \ - pkg-config \ - python \ - python-lxml \ - python-requests \ - python-termcolor \ - sudo \ - tzdata \ - llvm-10 \ - clang-10 \ - clang-tidy-10 \ - lld-10 \ - lldb-10 +RUN apt-get update \ + && apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \ + --yes --no-install-recommends --verbose-versions \ + && export LLVM_PUBKEY_HASH="bda960a8da687a275a2078d43c111d66b1c6a893a3275271beedf266c1ff4a0cdecb429c7a5cccf9f486ea7aa43fd27f" \ + && wget -O /tmp/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key \ + && echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \ + && apt-key add /tmp/llvm-snapshot.gpg.key \ + && export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \ + && echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \ + /etc/apt/sources.list + +RUN apt-get update \ + && apt-get install \ + bash \ + ccache \ + cmake \ + curl \ + expect \ + g++ \ + gcc \ + ninja-build \ + perl \ + pkg-config \ + python \ + python-lxml \ + python-requests \ + python-termcolor \ + tzdata \ + llvm-${LLVM_VERSION} \ + clang-${LLVM_VERSION} \ + clang-tidy-${LLVM_VERSION} \ + lld-${LLVM_VERSION} \ + lldb-${LLVM_VERSION} \ + --yes --no-install-recommends COPY build.sh / diff --git a/docker/client/Dockerfile b/docker/client/Dockerfile index fa7e3816959..36ca0ee107a 100644 --- a/docker/client/Dockerfile +++ b/docker/client/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:18.04 ARG repository="deb https://repo.clickhouse.tech/deb/stable/ main/" -ARG version=20.8.1.* +ARG version=20.9.1.* RUN apt-get update \ && apt-get install --yes --no-install-recommends \ diff --git a/docker/images.json b/docker/images.json index c2e903e182d..8c2cb35b004 100644 --- a/docker/images.json +++ b/docker/images.json @@ -2,10 +2,7 @@ "docker/packager/deb": { "name": "yandex/clickhouse-deb-builder", "dependent": [ - "docker/test/stateless", - "docker/test/stateless_with_coverage", - "docker/test/stateless_pytest", - "docker/test/coverage" + "docker/packager/unbundled" ] }, "docker/packager/binary": { @@ -15,6 +12,10 @@ "docker/test/pvs" ] }, + "docker/packager/unbundled": { + "name": "yandex/clickhouse-unbundled-builder", + "dependent": [] + }, "docker/test/coverage": { "name": "yandex/clickhouse-coverage", "dependent": [] @@ -39,6 +40,10 @@ "name": "yandex/clickhouse-performance-comparison", "dependent": [] }, + "docker/test/pvs": { + "name": "yandex/clickhouse-pvs-test", + "dependent": [] + }, "docker/test/stateful": { "name": "yandex/clickhouse-stateful-test", "dependent": [ @@ -130,6 +135,21 @@ }, "docker/test/base": { "name": "yandex/clickhouse-test-base", + "dependent": [ + "docker/test/stateless", + "docker/test/stateless_with_coverage", + "docker/test/stateless_pytest", + "docker/test/coverage" + ] + }, + "docker/packager/unbundled": { + "name": "yandex/clickhouse-unbundled-builder", + "dependent": [ + "docker/test/stateless_unbundled" + ] + }, + "docker/test/stateless_unbundled": { + "name": "yandex/clickhouse-stateless-unbundled-test", "dependent": [ ] } diff --git a/docker/packager/binary/Dockerfile b/docker/packager/binary/Dockerfile index 8bdc7e116e5..b8650b945e1 100644 --- a/docker/packager/binary/Dockerfile +++ b/docker/packager/binary/Dockerfile @@ -1,62 +1,69 @@ # docker build -t yandex/clickhouse-binary-builder . FROM ubuntu:19.10 -RUN apt-get --allow-unauthenticated update -y && apt-get install --yes wget gnupg -RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -RUN echo "deb [trusted=yes] http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main" >> /etc/apt/sources.list +ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=10 -RUN apt-get --allow-unauthenticated update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get --allow-unauthenticated install --yes --no-install-recommends \ - bash \ - fakeroot \ - ccache \ - curl \ - software-properties-common \ - gnupg \ - apt-transport-https \ - ca-certificates +RUN apt-get update \ + && apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \ + --yes --no-install-recommends --verbose-versions \ + && export LLVM_PUBKEY_HASH="bda960a8da687a275a2078d43c111d66b1c6a893a3275271beedf266c1ff4a0cdecb429c7a5cccf9f486ea7aa43fd27f" \ + && wget -O /tmp/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key \ + && echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \ + && apt-key add /tmp/llvm-snapshot.gpg.key \ + && export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \ + && echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \ + /etc/apt/sources.list -RUN apt-get update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get install --yes --no-install-recommends \ - bash \ - cmake \ - ccache \ - curl \ - gcc-9 \ - g++-9 \ - llvm-10 \ - clang-10 \ - lld-10 \ - clang-tidy-10 \ - clang-9 \ - lld-9 \ - clang-tidy-9 \ - clang-8 \ - lld-8 \ - clang-tidy-8 \ - libicu-dev \ - libreadline-dev \ - ninja-build \ - gperf \ - git \ - opencl-headers \ - ocl-icd-libopencl1 \ - intel-opencl-icd \ - tzdata \ - gperf \ - cmake \ - gdb \ - rename \ - wget \ - build-essential +# initial packages +RUN apt-get update \ + && apt-get install \ + bash \ + fakeroot \ + ccache \ + curl \ + software-properties-common \ + --yes --no-install-recommends + +RUN apt-get update \ + && apt-get install \ + bash \ + cmake \ + ccache \ + curl \ + gcc-9 \ + g++-9 \ + llvm-${LLVM_VERSION} \ + clang-${LLVM_VERSION} \ + lld-${LLVM_VERSION} \ + clang-tidy-${LLVM_VERSION} \ + clang-9 \ + lld-9 \ + clang-tidy-9 \ + clang-8 \ + lld-8 \ + clang-tidy-8 \ + libicu-dev \ + libreadline-dev \ + ninja-build \ + gperf \ + git \ + opencl-headers \ + ocl-icd-libopencl1 \ + intel-opencl-icd \ + tzdata \ + gperf \ + cmake \ + gdb \ + rename \ + wget \ + build-essential \ + --yes --no-install-recommends # This symlink required by gcc to find lld compiler -RUN ln -s /usr/bin/lld-10 /usr/bin/ld.lld +RUN ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/ld.lld -ENV CC=clang-10 -ENV CXX=clang++-10 +ENV CC=clang-${LLVM_VERSION} +ENV CXX=clang++-${LLVM_VERSION} # libtapi is required to support .tbh format from recent MacOS SDKs RUN git clone https://github.com/tpoechtrager/apple-libtapi.git \ diff --git a/docker/packager/binary/build.sh b/docker/packager/binary/build.sh index 07b67d0db9a..72adba5d762 100755 --- a/docker/packager/binary/build.sh +++ b/docker/packager/binary/build.sh @@ -2,9 +2,6 @@ set -x -e -# Update tzdata to the latest version. It is embedded into clickhouse binary. -sudo apt-get update && sudo apt-get install tzdata - mkdir -p build/cmake/toolchain/darwin-x86_64 tar xJf MacOSX10.14.sdk.tar.xz -C build/cmake/toolchain/darwin-x86_64 --strip-components=1 diff --git a/docker/packager/deb/Dockerfile b/docker/packager/deb/Dockerfile index c1260b5c7ff..6d0fdca2310 100644 --- a/docker/packager/deb/Dockerfile +++ b/docker/packager/deb/Dockerfile @@ -1,96 +1,82 @@ # docker build -t yandex/clickhouse-deb-builder . -FROM ubuntu:19.10 +FROM ubuntu:20.04 -RUN apt-get --allow-unauthenticated update -y && apt-get install --yes wget gnupg -RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -RUN echo "deb [trusted=yes] http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main" >> /etc/apt/sources.list +ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=10 + +RUN apt-get update \ + && apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \ + --yes --no-install-recommends --verbose-versions \ + && export LLVM_PUBKEY_HASH="bda960a8da687a275a2078d43c111d66b1c6a893a3275271beedf266c1ff4a0cdecb429c7a5cccf9f486ea7aa43fd27f" \ + && wget -O /tmp/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key \ + && echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \ + && apt-key add /tmp/llvm-snapshot.gpg.key \ + && export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \ + && echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-11 main" >> \ + /etc/apt/sources.list # initial packages -RUN apt-get --allow-unauthenticated update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get --allow-unauthenticated install --yes --no-install-recommends \ - bash \ - fakeroot \ - ccache \ - curl \ - software-properties-common \ - gnupg \ - apt-transport-https \ - ca-certificates +RUN apt-get update \ + && apt-get install \ + bash \ + fakeroot \ + ccache \ + curl \ + software-properties-common \ + --yes --no-install-recommends # Special dpkg-deb (https://github.com/ClickHouse-Extras/dpkg) version which is able # to compress files using pigz (https://zlib.net/pigz/) instead of gzip. # Significantly increase deb packaging speed and compatible with old systems -RUN curl -O https://clickhouse-builds.s3.yandex.net/utils/1/dpkg-deb -RUN chmod +x dpkg-deb -RUN cp dpkg-deb /usr/bin +RUN curl -O https://clickhouse-builds.s3.yandex.net/utils/1/dpkg-deb \ + && chmod +x dpkg-deb \ + && cp dpkg-deb /usr/bin + +ENV APACHE_PUBKEY_HASH="bba6987b63c63f710fd4ed476121c588bc3812e99659d27a855f8c4d312783ee66ad6adfce238765691b04d62fa3688f" + +RUN export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \ + && wget -O /tmp/arrow-keyring.deb "https://apache.bintray.com/arrow/ubuntu/apache-arrow-archive-keyring-latest-${CODENAME}.deb" \ + && echo "${APACHE_PUBKEY_HASH} /tmp/arrow-keyring.deb" | sha384sum -c \ + && dpkg -i /tmp/arrow-keyring.deb -# Libraries from OS are only needed to test the "unbundled" build (that is not used in production). -RUN apt-get --allow-unauthenticated update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get --allow-unauthenticated install --yes --no-install-recommends \ - gcc-9 \ - g++-9 \ - llvm-10 \ - clang-10 \ - lld-10 \ - clang-tidy-10 \ - clang-9 \ - lld-9 \ - clang-tidy-9 \ - libicu-dev \ - libreadline-dev \ - gperf \ - ninja-build \ - perl \ - pkg-config \ - devscripts \ - debhelper \ - git \ - libc++-dev \ - libc++abi-dev \ - libboost-program-options-dev \ - libboost-system-dev \ - libboost-filesystem-dev \ - libboost-thread-dev \ - libboost-iostreams-dev \ - libboost-regex-dev \ - zlib1g-dev \ - liblz4-dev \ - libdouble-conversion-dev \ - librdkafka-dev \ - libpoconetssl62 \ - libpoco-dev \ - libgoogle-perftools-dev \ - libzstd-dev \ - libltdl-dev \ - libre2-dev \ - libjemalloc-dev \ - libmsgpack-dev \ - libcurl4-openssl-dev \ - opencl-headers \ - ocl-icd-libopencl1 \ - intel-opencl-icd \ - unixodbc-dev \ - odbcinst \ - tzdata \ - gperf \ - alien \ - libcapnp-dev \ - cmake \ - gdb \ - pigz \ - moreutils \ - libcctz-dev \ - libldap2-dev \ - libsasl2-dev \ - heimdal-multidev \ - libhyperscan-dev - +# Libraries from OS are only needed to test the "unbundled" build (this is not used in production). +RUN apt-get update \ + && apt-get install \ + gcc-10 \ + g++-10 \ + gcc-9 \ + g++-9 \ + clang-11 \ + clang-tidy-11 \ + lld-11 \ + llvm-11 \ + llvm-11-dev \ + clang-${LLVM_VERSION} \ + clang-tidy-${LLVM_VERSION} \ + lld-${LLVM_VERSION} \ + llvm-${LLVM_VERSION} \ + llvm-${LLVM_VERSION}-dev \ + llvm-9-dev \ + lld-9 \ + clang-9 \ + clang-tidy-9 \ + ninja-build \ + perl \ + pkg-config \ + devscripts \ + debhelper \ + git \ + tzdata \ + gperf \ + alien \ + cmake \ + gdb \ + moreutils \ + pigz \ + --yes --no-install-recommends # This symlink required by gcc to find lld compiler -RUN ln -s /usr/bin/lld-10 /usr/bin/ld.lld +RUN ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/ld.lld COPY build.sh / diff --git a/docker/packager/deb/build.sh b/docker/packager/deb/build.sh index 8b26bbb19cb..fbaa0151c6b 100755 --- a/docker/packager/deb/build.sh +++ b/docker/packager/deb/build.sh @@ -2,9 +2,6 @@ set -x -e -# Update tzdata to the latest version. It is embedded into clickhouse binary. -sudo apt-get update && sudo apt-get install tzdata - ccache --show-stats ||: ccache --zero-stats ||: build/release --no-pbuilder $ALIEN_PKGS | ts '%Y-%m-%d %H:%M:%S' diff --git a/docker/packager/packager b/docker/packager/packager index bc97429336c..5874bedd17a 100755 --- a/docker/packager/packager +++ b/docker/packager/packager @@ -11,6 +11,7 @@ SCRIPT_PATH = os.path.realpath(__file__) IMAGE_MAP = { "deb": "yandex/clickhouse-deb-builder", "binary": "yandex/clickhouse-binary-builder", + "unbundled": "yandex/clickhouse-unbundled-builder" } def check_image_exists_locally(image_name): @@ -142,7 +143,7 @@ def parse_env_variables(build_type, compiler, sanitizer, package_type, image_typ if unbundled: # TODO: fix build with ENABLE_RDKAFKA - cmake_flags.append('-DUNBUNDLED=1 -DENABLE_MYSQL=0 -DENABLE_ODBC=0 -DENABLE_REPLXX=0 -DENABLE_RDKAFKA=0') + cmake_flags.append('-DUNBUNDLED=1 -DUSE_INTERNAL_RDKAFKA_LIBRARY=1 -DENABLE_ARROW=0 -DENABLE_ORC=0 -DENABLE_PARQUET=0') if split_binary: cmake_flags.append('-DUSE_STATIC_LIBRARIES=0 -DSPLIT_SHARED_LIBRARIES=1 -DCLICKHOUSE_SPLIT_BINARY=1') @@ -176,7 +177,9 @@ if __name__ == "__main__": parser.add_argument("--clickhouse-repo-path", default=os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir)) parser.add_argument("--output-dir", required=True) parser.add_argument("--build-type", choices=("debug", ""), default="") - parser.add_argument("--compiler", choices=("clang-10-darwin", "clang-10-aarch64", "clang-10-freebsd", "gcc-9", "clang-10"), default="gcc-9") + parser.add_argument("--compiler", choices=("clang-10", "clang-10-darwin", "clang-10-aarch64", "clang-10-freebsd", + "clang-11", "clang-11-darwin", "clang-11-aarch64", "clang-11-freebsd", + "gcc-9", "gcc-10"), default="gcc-9") parser.add_argument("--sanitizer", choices=("address", "thread", "memory", "undefined", ""), default="") parser.add_argument("--unbundled", action="store_true") parser.add_argument("--split-binary", action="store_true") @@ -197,7 +200,7 @@ if __name__ == "__main__": if not os.path.isabs(args.output_dir): args.output_dir = os.path.abspath(os.path.join(os.getcwd(), args.output_dir)) - image_type = 'binary' if args.package_type == 'performance' else args.package_type + image_type = 'binary' if args.package_type == 'performance' else 'unbundled' if args.unbundled else args.package_type image_name = IMAGE_MAP[image_type] if not os.path.isabs(args.clickhouse_repo_path): diff --git a/docker/packager/unbundled/Dockerfile b/docker/packager/unbundled/Dockerfile new file mode 100644 index 00000000000..4e2b6e3f2db --- /dev/null +++ b/docker/packager/unbundled/Dockerfile @@ -0,0 +1,67 @@ +# docker build -t yandex/clickhouse-unbundled-builder . +FROM yandex/clickhouse-deb-builder + +# Libraries from OS are only needed to test the "unbundled" build (that is not used in production). +RUN apt-get update \ + && apt-get install \ + libicu-dev \ + gperf \ + perl \ + pkg-config \ + devscripts \ + libc++-dev \ + libc++abi-dev \ + libboost-program-options-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libboost-thread-dev \ + libboost-iostreams-dev \ + libboost-regex-dev \ + zlib1g-dev \ + liblz4-dev \ + libdouble-conversion-dev \ + libxml2-dev \ + librdkafka-dev \ + libgoogle-perftools-dev \ + libzstd-dev \ + libltdl-dev \ + libre2-dev \ + libjemalloc-dev \ + libmsgpack-dev \ + libcurl4-openssl-dev \ + opencl-headers \ + ocl-icd-libopencl1 \ + intel-opencl-icd \ + unixodbc-dev \ + odbcinst \ + tzdata \ + alien \ + libcapnp-dev \ + cmake \ + gdb \ + pigz \ + moreutils \ + libcctz-dev \ + libldap2-dev \ + libsasl2-dev \ + libgsasl7-dev \ + heimdal-multidev \ + libhyperscan-dev \ + libbrotli-dev \ + protobuf-compiler \ + libprotoc-dev \ + libgrpc++-dev \ + rapidjson-dev \ + libsnappy-dev \ + libparquet-dev \ + libthrift-dev \ + libutf8proc-dev \ + libbz2-dev \ + libavro-dev \ + libfarmhash-dev \ + libmysqlclient-dev \ + --yes --no-install-recommends + +COPY build.sh / + +CMD ["/bin/bash", "/build.sh"] diff --git a/docker/packager/unbundled/build.sh b/docker/packager/unbundled/build.sh new file mode 100755 index 00000000000..ca1217ac522 --- /dev/null +++ b/docker/packager/unbundled/build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -x -e + +ccache --show-stats ||: +ccache --zero-stats ||: +build/release --no-pbuilder $ALIEN_PKGS | ts '%Y-%m-%d %H:%M:%S' +mv /*.deb /output +mv *.changes /output +mv *.buildinfo /output +mv /*.rpm /output ||: # if exists +mv /*.tgz /output ||: # if exists + +ccache --show-stats ||: +ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1.0.0 /usr/lib/libOpenCL.so ||: diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile index 1ba00bf299d..c3950c58437 100644 --- a/docker/server/Dockerfile +++ b/docker/server/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:20.04 ARG repository="deb https://repo.clickhouse.tech/deb/stable/ main/" -ARG version=20.8.1.* +ARG version=20.9.1.* ARG gosu_ver=1.10 RUN apt-get update \ diff --git a/docker/test/Dockerfile b/docker/test/Dockerfile index c9144230da9..bb09fa1de56 100644 --- a/docker/test/Dockerfile +++ b/docker/test/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:18.04 ARG repository="deb https://repo.clickhouse.tech/deb/stable/ main/" -ARG version=20.8.1.* +ARG version=20.9.1.* RUN apt-get update && \ apt-get install -y apt-transport-https dirmngr && \ diff --git a/docker/test/base/Dockerfile b/docker/test/base/Dockerfile index 851ec40a038..c9b0700ecfc 100644 --- a/docker/test/base/Dockerfile +++ b/docker/test/base/Dockerfile @@ -1,51 +1,58 @@ # docker build -t yandex/clickhouse-test-base . FROM ubuntu:19.10 -RUN apt-get --allow-unauthenticated update -y && apt-get install --yes wget gnupg -RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -RUN echo "deb [trusted=yes] http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main" >> /etc/apt/sources.list +ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=10 + +RUN apt-get update \ + && apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \ + --yes --no-install-recommends --verbose-versions \ + && export LLVM_PUBKEY_HASH="bda960a8da687a275a2078d43c111d66b1c6a893a3275271beedf266c1ff4a0cdecb429c7a5cccf9f486ea7aa43fd27f" \ + && wget -O /tmp/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key \ + && echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \ + && apt-key add /tmp/llvm-snapshot.gpg.key \ + && export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \ + && echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \ + /etc/apt/sources.list # initial packages -RUN apt-get --allow-unauthenticated update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get --allow-unauthenticated install --yes --no-install-recommends \ - apt-transport-https \ - bash \ - ca-certificates \ - curl \ - fakeroot \ - gnupg \ - software-properties-common +RUN apt-get update \ + && apt-get install \ + bash \ + fakeroot \ + ccache \ + curl \ + software-properties-common \ + --yes --no-install-recommends # Special dpkg-deb (https://github.com/ClickHouse-Extras/dpkg) version which is able # to compress files using pigz (https://zlib.net/pigz/) instead of gzip. # Significantly increase deb packaging speed and compatible with old systems -RUN curl -O https://clickhouse-builds.s3.yandex.net/utils/1/dpkg-deb -RUN chmod +x dpkg-deb -RUN cp dpkg-deb /usr/bin +RUN curl -O https://clickhouse-builds.s3.yandex.net/utils/1/dpkg-deb \ + && chmod +x dpkg-deb \ + && cp dpkg-deb /usr/bin -RUN apt-get --allow-unauthenticated update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get --allow-unauthenticated install --yes --no-install-recommends \ - clang-10 \ - debhelper \ - devscripts \ - gdb \ - git \ - gperf \ - lcov \ - llvm-10 \ - moreutils \ - perl \ - perl \ - pigz \ - pkg-config \ - tzdata +RUN apt-get update \ + && apt-get install \ + clang-${LLVM_VERSION} \ + debhelper \ + devscripts \ + gdb \ + git \ + gperf \ + lcov \ + llvm-${LLVM_VERSION} \ + moreutils \ + perl \ + perl \ + pigz \ + pkg-config \ + tzdata \ + --yes --no-install-recommends # Sanitizer options RUN echo "TSAN_OPTIONS='verbosity=1000 halt_on_error=1 history_size=7'" >> /etc/environment; \ echo "UBSAN_OPTIONS='print_stacktrace=1'" >> /etc/environment; \ echo "MSAN_OPTIONS='abort_on_error=1'" >> /etc/environment; \ - ln -s /usr/lib/llvm-10/bin/llvm-symbolizer /usr/bin/llvm-symbolizer; + ln -s /usr/lib/llvm-${LLVM_VERSION}/bin/llvm-symbolizer /usr/bin/llvm-symbolizer; -CMD sleep 1 \ No newline at end of file +CMD sleep 1 diff --git a/docker/test/coverage/Dockerfile b/docker/test/coverage/Dockerfile index 9ce480f38d8..32020951539 100644 --- a/docker/test/coverage/Dockerfile +++ b/docker/test/coverage/Dockerfile @@ -1,33 +1,12 @@ # docker build -t yandex/clickhouse-coverage . -FROM yandex/clickhouse-deb-builder - -RUN apt-get --allow-unauthenticated update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get --allow-unauthenticated install --yes --no-install-recommends \ - bash \ - fakeroot \ - cmake \ - ccache \ - curl \ - software-properties-common - - -RUN apt-get --allow-unauthenticated update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get --allow-unauthenticated install --yes --no-install-recommends \ - perl \ - lcov \ - clang-10 \ - llvm-10 \ - tzdata - +ARG PARENT_TAG=latest +FROM yandex/clickhouse-test-base:${PARENT_TAG} ENV COVERAGE_DIR=/coverage_reports ENV SOURCE_DIR=/build ENV OUTPUT_DIR=/output ENV IGNORE='.*contrib.*' - CMD mkdir -p /build/obj-x86_64-linux-gnu && cd /build/obj-x86_64-linux-gnu && CC=clang-10 CXX=clang++-10 cmake .. && cd /; \ dpkg -i /package_folder/clickhouse-common-static_*.deb; \ llvm-profdata-10 merge -sparse ${COVERAGE_DIR}/* -o clickhouse.profdata && \ diff --git a/docker/test/fasttest/Dockerfile b/docker/test/fasttest/Dockerfile index f8bb3683f60..49845d72f1d 100644 --- a/docker/test/fasttest/Dockerfile +++ b/docker/test/fasttest/Dockerfile @@ -1,52 +1,73 @@ # docker build -t yandex/clickhouse-fasttest . FROM ubuntu:19.10 +ENV DEBIAN_FRONTEND=noninteractive LLVM_VERSION=10 + +RUN apt-get update \ + && apt-get install ca-certificates lsb-release wget gnupg apt-transport-https \ + --yes --no-install-recommends --verbose-versions \ + && export LLVM_PUBKEY_HASH="bda960a8da687a275a2078d43c111d66b1c6a893a3275271beedf266c1ff4a0cdecb429c7a5cccf9f486ea7aa43fd27f" \ + && wget -O /tmp/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key \ + && echo "${LLVM_PUBKEY_HASH} /tmp/llvm-snapshot.gpg.key" | sha384sum -c \ + && apt-key add /tmp/llvm-snapshot.gpg.key \ + && export CODENAME="$(lsb_release --codename --short | tr 'A-Z' 'a-z')" \ + && echo "deb [trusted=yes] http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" >> \ + /etc/apt/sources.list + +# initial packages +RUN apt-get update \ + && apt-get install \ + bash \ + fakeroot \ + ccache \ + curl \ + software-properties-common \ + --yes --no-install-recommends + +# Special dpkg-deb (https://github.com/ClickHouse-Extras/dpkg) version which is able +# to compress files using pigz (https://zlib.net/pigz/) instead of gzip. +# Significantly increase deb packaging speed and compatible with old systems +RUN curl -O https://clickhouse-builds.s3.yandex.net/utils/1/dpkg-deb \ + && chmod +x dpkg-deb \ + && cp dpkg-deb /usr/bin + +RUN apt-get update \ + && apt-get install \ + apt-transport-https \ + bash \ + brotli \ + build-essential \ + ca-certificates \ + ccache \ + clang-${LLVM_VERSION} \ + clang-tidy-${LLVM_VERSION} \ + cmake \ + curl \ + expect \ + fakeroot \ + git \ + gperf \ + lld-${LLVM_VERSION} \ + llvm-${LLVM_VERSION} \ + moreutils \ + ninja-build \ + psmisc \ + python \ + python-lxml \ + python-requests \ + python-termcolor \ + qemu-user-static \ + rename \ + software-properties-common \ + tzdata \ + unixodbc \ + wget \ + --yes --no-install-recommends + +# This symlink required by gcc to find lld compiler +RUN ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/ld.lld + ARG odbc_driver_url="https://github.com/ClickHouse/clickhouse-odbc/releases/download/v1.1.4.20200302/clickhouse-odbc-1.1.4-Linux.tar.gz" -ENV COMMIT_SHA='' -ENV PULL_REQUEST_NUMBER='' - -RUN apt-get --allow-unauthenticated update -y && apt-get install --yes wget gnupg -RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -RUN echo "deb [trusted=yes] http://apt.llvm.org/eoan/ llvm-toolchain-eoan-10 main" >> /etc/apt/sources.list - - -RUN apt-get --allow-unauthenticated update -y \ - && env DEBIAN_FRONTEND=noninteractive \ - apt-get --allow-unauthenticated install --yes --no-install-recommends \ - apt-transport-https \ - bash \ - bash \ - brotli \ - build-essential \ - ca-certificates \ - ccache \ - ccache \ - clang-10 \ - clang-tidy-10 \ - cmake \ - curl \ - expect \ - fakeroot \ - fakeroot \ - git \ - gperf \ - gperf \ - lld-10 \ - llvm-10 \ - moreutils \ - ninja-build \ - psmisc \ - python \ - python-lxml \ - python-requests \ - python-termcolor \ - qemu-user-static \ - rename \ - software-properties-common \ - sudo \ - tzdata \ - unixodbc \ - wget RUN mkdir -p /tmp/clickhouse-odbc-tmp \ && wget --quiet -O - ${odbc_driver_url} | tar --strip-components=1 -xz -C /tmp/clickhouse-odbc-tmp \ @@ -55,12 +76,11 @@ RUN mkdir -p /tmp/clickhouse-odbc-tmp \ && odbcinst -i -s -l -f /tmp/clickhouse-odbc-tmp/share/doc/clickhouse-odbc/config/odbc.ini.sample \ && rm -rf /tmp/clickhouse-odbc-tmp -# This symlink required by gcc to find lld compiler -RUN ln -s /usr/bin/lld-10 /usr/bin/ld.lld - ENV TZ=Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +ENV COMMIT_SHA='' +ENV PULL_REQUEST_NUMBER='' COPY run.sh / CMD ["/bin/bash", "/run.sh"] diff --git a/docker/test/fasttest/run.sh b/docker/test/fasttest/run.sh index 0152f9c5cfd..1f8d612a125 100755 --- a/docker/test/fasttest/run.sh +++ b/docker/test/fasttest/run.sh @@ -211,6 +211,9 @@ TESTS_TO_SKIP=( # to make some progress. 00646_url_engine 00974_query_profiler + + # Look at DistributedFilesToInsert, so cannot run in parallel. + 01460_DistributedFilesToInsert ) clickhouse-test -j 4 --no-long --testname --shard --zookeeper --skip "${TESTS_TO_SKIP[@]}" 2>&1 | ts '%Y-%m-%d %H:%M:%S' | tee /test_output/test_log.txt diff --git a/docker/test/fuzzer/run-fuzzer.sh b/docker/test/fuzzer/run-fuzzer.sh index 8cfe1a87408..5c1f2fdb586 100755 --- a/docker/test/fuzzer/run-fuzzer.sh +++ b/docker/test/fuzzer/run-fuzzer.sh @@ -91,7 +91,7 @@ function fuzz ./clickhouse-client --query "select elapsed, query from system.processes" ||: killall clickhouse-server ||: - for x in {1..10} + for _ in {1..10} do if ! pgrep -f clickhouse-server then @@ -172,8 +172,60 @@ case "$stage" in echo "failure" > status.txt echo "Fuzzer failed ($fuzzer_exit_code). See the logs" > description.txt fi + ;& +"report") +cat > report.html < + + + + AST Fuzzer for PR #${PR_TO_TEST} @ ${SHA_TO_TEST} + + +
+ +

AST Fuzzer for PR #${PR_TO_TEST} @ ${SHA_TO_TEST}

+ + + + +
Test nameTest statusDescription
AST Fuzzer$(cat status.txt)$(cat description.txt)
+ + + +EOF ;& esac +exit $task_exit_code + diff --git a/tests/integration/test_materialize_mysql_database/composes/mysql_5_7_compose.yml b/docker/test/integration/runner/compose/docker_compose_mysql_5_7.yml similarity index 78% rename from tests/integration/test_materialize_mysql_database/composes/mysql_5_7_compose.yml rename to docker/test/integration/runner/compose/docker_compose_mysql_5_7.yml index bfc5b6a9538..f42d2c6dd79 100644 --- a/tests/integration/test_materialize_mysql_database/composes/mysql_5_7_compose.yml +++ b/docker/test/integration/runner/compose/docker_compose_mysql_5_7.yml @@ -7,4 +7,4 @@ services: MYSQL_ROOT_PASSWORD: clickhouse ports: - 33307:3306 - command: --server_id=100 --log-bin='mysql-bin-1.log' --default-time-zone='+3:00' + command: --server_id=100 --log-bin='mysql-bin-1.log' --default-time-zone='+3:00' --gtid-mode="ON" --enforce-gtid-consistency diff --git a/tests/integration/test_materialize_mysql_database/composes/mysql_8_0_compose.yml b/docker/test/integration/runner/compose/docker_compose_mysql_8_0.yml similarity index 83% rename from tests/integration/test_materialize_mysql_database/composes/mysql_8_0_compose.yml rename to docker/test/integration/runner/compose/docker_compose_mysql_8_0.yml index 7fa72c78895..1aa97f59a83 100644 --- a/tests/integration/test_materialize_mysql_database/composes/mysql_8_0_compose.yml +++ b/docker/test/integration/runner/compose/docker_compose_mysql_8_0.yml @@ -7,4 +7,4 @@ services: MYSQL_ROOT_PASSWORD: clickhouse ports: - 33308:3306 - command: --server_id=100 --log-bin='mysql-bin-1.log' --default_authentication_plugin='mysql_native_password' --default-time-zone='+3:00' + command: --server_id=100 --log-bin='mysql-bin-1.log' --default_authentication_plugin='mysql_native_password' --default-time-zone='+3:00' --gtid-mode="ON" --enforce-gtid-consistency diff --git a/docker/test/performance-comparison/compare.sh b/docker/test/performance-comparison/compare.sh index 3a867e93ffd..d3b9fc2214e 100755 --- a/docker/test/performance-comparison/compare.sh +++ b/docker/test/performance-comparison/compare.sh @@ -114,6 +114,8 @@ function run_tests # Just check that the script runs at all "$script_dir/perf.py" --help > /dev/null + changed_test_files="" + # Find the directory with test files. if [ -v CHPC_TEST_PATH ] then diff --git a/docker/test/performance-comparison/report.py b/docker/test/performance-comparison/report.py index fa0030d5252..ecf9c7a45e5 100755 --- a/docker/test/performance-comparison/report.py +++ b/docker/test/performance-comparison/report.py @@ -36,8 +36,9 @@ color_good='#b0d050' header_template = """ - -