Cmake: link ltdl with pocoodbc static only. rename ARM -> ARCH_ARM (#1083)

* Cmake: link ltdl with pocoodbc static only. rename ARM -> ARCH_ARM

* Fix lib find order

* Allow define non-contrib cityhash farmhash metrohash

* Fix message

* Cmake: fixes

* clean

* Update CMakeLists.txt
This commit is contained in:
proller 2017-08-09 23:52:55 +03:00 committed by alexey-milovidov
parent 1daf11153a
commit ac178bde1f
32 changed files with 317 additions and 68 deletions

View File

@ -45,10 +45,10 @@ message (STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
set (CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release;MinSizeRel;ASan;UBSan" CACHE STRING "" FORCE) set (CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release;MinSizeRel;ASan;UBSan" CACHE STRING "" FORCE)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)") if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
set (AARCH64 1) set (ARCH_AARCH64 1)
endif () endif ()
if (AARCH64 OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm") if (ARCH_AARCH64 OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
set (ARM 1) set (ARCH_ARM 1)
endif () endif ()
set (COMMON_WARNING_FLAGS "-Wall") # -Werror is also added inside directories with our own code. set (COMMON_WARNING_FLAGS "-Wall") # -Werror is also added inside directories with our own code.
@ -175,6 +175,7 @@ if (NOT OPENSSL_FOUND)
message (FATAL_ERROR "Need openssl for build. debian tip: sudo apt install libssl-dev") message (FATAL_ERROR "Need openssl for build. debian tip: sudo apt install libssl-dev")
endif () endif ()
include (cmake/lib_name.cmake)
include (cmake/find_icu4c.cmake) include (cmake/find_icu4c.cmake)
include (cmake/find_boost.cmake) include (cmake/find_boost.cmake)
# openssl, zlib before poco # openssl, zlib before poco
@ -183,19 +184,24 @@ include (cmake/find_zstd.cmake)
include (cmake/find_poco.cmake) include (cmake/find_poco.cmake)
include (cmake/find_lz4.cmake) include (cmake/find_lz4.cmake)
include (cmake/find_sparsehash.cmake) include (cmake/find_sparsehash.cmake)
include (cmake/find_libtool.cmake)
include (cmake/find_rt.cmake) include (cmake/find_rt.cmake)
include (cmake/find_readline_edit.cmake) include (cmake/find_readline_edit.cmake)
include (cmake/find_zookeeper.cmake) include (cmake/find_zookeeper.cmake)
include (cmake/find_double-conversion.cmake)
include (cmake/find_re2.cmake) include (cmake/find_re2.cmake)
include (cmake/find_contrib_lib.cmake)
find_contrib_lib(cityhash)
find_contrib_lib(farmhash)
find_contrib_lib(metrohash)
find_contrib_lib(btrie)
find_contrib_lib(double-conversion)
# Need to process before "contrib" dir: # Need to process before "contrib" dir:
include (libs/libcommon/cmake/find_gperftools.cmake) include (libs/libcommon/cmake/find_gperftools.cmake)
include (libs/libcommon/cmake/find_jemalloc.cmake) include (libs/libcommon/cmake/find_jemalloc.cmake)
include (libs/libcommon/cmake/find_cctz.cmake) include (libs/libcommon/cmake/find_cctz.cmake)
include (libs/libmysqlxx/cmake/find_mysqlclient.cmake) include (libs/libmysqlxx/cmake/find_mysqlclient.cmake)
include (libs/libdaemon/cmake/find_unwind.cmake) include (libs/libdaemon/cmake/find_unwind.cmake)
include (cmake/lib_name.cmake)
set (FULL_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}") set (FULL_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}}")

View File

@ -0,0 +1,44 @@
# - Try to find btrie headers and libraries.
#
# Usage of this module as follows:
#
# find_package(btrie)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# BTRIE_ROOT_DIR Set this variable to the root installation of
# btrie if the module has problems finding
# the proper installation path.
#
# Variables defined by this module:
#
# BTRIE_FOUND System has btrie libs/headers
# BTRIE_LIBRARIES The btrie library/libraries
# BTRIE_INCLUDE_DIR The location of btrie headers
find_path(BTRIE_ROOT_DIR
NAMES include/btrie.h
)
find_library(BTRIE_LIBRARIES
NAMES btrie
PATHS ${BTRIE_ROOT_DIR}/lib ${BTRIE_LIBRARIES_PATHS}
)
find_path(BTRIE_INCLUDE_DIR
NAMES btrie.h
PATHS ${BTRIE_ROOT_DIR}/include ${BTRIE_INCLUDE_PATHS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(btrie DEFAULT_MSG
BTRIE_LIBRARIES
BTRIE_INCLUDE_DIR
)
mark_as_advanced(
BTRIE_ROOT_DIR
BTRIE_LIBRARIES
BTRIE_INCLUDE_DIR
)

View File

@ -0,0 +1,44 @@
# - Try to find cityhash headers and libraries.
#
# Usage of this module as follows:
#
# find_package(cityhash)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# CITYHASH_ROOT_DIR Set this variable to the root installation of
# cityhash if the module has problems finding
# the proper installation path.
#
# Variables defined by this module:
#
# CITYHASH_FOUND System has cityhash libs/headers
# CITYHASH_LIBRARIES The cityhash library/libraries
# CITYHASH_INCLUDE_DIR The location of cityhash headers
find_path(CITYHASH_ROOT_DIR
NAMES include/city.h
)
find_library(CITYHASH_LIBRARIES
NAMES cityhash
PATHS ${CITYHASH_ROOT_DIR}/lib ${CITYHASH_LIBRARIES_PATHS}
)
find_path(CITYHASH_INCLUDE_DIR
NAMES city.h
PATHS ${CITYHASH_ROOT_DIR}/include ${CITYHASH_INCLUDE_PATHS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(cityhash DEFAULT_MSG
CITYHASH_LIBRARIES
CITYHASH_INCLUDE_DIR
)
mark_as_advanced(
CITYHASH_ROOT_DIR
CITYHASH_LIBRARIES
CITYHASH_INCLUDE_DIR
)

View File

@ -0,0 +1,44 @@
# - Try to find double-conversion headers and libraries.
#
# Usage of this module as follows:
#
# find_package(double-conversion)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# DOUBLE_CONVERSION_ROOT_DIR Set this variable to the root installation of
# double-conversion if the module has problems finding
# the proper installation path.
#
# Variables defined by this module:
#
# DOUBLE_CONVERSION_FOUND System has double-conversion libs/headers
# DOUBLE_CONVERSION_LIBRARIES The double-conversion library/libraries
# DOUBLE_CONVERSION_INCLUDE_DIR The location of double-conversion headers
find_path(DOUBLE_CONVERSION_ROOT_DIR
NAMES include/double-conversion.h
)
find_library(DOUBLE_CONVERSION_LIBRARIES
NAMES double-conversion
PATHS ${DOUBLE_CONVERSION_ROOT_DIR}/lib ${BTRIE_CITYHASH_PATHS}
)
find_path(DOUBLE_CONVERSION_INCLUDE_DIR
NAMES double-conversion.h
PATHS ${DOUBLE_CONVERSION_ROOT_DIR}/include ${DOUBLE_CONVERSION_INCLUDE_PATHS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(double_conversion DEFAULT_MSG
DOUBLE_CONVERSION_LIBRARIES
DOUBLE_CONVERSION_INCLUDE_DIR
)
mark_as_advanced(
DOUBLE_CONVERSION_ROOT_DIR
DOUBLE_CONVERSION_LIBRARIES
DOUBLE_CONVERSION_INCLUDE_DIR
)

View File

@ -0,0 +1,44 @@
# - Try to find farmhash headers and libraries.
#
# Usage of this module as follows:
#
# find_package(farmhash)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# FARMHASH_ROOT_DIR Set this variable to the root installation of
# farmhash if the module has problems finding
# the proper installation path.
#
# Variables defined by this module:
#
# FARMHASH_FOUND System has farmhash libs/headers
# FARMHASH_LIBRARIES The farmhash library/libraries
# FARMHASH_INCLUDE_DIR The location of farmhash headers
find_path(FARMHASH_ROOT_DIR
NAMES include/farmhash.h
)
find_library(FARMHASH_LIBRARIES
NAMES farmhash
PATHS ${FARMHASH_ROOT_DIR}/lib ${FARMHASH_LIBRARIES_PATHS}
)
find_path(FARMHASH_INCLUDE_DIR
NAMES farmhash.h
PATHS ${FARMHASH_ROOT_DIR}/include ${FARMHASH_INCLUDE_PATHS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(farmhash DEFAULT_MSG
FARMHASH_LIBRARIES
FARMHASH_INCLUDE_DIR
)
mark_as_advanced(
FARMHASH_ROOT_DIR
FARMHASH_LIBRARIES
FARMHASH_INCLUDE_DIR
)

View File

@ -0,0 +1,44 @@
# - Try to find metrohash headers and libraries.
#
# Usage of this module as follows:
#
# find_package(metrohash)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# METROHASH_ROOT_DIR Set this variable to the root installation of
# metrohash if the module has problems finding
# the proper installation path.
#
# Variables defined by this module:
#
# METROHASH_FOUND System has metrohash libs/headers
# METROHASH_LIBRARIES The metrohash library/libraries
# METROHASH_INCLUDE_DIR The location of metrohash headers
find_path(METROHASH_ROOT_DIR
NAMES include/metrohash.h
)
find_library(METROHASH_LIBRARIES
NAMES metrohash
PATHS ${METROHASH_ROOT_DIR}/lib ${METROHASH_LIBRARIES_PATHS}
)
find_path(METROHASH_INCLUDE_DIR
NAMES metrohash.h
PATHS ${METROHASH_ROOT_DIR}/include ${METROHASH_INCLUDE_PATHS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(metrohash DEFAULT_MSG
METROHASH_LIBRARIES
METROHASH_INCLUDE_DIR
)
mark_as_advanced(
METROHASH_ROOT_DIR
METROHASH_LIBRARIES
METROHASH_INCLUDE_DIR
)

View File

@ -0,0 +1,21 @@
macro(find_contrib_lib LIB_NAME)
string(TOLOWER ${LIB_NAME} LIB_NAME_LC)
string(TOUPPER ${LIB_NAME} LIB_NAME_UC)
string(REPLACE "-" "_" LIB_NAME_UC ${LIB_NAME_UC})
option (USE_INTERNAL_${LIB_NAME_UC}_LIBRARY "Use bundled library ${LIB_NAME} instead of system" ${NOT_UNBUNDLED})
if (NOT USE_INTERNAL_${LIB_NAME_UC}_LIBRARY)
find_package ("${LIB_NAME}")
endif ()
if (NOT ${LIB_NAME_UC}_FOUND)
set (USE_INTERNAL_${LIB_NAME_UC}_LIBRARY 1)
set (${LIB_NAME_UC}_LIBRARIES ${LIB_NAME_LC})
set (${LIB_NAME_UC}_INCLUDE_DIR ${${LIB_NAME_UC}_CONTRIB_INCLUDE_DIR})
endif ()
message (STATUS "Using ${LIB_NAME}: ${${LIB_NAME_UC}_INCLUDE_DIR} : ${${LIB_NAME_UC}_LIBRARIES}")
endmacro()

View File

@ -1,17 +0,0 @@
option (USE_INTERNAL_DOUBLE_CONVERSION_LIBRARY "Set to FALSE to use system double-conversion library instead of bundled" ${NOT_UNBUNDLED})
if (NOT USE_INTERNAL_DOUBLE_CONVERSION_LIBRARY)
find_library (DOUBLE_CONVERSION_LIBRARY double-conversion)
find_path (DOUBLE_CONVERSION_INCLUDE_DIR NAMES double-conversion/double-conversion.h PATHS ${DOUBLE_CONVERSION_INCLUDE_PATHS})
endif ()
if (DOUBLE_CONVERSION_LIBRARY AND DOUBLE_CONVERSION_INCLUDE_DIR)
include_directories (${DOUBLE_CONVERSION_INCLUDE_DIR})
else ()
set (USE_INTERNAL_DOUBLE_CONVERSION_LIBRARY 1)
set (DOUBLE_CONVERSION_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libdouble-conversion")
include_directories (BEFORE ${DOUBLE_CONVERSION_INCLUDE_DIR})
set (DOUBLE_CONVERSION_LIBRARY double-conversion)
endif ()
message (STATUS "Using double-conversion: ${DOUBLE_CONVERSION_INCLUDE_DIR} : ${DOUBLE_CONVERSION_LIBRARY}")

View File

@ -9,8 +9,6 @@ if (LZ4_LIBRARY AND LZ4_INCLUDE_DIR)
include_directories (${LZ4_INCLUDE_DIR}) include_directories (${LZ4_INCLUDE_DIR})
else () else ()
set (USE_INTERNAL_LZ4_LIBRARY 1) set (USE_INTERNAL_LZ4_LIBRARY 1)
set (LZ4_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/liblz4/include/lz4")
include_directories (BEFORE ${LZ4_INCLUDE_DIR})
set (LZ4_LIBRARY lz4) set (LZ4_LIBRARY lz4)
endif () endif ()

View File

@ -1,5 +1,9 @@
option (USE_INTERNAL_POCO_LIBRARY "Set to FALSE to use system poco library instead of bundled" ${NOT_UNBUNDLED}) option (USE_INTERNAL_POCO_LIBRARY "Set to FALSE to use system poco library instead of bundled" ${NOT_UNBUNDLED})
if (USE_STATIC_LIBRARIES)
include (cmake/find_ltdl.cmake)
endif ()
if (NOT USE_INTERNAL_POCO_LIBRARY) if (NOT USE_INTERNAL_POCO_LIBRARY)
find_package (Poco COMPONENTS Net NetSSL XML Data Crypto DataODBC MongoDB) find_package (Poco COMPONENTS Net NetSSL XML Data Crypto DataODBC MongoDB)
endif () endif ()
@ -29,6 +33,9 @@ else ()
if (ODBC_FOUND) if (ODBC_FOUND)
set (Poco_DataODBC_FOUND 1) set (Poco_DataODBC_FOUND 1)
set (Poco_DataODBC_LIBRARY PocoDataODBC) set (Poco_DataODBC_LIBRARY PocoDataODBC)
if (USE_STATIC_LIBRARIES)
list (APPEND Poco_DataODBC_LIBRARY ${LTDL_LIB})
endif ()
list (APPEND Poco_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/ODBC/include/") list (APPEND Poco_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/ODBC/include/")
endif () endif ()

View File

@ -10,10 +10,6 @@ if (RE2_LIBRARY AND RE2_INCLUDE_DIR)
set (RE2_ST_LIBRARY ${RE2_LIBRARY}) set (RE2_ST_LIBRARY ${RE2_LIBRARY})
else () else ()
set (USE_INTERNAL_RE2_LIBRARY 1) set (USE_INTERNAL_RE2_LIBRARY 1)
set (RE2_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libre2")
set (RE2_ST_INCLUDE_DIR "${ClickHouse_BINARY_DIR}/contrib/libre2")
include_directories (BEFORE ${RE2_INCLUDE_DIR})
include_directories (BEFORE ${RE2_ST_INCLUDE_DIR})
set (RE2_LIBRARY re2) set (RE2_LIBRARY re2)
set (RE2_ST_LIBRARY re2_st) set (RE2_ST_LIBRARY re2_st)
set (USE_RE2_ST 1) set (USE_RE2_ST 1)

View File

@ -9,7 +9,6 @@ if (SPARCEHASH_INCLUDE_DIR)
else () else ()
set (USE_INTERNAL_SPARCEHASH_LIBRARY 1) set (USE_INTERNAL_SPARCEHASH_LIBRARY 1)
set (SPARCEHASH_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libsparsehash") set (SPARCEHASH_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libsparsehash")
include_directories (BEFORE ${SPARCEHASH_INCLUDE_DIR})
endif () endif ()
message (STATUS "Using sparsehash: ${SPARCEHASH_INCLUDE_DIR}") message (STATUS "Using sparsehash: ${SPARCEHASH_INCLUDE_DIR}")

View File

@ -2,15 +2,11 @@ option (USE_INTERNAL_ZLIB_LIBRARY "Set to FALSE to use system zlib library inste
if (NOT USE_INTERNAL_ZLIB_LIBRARY) if (NOT USE_INTERNAL_ZLIB_LIBRARY)
find_package (ZLIB) find_package (ZLIB)
if (ZLIB_FOUND)
include_directories (${ZLIB_INCLUDE_DIRS})
endif ()
endif () endif ()
if (NOT ZLIB_FOUND) if (NOT ZLIB_FOUND)
set (USE_INTERNAL_ZLIB_LIBRARY 1) set (USE_INTERNAL_ZLIB_LIBRARY 1)
set (ZLIB_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng") set (ZLIB_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng")
include_directories (BEFORE ${ZLIB_INCLUDE_DIR})
if (USE_STATIC_LIBRARIES) if (USE_STATIC_LIBRARIES)
set (ZLIB_LIBRARIES zlibstatic) set (ZLIB_LIBRARIES zlibstatic)
else () else ()

View File

@ -9,8 +9,6 @@ if (ZOOKEEPER_LIBRARY AND ZOOKEEPER_INCLUDE_DIR)
include_directories (${ZOOKEEPER_INCLUDE_DIR}) include_directories (${ZOOKEEPER_INCLUDE_DIR})
else () else ()
set (USE_INTERNAL_ZOOKEEPER_LIBRARY 1) set (USE_INTERNAL_ZOOKEEPER_LIBRARY 1)
set (ZOOKEEPER_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libzookeeper/include")
include_directories (BEFORE ${ZOOKEEPER_INCLUDE_DIR})
set (ZOOKEEPER_LIBRARY zookeeper_mt) set (ZOOKEEPER_LIBRARY zookeeper_mt)
endif () endif ()

View File

@ -9,8 +9,6 @@ if (ZSTD_LIBRARY AND ZSTD_INCLUDE_DIR)
include_directories (${ZSTD_INCLUDE_DIR}) include_directories (${ZSTD_INCLUDE_DIR})
else () else ()
set (USE_INTERNAL_ZSTD_LIBRARY 1) set (USE_INTERNAL_ZSTD_LIBRARY 1)
set (ZSTD_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libzstd/include/zstd")
include_directories (BEFORE ${ZSTD_INCLUDE_DIR})
set (ZSTD_LIBRARY zstd) set (ZSTD_LIBRARY zstd)
endif () endif ()

View File

@ -1,10 +1,6 @@
set(CITYHASH_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libcityhash/include)
set(CPUID_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libcpuid/include)
set(DIVIDE_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libdivide) set(DIVIDE_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libdivide)
set(BTRIE_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libbtrie/include) set(CITYHASH_CONTRIB_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libcityhash/include)
set(CITYHASH_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libcityhash/include)
set(MYSQLXX_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/libs/libmysqlxx/include)
set(POCOEXT_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/libs/libpocoext/include)
set(COMMON_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/libs/libcommon/include ${ClickHouse_BINARY_DIR}/libs/libcommon/include) set(COMMON_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/libs/libcommon/include ${ClickHouse_BINARY_DIR}/libs/libcommon/include)
set(DBMS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/dbms/src ${ClickHouse_BINARY_DIR}/dbms/src) set(DBMS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/dbms/src ${ClickHouse_BINARY_DIR}/dbms/src)
set(DOUBLE_CONVERSION_CONTRIB_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libdouble-conversion)

View File

@ -1,4 +1,12 @@
get_property (dirs TARGET dbms PROPERTY INCLUDE_DIRECTORIES)
# TODO? Maybe recursive collect on all deps
get_property (dirs1 TARGET dbms PROPERTY INCLUDE_DIRECTORIES)
list(APPEND dirs ${dirs1})
get_property (dirs1 TARGET common PROPERTY INCLUDE_DIRECTORIES)
list(APPEND dirs ${dirs1})
list(REMOVE_DUPLICATES dirs) list(REMOVE_DUPLICATES dirs)
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/include_directories.txt "") file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/include_directories.txt "")
foreach (dir ${dirs}) foreach (dir ${dirs})

View File

@ -57,7 +57,7 @@ check_cxx_source_compiles("
} }
" HAVE_POPCNT) " HAVE_POPCNT)
if (HAVE_POPCNT AND NOT AARCH64) if (HAVE_POPCNT AND NOT ARCH_AARCH64)
set (COMPILER_FLAGS "${COMPILER_FLAGS} ${TEST_FLAG}") set (COMPILER_FLAGS "${COMPILER_FLAGS} ${TEST_FLAG}")
endif () endif ()

View File

@ -28,10 +28,21 @@ if (USE_INTERNAL_ZOOKEEPER_LIBRARY)
add_subdirectory (libzookeeper) add_subdirectory (libzookeeper)
endif () endif ()
add_subdirectory (libcityhash) if (USE_INTERNAL_CITYHASH_LIBRARY)
add_subdirectory (libfarmhash) add_subdirectory (libcityhash)
add_subdirectory (libmetrohash) endif ()
add_subdirectory (libbtrie)
if (USE_INTERNAL_FARMHASH_LIBRARY)
add_subdirectory (libfarmhash)
endif ()
if (USE_INTERNAL_METROHASH_LIBRARY)
add_subdirectory (libmetrohash)
endif ()
if (USE_INTERNAL_BTRIE_LIBRARY)
add_subdirectory (libbtrie)
endif ()
if (USE_INTERNAL_UNWIND_LIBRARY) if (USE_INTERNAL_UNWIND_LIBRARY)
add_subdirectory (libunwind) add_subdirectory (libunwind)
@ -49,6 +60,6 @@ if (ENABLE_LIBTCMALLOC AND USE_INTERNAL_GPERFTOOLS_LIBRARY)
add_subdirectory (libtcmalloc) add_subdirectory (libtcmalloc)
endif () endif ()
if (NOT ARM) if (NOT ARCH_ARM)
add_subdirectory (libcpuid) add_subdirectory (libcpuid)
endif () endif ()

View File

@ -16,3 +16,5 @@ include/cpuid/rdtsc.h
include/cpuid/recog_amd.h include/cpuid/recog_amd.h
include/cpuid/recog_intel.h include/cpuid/recog_intel.h
) )
target_include_directories (cpuid PUBLIC include)

View File

@ -18,3 +18,5 @@ double-conversion/strtod.cc
double-conversion/strtod.h double-conversion/strtod.h
double-conversion/utils.h double-conversion/utils.h
) )
target_include_directories (double-conversion PUBLIC .)

View File

@ -6,4 +6,4 @@ add_library (lz4
include/lz4/lz4hc.h include/lz4/lz4hc.h
include/lz4/lz4opt.h) include/lz4/lz4opt.h)
target_include_directories(lz4 PUBLIC include) target_include_directories(lz4 PUBLIC include/lz4)

View File

@ -41,6 +41,9 @@ add_library (re2_st ${re2_sources})
target_compile_definitions (re2 PRIVATE NDEBUG) target_compile_definitions (re2 PRIVATE NDEBUG)
target_compile_definitions (re2_st PRIVATE NDEBUG NO_THREADS re2=re2_st) target_compile_definitions (re2_st PRIVATE NDEBUG NO_THREADS re2=re2_st)
target_include_directories (re2 PUBLIC .)
target_include_directories (re2_st PUBLIC .)
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/re2_st) file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/re2_st)
foreach (FILENAME filtered_re2.h re2.h set.h stringpiece.h variadic_function.h) foreach (FILENAME filtered_re2.h re2.h set.h stringpiece.h variadic_function.h)
add_custom_command (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/re2_st/${FILENAME}" add_custom_command (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/re2_st/${FILENAME}"

View File

@ -92,3 +92,5 @@ IF (ZSTD_LEGACY_SUPPORT)
ENDIF (ZSTD_LEGACY_SUPPORT) ENDIF (ZSTD_LEGACY_SUPPORT)
ADD_LIBRARY(zstd ${Sources} ${Headers}) ADD_LIBRARY(zstd ${Sources} ${Headers})
target_include_directories (zstd PUBLIC include/zstd)

View File

@ -28,6 +28,7 @@ add_subdirectory (src)
add_library(string_utils add_library(string_utils
src/Common/StringUtils.h src/Common/StringUtils.h
src/Common/StringUtils.cpp) src/Common/StringUtils.cpp)
target_include_directories (string_utils PRIVATE ${DBMS_INCLUDE_DIR})
set(dbms_headers) set(dbms_headers)
set(dbms_sources) set(dbms_sources)
@ -150,7 +151,7 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
PROPERTIES COMPILE_FLAGS -g0) PROPERTIES COMPILE_FLAGS -g0)
endif () endif ()
if (NOT ARM) if (NOT ARCH_ARM)
set (LINK_LIBRARIES_ONLY_ON_X86_64 cpuid) set (LINK_LIBRARIES_ONLY_ON_X86_64 cpuid)
endif() endif()
@ -163,12 +164,13 @@ endif()
target_link_libraries (dbms target_link_libraries (dbms
common common
${MYSQLXX_LIBRARY} ${MYSQLXX_LIBRARY}
cityhash farmhash metrohash ${FARMHASH_LIBRARIES}
${METROHASH_LIBRARIES}
${LZ4_LIBRARY} ${LZ4_LIBRARY}
${ZSTD_LIBRARY} ${ZSTD_LIBRARY}
${ZOOKEEPER_LIBRARY} ${ZOOKEEPER_LIBRARY}
string_utils string_utils
${DOUBLE_CONVERSION_LIBRARY} ${DOUBLE_CONVERSION_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${LINK_LIBRARIES_ONLY_ON_X86_64} ${LINK_LIBRARIES_ONLY_ON_X86_64}
${RE2_LIBRARY} ${RE2_LIBRARY}
@ -176,7 +178,7 @@ target_link_libraries (dbms
${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Poco_Data_LIBRARY} ${Poco_Data_LIBRARY}
btrie ${BTRIE_LIBRARIES}
) )
if (Poco_DataODBC_FOUND) if (Poco_DataODBC_FOUND)
@ -200,19 +202,17 @@ endif ()
target_link_libraries (dbms target_link_libraries (dbms
${PLATFORM_LIBS} ${PLATFORM_LIBS}
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
${LTDL_LIB}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
) )
target_include_directories (dbms BEFORE PRIVATE ${CPUID_INCLUDE_DIR}) target_include_directories (dbms BEFORE PRIVATE ${DIVIDE_INCLUDE_DIR})
target_include_directories (dbms BEFORE PUBLIC ${DIVIDE_INCLUDE_DIR})
target_include_directories (dbms BEFORE PRIVATE ${BTRIE_INCLUDE_DIR})
target_include_directories (dbms BEFORE PRIVATE ${CITYHASH_INCLUDE_DIR})
target_include_directories (dbms PUBLIC ${MYSQLXX_INCLUDE_DIR})
target_include_directories (dbms PRIVATE ${POCOEXT_INCLUDE_DIR})
target_include_directories (dbms PRIVATE ${COMMON_INCLUDE_DIR})
target_include_directories (dbms PUBLIC ${DBMS_INCLUDE_DIR}) target_include_directories (dbms PUBLIC ${DBMS_INCLUDE_DIR})
# only for copy_headers.sh:
target_include_directories (dbms PRIVATE ${COMMON_INCLUDE_DIR})
target_include_directories (dbms BEFORE PRIVATE ${DOUBLE_CONVERSION_INCLUDE_DIR})
if (ENABLE_TESTS) if (ENABLE_TESTS)
add_subdirectory (tests) add_subdirectory (tests)
# attach all dbms gtest sources # attach all dbms gtest sources

View File

@ -28,5 +28,4 @@ list(REMOVE_ITEM clickhouse_aggregate_functions_headers
add_library(clickhouse_aggregate_functions ${clickhouse_aggregate_functions_sources}) add_library(clickhouse_aggregate_functions ${clickhouse_aggregate_functions_sources})
target_link_libraries(clickhouse_aggregate_functions dbms) target_link_libraries(clickhouse_aggregate_functions dbms)
target_include_directories (clickhouse_aggregate_functions BEFORE PUBLIC ${CITYHASH_INCLUDE_DIR})
target_include_directories (clickhouse_aggregate_functions PRIVATE ${COMMON_INCLUDE_DIR}) target_include_directories (clickhouse_aggregate_functions PRIVATE ${COMMON_INCLUDE_DIR})

View File

@ -66,7 +66,7 @@ add_library(clickhouse_functions ${clickhouse_functions_sources})
target_link_libraries(clickhouse_functions dbms) target_link_libraries(clickhouse_functions dbms)
target_include_directories (clickhouse_functions BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libfarmhash) target_include_directories (clickhouse_functions BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libfarmhash)
target_include_directories (clickhouse_functions BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libmetrohash/src) target_include_directories (clickhouse_functions BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libmetrohash/src)
target_include_directories (clickhouse_functions BEFORE PUBLIC ${CITYHASH_INCLUDE_DIR}) target_include_directories (clickhouse_functions BEFORE PUBLIC ${DIVIDE_INCLUDE_DIR})
if (USE_VECTORCLASS) if (USE_VECTORCLASS)
target_include_directories (clickhouse_functions BEFORE PUBLIC ${VECTORCLASS_INCLUDE_DIR}) target_include_directories (clickhouse_functions BEFORE PUBLIC ${VECTORCLASS_INCLUDE_DIR})

View File

@ -4,7 +4,7 @@ add_executable (number_traits number_traits.cpp)
target_link_libraries (number_traits dbms) target_link_libraries (number_traits dbms)
add_executable (functions_arithmetic functions_arithmetic.cpp) add_executable (functions_arithmetic functions_arithmetic.cpp)
target_link_libraries (functions_arithmetic dbms) target_link_libraries (functions_arithmetic dbms clickhouse_functions)
add_executable (logical_functions_performance logical_functions_performance.cpp) add_executable (logical_functions_performance logical_functions_performance.cpp)
target_link_libraries (logical_functions_performance dbms) target_link_libraries (logical_functions_performance dbms)

View File

@ -28,6 +28,10 @@ set (INTERNAL_COMPILER_CUSTOM_ROOT ON CACHE BOOL "")
list(GET Poco_INCLUDE_DIRS 0 Poco_Foundation_INCLUDE_DIR) list(GET Poco_INCLUDE_DIRS 0 Poco_Foundation_INCLUDE_DIR)
list(GET Poco_INCLUDE_DIRS 1 Poco_Util_INCLUDE_DIR) list(GET Poco_INCLUDE_DIRS 1 Poco_Util_INCLUDE_DIR)
if (NOT DOUBLE_CONVERSION_INCLUDE_DIR)
get_target_property(DOUBLE_CONVERSION_INCLUDE_DIR ${DOUBLE_CONVERSION_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
endif ()
string (REPLACE ${ClickHouse_SOURCE_DIR} ${INTERNAL_COMPILER_HEADERS} INTERNAL_DOUBLE_CONVERSION_INCLUDE_DIR ${DOUBLE_CONVERSION_INCLUDE_DIR}) string (REPLACE ${ClickHouse_SOURCE_DIR} ${INTERNAL_COMPILER_HEADERS} INTERNAL_DOUBLE_CONVERSION_INCLUDE_DIR ${DOUBLE_CONVERSION_INCLUDE_DIR})
string (REPLACE ${ClickHouse_SOURCE_DIR} ${INTERNAL_COMPILER_HEADERS} INTERNAL_Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}) string (REPLACE ${ClickHouse_SOURCE_DIR} ${INTERNAL_COMPILER_HEADERS} INTERNAL_Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
string (REPLACE ${ClickHouse_SOURCE_DIR} ${INTERNAL_COMPILER_HEADERS} INTERNAL_Poco_Foundation_INCLUDE_DIR ${Poco_Foundation_INCLUDE_DIR}) string (REPLACE ${ClickHouse_SOURCE_DIR} ${INTERNAL_COMPILER_HEADERS} INTERNAL_Poco_Foundation_INCLUDE_DIR ${Poco_Foundation_INCLUDE_DIR})

View File

@ -84,6 +84,7 @@ target_include_directories (common PUBLIC ${COMMON_INCLUDE_DIR})
target_link_libraries ( target_link_libraries (
common common
pocoext pocoext
${CITYHASH_LIBRARIES}
${CCTZ_LIBRARY} ${CCTZ_LIBRARY}
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}

View File

@ -7,5 +7,4 @@ add_library (pocoext
target_include_directories (pocoext PUBLIC include PRIVATE ${COMMON_INCLUDE_DIR}) target_include_directories (pocoext PUBLIC include PRIVATE ${COMMON_INCLUDE_DIR})
target_link_libraries(pocoext ${Poco_Util_LIBRARY} ${Poco_Net_LIBRARY} ${Poco_XML_LIBRARY} ${Poco_Foundation_LIBRARY}) target_link_libraries(pocoext ${Poco_Util_LIBRARY} ${Poco_Net_LIBRARY} ${Poco_XML_LIBRARY} ${Poco_Foundation_LIBRARY})