2017-09-10 06:51:27 +00:00
if ( USE_INCLUDE_WHAT_YOU_USE )
set ( CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${ IWYU_PATH } )
endif ( )
2019-06-30 18:56:53 +00:00
if ( USE_CLANG_TIDY )
2020-03-08 20:17:49 +00:00
set ( CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}" )
2019-06-30 18:56:53 +00:00
endif ( )
2019-01-11 12:40:19 +00:00
if ( COMPILER_PIPE )
set ( MAX_COMPILER_MEMORY 2500 )
2018-12-27 15:23:37 +00:00
else ( )
2019-01-11 12:40:19 +00:00
set ( MAX_COMPILER_MEMORY 1500 )
endif ( )
if ( MAKE_STATIC_LIBRARIES )
set ( MAX_LINKER_MEMORY 3500 )
else ( )
set ( MAX_LINKER_MEMORY 2500 )
endif ( )
include ( ../cmake/limit_jobs.cmake )
2018-12-27 15:23:37 +00:00
2020-04-01 23:51:21 +00:00
set ( CONFIG_VERSION ${ CMAKE_CURRENT_BINARY_DIR } /Common/config_version.h )
set ( CONFIG_COMMON ${ CMAKE_CURRENT_BINARY_DIR } /Common/config.h )
2017-03-14 13:47:39 +00:00
2020-04-02 00:36:53 +00:00
include ( ../cmake/version.cmake )
2019-04-03 14:06:59 +00:00
message ( STATUS "Will build ${VERSION_FULL} revision ${VERSION_REVISION} ${VERSION_OFFICIAL}" )
2020-04-01 23:51:21 +00:00
configure_file ( Common/config.h.in ${ CONFIG_COMMON } )
configure_file ( Common/config_version.h.in ${ CONFIG_VERSION } )
configure_file ( Core/config_core.h.in ${ CMAKE_CURRENT_BINARY_DIR } /Core/include/config_core.h )
2017-03-14 13:47:39 +00:00
2018-03-02 00:17:25 +00:00
if ( NOT MSVC )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra" )
endif ( )
2017-12-01 17:49:12 +00:00
2020-02-24 00:44:38 +00:00
if ( USE_DEBUG_HELPERS )
2020-04-03 15:14:31 +00:00
set ( INCLUDE_DEBUG_HELPERS "-I${ClickHouse_SOURCE_DIR}/base -include ${ClickHouse_SOURCE_DIR}/src/Core/iostream_debug_helpers.h" )
2020-02-24 00:44:38 +00:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${INCLUDE_DEBUG_HELPERS}" )
endif ( )
2019-01-04 14:03:42 +00:00
# Add some warnings that are not available even with -Wall -Wextra -Wpedantic.
2018-09-02 00:34:34 +00:00
2019-01-04 13:32:08 +00:00
option ( WEVERYTHING "Enables -Weverything option with some exceptions. This is intended for exploration of new compiler warnings that may be found to be useful. Only makes sense for clang." ON )
2019-01-04 12:10:00 +00:00
2020-01-10 10:25:14 +00:00
if ( COMPILER_CLANG )
add_warning ( pedantic )
no_warning ( gnu-anonymous-struct )
no_warning ( nested-anon-types )
no_warning ( vla-extension )
no_warning ( zero-length-array )
add_warning ( comma )
add_warning ( conditional-uninitialized )
add_warning ( covered-switch-default )
add_warning ( deprecated )
add_warning ( embedded-directive )
add_warning ( empty-init-stmt ) # linux-only
add_warning ( extra-semi-stmt ) # linux-only
add_warning ( extra-semi )
add_warning ( gnu-case-range )
add_warning ( inconsistent-missing-destructor-override )
add_warning ( newline-eof )
add_warning ( old-style-cast )
add_warning ( range-loop-analysis )
add_warning ( redundant-parens )
add_warning ( reserved-id-macro )
add_warning ( shadow-field ) # clang 8+
add_warning ( shadow-uncaptured-local )
add_warning ( shadow )
add_warning ( string-plus-int ) # clang 8+
add_warning ( undef )
add_warning ( unreachable-code-return )
add_warning ( unreachable-code )
add_warning ( unused-exception-parameter )
add_warning ( unused-macros )
add_warning ( unused-member-function )
add_warning ( zero-as-null-pointer-constant )
2018-08-26 12:38:45 +00:00
2019-01-04 12:10:00 +00:00
if ( WEVERYTHING )
2020-01-10 10:25:14 +00:00
add_warning ( everything )
no_warning ( c++98-compat-pedantic )
no_warning ( c++98-compat )
no_warning ( c99-extensions )
no_warning ( conversion )
no_warning ( ctad-maybe-unsupported ) # clang 9+, linux-only
no_warning ( deprecated-dynamic-exception-spec )
no_warning ( disabled-macro-expansion )
no_warning ( documentation-unknown-command )
no_warning ( double-promotion )
no_warning ( exit-time-destructors )
no_warning ( float-equal )
no_warning ( global-constructors )
no_warning ( gnu-anonymous-struct )
no_warning ( missing-prototypes )
no_warning ( missing-variable-declarations )
no_warning ( nested-anon-types )
no_warning ( packed )
no_warning ( padded )
no_warning ( return-std-move-in-c++11 ) # clang 7+
no_warning ( shift-sign-overflow )
no_warning ( sign-conversion )
no_warning ( switch-enum )
no_warning ( undefined-func-template )
no_warning ( unused-template )
no_warning ( vla-extension )
no_warning ( vla )
no_warning ( weak-template-vtables )
no_warning ( weak-vtables )
no_warning ( zero-length-array )
2019-01-04 14:03:42 +00:00
2019-01-05 01:11:17 +00:00
# TODO Enable conversion, sign-conversion, double-promotion warnings.
2019-01-05 00:45:32 +00:00
endif ( )
2020-01-10 10:25:14 +00:00
elseif ( COMPILER_GCC )
2019-12-15 06:34:43 +00:00
# Add compiler options only to c++ compiler
function ( add_cxx_compile_options option )
2019-12-20 01:01:51 +00:00
add_compile_options ( "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${option}>" )
2019-12-15 06:34:43 +00:00
endfunction ( )
# Warn about boolean expression compared with an integer value different from true/false
add_cxx_compile_options ( -Wbool-compare )
# Warn whenever a pointer is cast such that the required alignment of the target is increased.
add_cxx_compile_options ( -Wcast-align )
# Warn whenever a pointer is cast so as to remove a type qualifier from the target type.
add_cxx_compile_options ( -Wcast-qual )
# Warn when deleting a pointer to incomplete type, which may cause undefined behavior at runtime
add_cxx_compile_options ( -Wdelete-incomplete )
# Warn if a requested optimization pass is disabled. Code is too big or too complex
add_cxx_compile_options ( -Wdisabled-optimization )
# Warn about duplicated conditions in an if-else-if chain
add_cxx_compile_options ( -Wduplicated-cond )
# Warn about a comparison between values of different enumerated types
add_cxx_compile_options ( -Wenum-compare )
# Warn about uninitialized variables that are initialized with themselves
add_cxx_compile_options ( -Winit-self )
# Warn about logical not used on the left hand side operand of a comparison
add_cxx_compile_options ( -Wlogical-not-parentheses )
# Warn about suspicious uses of logical operators in expressions
add_cxx_compile_options ( -Wlogical-op )
# Warn if there exists a path from the function entry to a use of the variable that is uninitialized.
add_cxx_compile_options ( -Wmaybe-uninitialized )
# Warn when the indentation of the code does not reflect the block structure
add_cxx_compile_options ( -Wmisleading-indentation )
2020-01-17 18:55:45 +00:00
# Warn if a global function is defined without a previous declaration - disabled because of build times
2019-12-19 01:02:01 +00:00
# add_cxx_compile_options(-Wmissing-declarations)
2019-12-15 06:34:43 +00:00
# Warn if a user-supplied include directory does not exist
2020-01-17 18:55:45 +00:00
add_cxx_compile_options ( -Wmissing-include-dirs )
2019-12-15 06:34:43 +00:00
# Obvious
add_cxx_compile_options ( -Wnon-virtual-dtor )
# Obvious
add_cxx_compile_options ( -Wno-return-local-addr )
2019-12-20 01:01:51 +00:00
# This warning is disabled due to false positives if compiled with libc++: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90037
#add_cxx_compile_options(-Wnull-dereference)
2019-12-15 06:34:43 +00:00
# Obvious
add_cxx_compile_options ( -Wodr )
# Obvious
add_cxx_compile_options ( -Wold-style-cast )
# Warn when a function declaration hides virtual functions from a base class
# add_cxx_compile_options(-Woverloaded-virtual)
# Warn about placement new expressions with undefined behavior
add_cxx_compile_options ( -Wplacement-new=2 )
# Warn about anything that depends on the “size of” a function type or of void
add_cxx_compile_options ( -Wpointer-arith )
# Warn if anything is declared more than once in the same scope
add_cxx_compile_options ( -Wredundant-decls )
# Member initialization reordering
add_cxx_compile_options ( -Wreorder )
# Obvious
add_cxx_compile_options ( -Wshadow )
# Warn if left shifting a negative value
add_cxx_compile_options ( -Wshift-negative-value )
# Warn about a definition of an unsized deallocation function
add_cxx_compile_options ( -Wsized-deallocation )
# Warn when the sizeof operator is applied to a parameter that is declared as an array in a function definition
add_cxx_compile_options ( -Wsizeof-array-argument )
# Warn for suspicious length parameters to certain string and memory built-in functions if the argument uses sizeof
add_cxx_compile_options ( -Wsizeof-pointer-memaccess )
2020-02-28 00:07:42 +00:00
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9 )
# Warn about overriding virtual functions that are not marked with the override keyword
add_cxx_compile_options ( -Wsuggest-override )
endif ( )
2019-12-15 06:34:43 +00:00
# Warn whenever a switch statement has an index of boolean type and the case values are outside the range of a boolean type
add_cxx_compile_options ( -Wswitch-bool )
# Warn if a self-comparison always evaluates to true or false
add_cxx_compile_options ( -Wtautological-compare )
# Warn about trampolines generated for pointers to nested functions
add_cxx_compile_options ( -Wtrampolines )
# Obvious
add_cxx_compile_options ( -Wunused )
# Warn if vector operation is not implemented via SIMD capabilities of the architecture
add_cxx_compile_options ( -Wvector-operation-performance )
endif ( )
2018-08-26 00:39:11 +00:00
2020-01-10 10:25:14 +00:00
if ( COMPILER_GCC )
2018-09-03 17:45:52 +00:00
# If we leave this optimization enabled, gcc-7 replaces a pair of SSE intrinsics (16 byte load, store) with a call to memcpy.
# It leads to slow code. This is compiler bug. It looks like this:
#
# (gdb) bt
#0 memcpy (destination=0x7faa6e9f1638, source=0x7faa81d9e9a8, size=16) at ../libs/libmemcpy/memcpy.h:11
#1 0x0000000005341c5f in _mm_storeu_si128 (__B=..., __P=<optimized out>) at /usr/lib/gcc/x86_64-linux-gnu/7/include/emmintrin.h:720
2020-04-03 15:14:31 +00:00
#2 memcpySmallAllowReadWriteOverflow15Impl (n=<optimized out>, src=<optimized out>, dst=<optimized out>) at ../src/Common/memcpySmall.h:37
2018-09-03 17:45:52 +00:00
add_definitions ( "-fno-tree-loop-distribute-patterns" )
endif ( )
2020-04-01 23:51:21 +00:00
add_subdirectory ( Access )
add_subdirectory ( Columns )
add_subdirectory ( Common )
add_subdirectory ( Core )
add_subdirectory ( DataStreams )
add_subdirectory ( DataTypes )
add_subdirectory ( Dictionaries )
add_subdirectory ( Disks )
add_subdirectory ( Storages )
add_subdirectory ( Parsers )
add_subdirectory ( IO )
add_subdirectory ( Functions )
add_subdirectory ( Interpreters )
add_subdirectory ( AggregateFunctions )
add_subdirectory ( Client )
add_subdirectory ( TableFunctions )
add_subdirectory ( Processors )
add_subdirectory ( Formats )
add_subdirectory ( Compression )
2016-12-07 14:58:31 +00:00
2016-12-06 20:55:13 +00:00
set ( dbms_headers )
set ( dbms_sources )
2016-12-07 14:58:31 +00:00
2020-04-01 23:51:21 +00:00
add_headers_and_sources ( clickhouse_common_io Common )
add_headers_and_sources ( clickhouse_common_io Common/HashTable )
add_headers_and_sources ( clickhouse_common_io IO )
list ( REMOVE_ITEM clickhouse_common_io_sources Common/malloc.cpp Common/new_delete.cpp )
2017-11-17 19:19:49 +00:00
2019-07-03 16:53:20 +00:00
if ( USE_RDKAFKA )
2020-04-01 23:51:21 +00:00
add_headers_and_sources ( dbms Storages/Kafka )
2019-07-03 16:53:20 +00:00
endif ( )
2017-11-21 19:17:24 +00:00
list ( APPEND clickhouse_common_io_sources ${ CONFIG_BUILD } )
list ( APPEND clickhouse_common_io_headers ${ CONFIG_VERSION } ${ CONFIG_COMMON } )
2017-03-14 13:47:39 +00:00
2020-04-01 23:51:21 +00:00
list ( APPEND dbms_sources Functions/IFunction.cpp Functions/FunctionFactory.cpp Functions/FunctionHelpers.cpp Functions/extractTimeZoneFromFunctionArguments.cpp )
list ( APPEND dbms_headers Functions/IFunctionImpl.h Functions/FunctionFactory.h Functions/FunctionHelpers.h Functions/extractTimeZoneFromFunctionArguments.h )
2017-06-10 09:04:31 +00:00
2017-05-05 20:39:25 +00:00
list ( APPEND dbms_sources
2020-04-01 23:51:21 +00:00
A g g r e g a t e F u n c t i o n s / A g g r e g a t e F u n c t i o n F a c t o r y . c p p
A g g r e g a t e F u n c t i o n s / A g g r e g a t e F u n c t i o n C o m b i n a t o r F a c t o r y . c p p
A g g r e g a t e F u n c t i o n s / A g g r e g a t e F u n c t i o n S t a t e . c p p
A g g r e g a t e F u n c t i o n s / p a r s e A g g r e g a t e F u n c t i o n P a r a m e t e r s . c p p )
2017-05-05 20:39:25 +00:00
list ( APPEND dbms_headers
2020-04-01 23:51:21 +00:00
A g g r e g a t e F u n c t i o n s / I A g g r e g a t e F u n c t i o n . h
A g g r e g a t e F u n c t i o n s / I A g g r e g a t e F u n c t i o n C o m b i n a t o r . h
A g g r e g a t e F u n c t i o n s / A g g r e g a t e F u n c t i o n F a c t o r y . h
A g g r e g a t e F u n c t i o n s / A g g r e g a t e F u n c t i o n C o m b i n a t o r F a c t o r y . h
A g g r e g a t e F u n c t i o n s / A g g r e g a t e F u n c t i o n S t a t e . h
A g g r e g a t e F u n c t i o n s / F a c t o r y H e l p e r s . h
A g g r e g a t e F u n c t i o n s / p a r s e A g g r e g a t e F u n c t i o n P a r a m e t e r s . h )
list ( APPEND dbms_sources TableFunctions/ITableFunction.cpp TableFunctions/TableFunctionFactory.cpp )
list ( APPEND dbms_headers TableFunctions/ITableFunction.h TableFunctions/TableFunctionFactory.h )
list ( APPEND dbms_sources Dictionaries/DictionaryFactory.cpp Dictionaries/DictionarySourceFactory.cpp Dictionaries/DictionaryStructure.cpp Dictionaries/getDictionaryConfigurationFromAST.cpp )
list ( APPEND dbms_headers Dictionaries/DictionaryFactory.h Dictionaries/DictionarySourceFactory.h Dictionaries/DictionaryStructure.h Dictionaries/getDictionaryConfigurationFromAST.h )
2017-05-05 20:39:25 +00:00
2019-09-15 10:35:12 +00:00
if ( NOT ENABLE_SSL )
2020-04-01 23:51:21 +00:00
list ( REMOVE_ITEM clickhouse_common_io_sources Common/OpenSSLHelpers.cpp )
list ( REMOVE_ITEM clickhouse_common_io_headers Common/OpenSSLHelpers.h )
2019-09-15 10:35:12 +00:00
endif ( )
2019-04-24 09:06:28 +00:00
add_library ( clickhouse_common_io ${ clickhouse_common_io_headers } ${ clickhouse_common_io_sources } )
2017-11-17 19:19:49 +00:00
2020-04-01 23:51:21 +00:00
add_library ( clickhouse_malloc OBJECT Common/malloc.cpp )
set_source_files_properties ( Common/malloc.cpp PROPERTIES COMPILE_FLAGS "-fno-builtin" )
2019-12-05 11:22:43 +00:00
2020-04-01 23:51:21 +00:00
add_library ( clickhouse_new_delete STATIC Common/new_delete.cpp )
2020-03-16 13:50:30 +00:00
target_link_libraries ( clickhouse_new_delete PRIVATE clickhouse_common_io jemalloc )
2019-09-30 11:58:32 +00:00
2018-08-05 08:54:57 +00:00
if ( OS_FREEBSD )
2018-02-27 17:17:02 +00:00
target_compile_definitions ( clickhouse_common_io PUBLIC CLOCK_MONOTONIC_COARSE=CLOCK_MONOTONIC_FAST )
endif ( )
2020-04-01 23:51:21 +00:00
add_subdirectory ( Common/ZooKeeper )
add_subdirectory ( Common/Config )
2018-01-15 19:07:47 +00:00
2019-08-22 03:24:05 +00:00
set ( all_modules )
macro ( add_object_library name common_path )
if ( MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES )
2019-10-22 03:54:16 +00:00
add_headers_and_sources ( dbms ${ common_path } )
2019-08-22 03:24:05 +00:00
else ( )
2019-09-11 02:53:56 +00:00
list ( APPEND all_modules ${ name } )
2019-10-22 03:54:16 +00:00
add_headers_and_sources ( ${ name } ${ common_path } )
2019-08-22 03:24:05 +00:00
add_library ( ${ name } SHARED ${ ${name } _sources} ${ ${name } _headers} )
2020-02-21 19:52:18 +00:00
target_link_libraries ( ${ name } PRIVATE -Wl,--unresolved-symbols=ignore-all )
2019-08-22 03:24:05 +00:00
endif ( )
endmacro ( )
2020-04-01 23:51:21 +00:00
add_object_library ( clickhouse_access Access )
add_object_library ( clickhouse_core Core )
add_object_library ( clickhouse_compression Compression )
add_object_library ( clickhouse_datastreams DataStreams )
add_object_library ( clickhouse_datatypes DataTypes )
add_object_library ( clickhouse_databases Databases )
add_object_library ( clickhouse_disks Disks )
add_object_library ( clickhouse_interpreters Interpreters )
add_object_library ( clickhouse_interpreters_clusterproxy Interpreters/ClusterProxy )
add_object_library ( clickhouse_columns Columns )
add_object_library ( clickhouse_storages Storages )
add_object_library ( clickhouse_storages_distributed Storages/Distributed )
add_object_library ( clickhouse_storages_mergetree Storages/MergeTree )
add_object_library ( clickhouse_storages_liveview Storages/LiveView )
add_object_library ( clickhouse_client Client )
add_object_library ( clickhouse_formats Formats )
add_object_library ( clickhouse_processors Processors )
add_object_library ( clickhouse_processors_executors Processors/Executors )
add_object_library ( clickhouse_processors_formats Processors/Formats )
add_object_library ( clickhouse_processors_formats_impl Processors/Formats/Impl )
add_object_library ( clickhouse_processors_transforms Processors/Transforms )
add_object_library ( clickhouse_processors_sources Processors/Sources )
2019-08-22 03:24:05 +00:00
2019-09-17 21:08:20 +00:00
2019-03-04 17:47:31 +00:00
if ( MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES )
2019-09-11 02:53:56 +00:00
add_library ( dbms STATIC ${ dbms_headers } ${ dbms_sources } )
2020-03-16 13:50:30 +00:00
target_link_libraries ( dbms PRIVATE jemalloc )
2019-09-11 02:53:56 +00:00
set ( all_modules dbms )
2019-08-22 03:24:05 +00:00
else ( )
2019-09-11 02:53:56 +00:00
add_library ( dbms SHARED ${ dbms_headers } ${ dbms_sources } )
2019-08-22 03:24:05 +00:00
target_link_libraries ( dbms PUBLIC ${ all_modules } )
2020-03-16 13:50:30 +00:00
target_link_libraries ( clickhouse_interpreters PRIVATE jemalloc )
2019-09-11 02:53:56 +00:00
list ( APPEND all_modules dbms )
# force all split libs to be linked
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed" )
2017-02-08 18:53:00 +00:00
endif ( )
2019-08-22 03:24:05 +00:00
macro ( dbms_target_include_directories )
foreach ( module ${ all_modules } )
target_include_directories ( ${ module } ${ ARGN } )
endforeach ( )
endmacro ( )
macro ( dbms_target_link_libraries )
foreach ( module ${ all_modules } )
target_link_libraries ( ${ module } ${ ARGN } )
endforeach ( )
endmacro ( )
2016-12-06 20:55:13 +00:00
Add a JIT interface for row-wise default-nullable functions.
Not actually implemented, though. It does print out some jit-compiled stuff,
but that's about it. For example, this query:
select number from system.numbers where something(cast(number as Float64)) == 4
results in this on server's stderr:
define double @"something(CAST(number, 'Float64'))"(void**, i8*, void*) {
"something(CAST(number, 'Float64'))":
ret double 1.234500e+04
}
(and an exception, because that's what the non-jitted method does.)
As one may notice, this function neither reads the input (first argument;
tuple of arrays) nor writes the output (third argument; array), instead
returning some general nonsense.
In addition, `#if USE_EMBEDDED_COMPILER` doesn't work for some reason,
including LLVM headers requires -Wno-unused-parameter, this probably only
works on LLVM 5.0 due to rampant API instability, and I'm definitely
no expert on CMake. In short, there's still a long way to go.
2018-04-23 22:29:39 +00:00
if ( USE_EMBEDDED_COMPILER )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ REQUIRED_LLVM_LIBRARIES } )
dbms_target_include_directories ( SYSTEM BEFORE PUBLIC ${ LLVM_INCLUDE_DIRS } )
Add a JIT interface for row-wise default-nullable functions.
Not actually implemented, though. It does print out some jit-compiled stuff,
but that's about it. For example, this query:
select number from system.numbers where something(cast(number as Float64)) == 4
results in this on server's stderr:
define double @"something(CAST(number, 'Float64'))"(void**, i8*, void*) {
"something(CAST(number, 'Float64'))":
ret double 1.234500e+04
}
(and an exception, because that's what the non-jitted method does.)
As one may notice, this function neither reads the input (first argument;
tuple of arrays) nor writes the output (third argument; array), instead
returning some general nonsense.
In addition, `#if USE_EMBEDDED_COMPILER` doesn't work for some reason,
including LLVM headers requires -Wno-unused-parameter, this probably only
works on LLVM 5.0 due to rampant API instability, and I'm definitely
no expert on CMake. In short, there's still a long way to go.
2018-04-23 22:29:39 +00:00
endif ( )
2017-10-25 18:39:10 +00:00
if ( CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO" OR CMAKE_BUILD_TYPE_UC STREQUAL "MINSIZEREL" )
2017-04-01 07:20:54 +00:00
# Won't generate debug info for files with heavy template instantiation to achieve faster linking and lower size.
set_source_files_properties (
2020-04-01 23:51:21 +00:00
D i c t i o n a r i e s / F l a t D i c t i o n a r y . c p p
D i c t i o n a r i e s / H a s h e d D i c t i o n a r y . c p p
D i c t i o n a r i e s / C a c h e D i c t i o n a r y . c p p
D i c t i o n a r i e s / T r i e D i c t i o n a r y . c p p
D i c t i o n a r i e s / R a n g e H a s h e d D i c t i o n a r y . c p p
D i c t i o n a r i e s / C o m p l e x K e y H a s h e d D i c t i o n a r y . c p p
D i c t i o n a r i e s / C o m p l e x K e y C a c h e D i c t i o n a r y . c p p
D i c t i o n a r i e s / C o m p l e x K e y C a c h e D i c t i o n a r y _ g e n e r a t e 1 . c p p
D i c t i o n a r i e s / C o m p l e x K e y C a c h e D i c t i o n a r y _ g e n e r a t e 2 . c p p
D i c t i o n a r i e s / C o m p l e x K e y C a c h e D i c t i o n a r y _ g e n e r a t e 3 . c p p
D i c t i o n a r i e s / O D B C B l o c k I n p u t S t r e a m . c p p
D i c t i o n a r i e s / H T T P D i c t i o n a r y S o u r c e . c p p
D i c t i o n a r i e s / L i b r a r y D i c t i o n a r y S o u r c e . c p p
D i c t i o n a r i e s / E x e c u t a b l e D i c t i o n a r y S o u r c e . c p p
D i c t i o n a r i e s / C l i c k H o u s e D i c t i o n a r y S o u r c e . c p p
2017-04-01 07:20:54 +00:00
P R O P E R T I E S C O M P I L E _ F L A G S - g 0 )
2016-12-01 22:44:59 +00:00
endif ( )
2016-03-12 05:53:04 +00:00
2019-08-03 15:43:37 +00:00
# Otherwise it will slow down stack traces printing too much.
set_source_files_properties (
2020-04-01 23:51:21 +00:00
C o m m o n / E l f . c p p
C o m m o n / D w a r f . c p p
C o m m o n / S y m b o l I n d e x . c p p
2019-08-03 15:43:37 +00:00
P R O P E R T I E S C O M P I L E _ F L A G S " - O 3 $ { W I T H O U T _ C O V E R A G E } " )
2017-11-21 19:17:24 +00:00
target_link_libraries ( clickhouse_common_io
2018-11-21 19:20:27 +00:00
P U B L I C
2017-04-01 07:20:54 +00:00
c o m m o n
2018-11-21 19:20:27 +00:00
P R I V A T E
2017-11-17 19:40:27 +00:00
s t r i n g _ u t i l s
2018-09-29 14:14:29 +00:00
w i d e c h a r _ w i d t h
2017-11-17 19:19:49 +00:00
$ { L I N K _ L I B R A R I E S _ O N L Y _ O N _ X 8 6 _ 6 4 }
2019-03-14 20:52:10 +00:00
P U B L I C
2017-08-09 20:52:55 +00:00
$ { D O U B L E _ C O N V E R S I O N _ L I B R A R I E S }
2020-01-06 03:22:11 +00:00
r y u
2018-11-21 19:20:27 +00:00
P U B L I C
2017-11-17 19:40:27 +00:00
$ { P o c o _ N e t _ L I B R A R Y }
2018-09-14 19:48:51 +00:00
$ { P o c o _ U t i l _ L I B R A R Y }
$ { P o c o _ F o u n d a t i o n _ L I B R A R Y }
2019-10-02 17:02:26 +00:00
$ { P o c o _ X M L _ L I B R A R Y }
2019-05-15 17:19:39 +00:00
)
if ( RE2_LIBRARY )
target_link_libraries ( clickhouse_common_io PUBLIC ${ RE2_LIBRARY } )
endif ( )
if ( RE2_ST_LIBRARY )
target_link_libraries ( clickhouse_common_io PUBLIC ${ RE2_ST_LIBRARY } )
endif ( )
target_link_libraries ( clickhouse_common_io
P U B L I C
2018-11-21 19:20:27 +00:00
$ { C I T Y H A S H _ L I B R A R I E S }
P R I V A T E
2019-10-05 19:25:31 +00:00
$ { P o c o _ X M L _ L I B R A R Y }
2018-01-15 18:57:10 +00:00
$ { Z L I B _ L I B R A R I E S }
2019-04-23 12:51:27 +00:00
$ { E X E C I N F O _ L I B R A R I E S }
2018-11-21 19:20:27 +00:00
P U B L I C
2018-01-15 18:57:10 +00:00
$ { B o o s t _ S Y S T E M _ L I B R A R Y }
2019-08-26 19:16:28 +00:00
$ { B o o s t _ P R O G R A M _ O P T I O N S _ L I B R A R Y }
2019-01-28 18:21:20 +00:00
P U B L I C
2019-03-06 00:44:25 +00:00
r o a r i n g
2017-11-17 19:19:49 +00:00
)
2019-07-03 16:53:20 +00:00
if ( USE_RDKAFKA )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ CPPKAFKA_LIBRARY } ${ RDKAFKA_LIBRARY } )
2019-07-03 16:53:20 +00:00
if ( NOT USE_INTERNAL_RDKAFKA_LIBRARY )
2019-08-22 03:24:05 +00:00
dbms_target_include_directories ( SYSTEM BEFORE PRIVATE ${ RDKAFKA_INCLUDE_DIR } )
2019-07-03 16:53:20 +00:00
endif ( )
endif ( )
2019-02-02 13:52:20 +00:00
2019-05-15 17:19:39 +00:00
if ( RE2_INCLUDE_DIR )
target_include_directories ( clickhouse_common_io SYSTEM BEFORE PUBLIC ${ RE2_INCLUDE_DIR } )
endif ( )
2019-01-31 16:48:37 +00:00
2019-01-28 13:16:08 +00:00
if ( CPUID_LIBRARY )
target_link_libraries ( clickhouse_common_io PRIVATE ${ CPUID_LIBRARY } )
endif ( )
if ( CPUINFO_LIBRARY )
target_link_libraries ( clickhouse_common_io PRIVATE ${ CPUINFO_LIBRARY } )
2018-12-28 18:15:26 +00:00
endif ( )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries (
2019-03-28 11:06:28 +00:00
P R I V A T E
2017-11-21 19:17:24 +00:00
c l i c k h o u s e _ p a r s e r s
2018-02-28 20:34:25 +00:00
c l i c k h o u s e _ c o m m o n _ c o n f i g
2019-07-03 16:53:20 +00:00
c l i c k h o u s e _ c o m m o n _ z o o k e e p e r
s t r i n g _ u t i l s # FIXME: not sure if it's private
2018-11-21 19:20:27 +00:00
P U B L I C
2017-11-24 13:55:31 +00:00
c l i c k h o u s e _ c o m m o n _ i o
2018-11-28 11:37:12 +00:00
P R I V A T E
c l i c k h o u s e _ d i c t i o n a r i e s _ e m b e d d e d
2019-07-09 21:37:43 +00:00
$ { L Z 4 _ L I B R A R Y }
2018-11-21 19:20:27 +00:00
P U B L I C
2017-11-17 19:19:49 +00:00
$ { M Y S Q L X X _ L I B R A R Y }
2018-11-21 19:20:27 +00:00
P R I V A T E
2017-08-09 20:52:55 +00:00
$ { B T R I E _ L I B R A R I E S }
2018-08-20 15:34:37 +00:00
$ { B o o s t _ P R O G R A M _ O P T I O N S _ L I B R A R Y }
2019-07-03 16:53:20 +00:00
$ { B o o s t _ F I L E S Y S T E M _ L I B R A R Y }
2018-11-21 19:20:27 +00:00
P U B L I C
$ { B o o s t _ S Y S T E M _ L I B R A R Y }
2017-03-28 20:30:57 +00:00
)
2020-04-01 23:51:21 +00:00
target_include_directories ( clickhouse_common_io PUBLIC ${ CMAKE_CURRENT_BINARY_DIR } /Core/include ) # uses some includes from core
dbms_target_include_directories ( PUBLIC ${ CMAKE_CURRENT_BINARY_DIR } /Core/include )
2019-08-22 03:24:05 +00:00
target_include_directories ( clickhouse_common_io SYSTEM PUBLIC ${ PCG_RANDOM_INCLUDE_DIR } )
dbms_target_include_directories ( SYSTEM PUBLIC ${ PCG_RANDOM_INCLUDE_DIR } )
dbms_target_include_directories ( SYSTEM BEFORE PUBLIC ${ PDQSORT_INCLUDE_DIR } )
2019-07-09 21:37:43 +00:00
2019-10-05 19:25:31 +00:00
if ( NOT USE_INTERNAL_LZ4_LIBRARY AND LZ4_INCLUDE_DIR )
2019-08-22 03:24:05 +00:00
dbms_target_include_directories ( SYSTEM BEFORE PRIVATE ${ LZ4_INCLUDE_DIR } )
2019-07-09 21:37:43 +00:00
endif ( )
2019-08-04 00:19:03 +00:00
if ( ZSTD_LIBRARY )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ ZSTD_LIBRARY } )
if ( NOT USE_INTERNAL_ZSTD_LIBRARY AND ZSTD_INCLUDE_DIR )
dbms_target_include_directories ( SYSTEM BEFORE PRIVATE ${ ZSTD_INCLUDE_DIR } )
endif ( )
2019-08-04 00:19:03 +00:00
endif ( )
2019-07-09 21:37:43 +00:00
2018-01-15 18:57:10 +00:00
if ( NOT USE_INTERNAL_BOOST_LIBRARY )
2018-06-06 20:21:58 +00:00
target_include_directories ( clickhouse_common_io SYSTEM BEFORE PUBLIC ${ Boost_INCLUDE_DIRS } )
2018-01-15 18:57:10 +00:00
endif ( )
2018-09-14 19:48:51 +00:00
if ( Poco_SQL_FOUND AND NOT USE_INTERNAL_POCO_LIBRARY )
target_include_directories ( clickhouse_common_io SYSTEM PRIVATE ${ Poco_SQL_INCLUDE_DIR } )
2019-08-22 03:24:05 +00:00
dbms_target_include_directories ( SYSTEM PRIVATE ${ Poco_SQL_INCLUDE_DIR } )
2018-09-14 19:48:51 +00:00
endif ( )
2018-05-14 18:36:01 +00:00
if ( USE_POCO_SQLODBC )
2018-11-21 19:20:27 +00:00
target_link_libraries ( clickhouse_common_io PRIVATE ${ Poco_SQL_LIBRARY } )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ Poco_SQLODBC_LIBRARY } ${ Poco_SQL_LIBRARY } )
2018-04-06 12:07:40 +00:00
if ( NOT USE_INTERNAL_POCO_LIBRARY )
2019-04-24 21:33:04 +00:00
target_include_directories ( clickhouse_common_io SYSTEM PRIVATE ${ ODBC_INCLUDE_DIRS } ${ Poco_SQL_INCLUDE_DIR } )
2019-08-22 03:24:05 +00:00
dbms_target_include_directories ( SYSTEM PRIVATE ${ ODBC_INCLUDE_DIRS } ${ Poco_SQLODBC_INCLUDE_DIR } SYSTEM PUBLIC ${ Poco_SQL_INCLUDE_DIR } )
2018-04-06 12:07:40 +00:00
endif ( )
endif ( )
2018-09-14 19:48:51 +00:00
if ( Poco_Data_FOUND )
target_include_directories ( clickhouse_common_io SYSTEM PRIVATE ${ Poco_Data_INCLUDE_DIR } )
2019-08-22 03:24:05 +00:00
dbms_target_include_directories ( SYSTEM PRIVATE ${ Poco_Data_INCLUDE_DIR } )
2018-04-03 11:48:40 +00:00
endif ( )
2018-05-14 18:36:01 +00:00
if ( USE_POCO_DATAODBC )
2018-11-21 19:20:27 +00:00
target_link_libraries ( clickhouse_common_io PRIVATE ${ Poco_Data_LIBRARY } )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ Poco_DataODBC_LIBRARY } )
2018-04-06 12:07:40 +00:00
if ( NOT USE_INTERNAL_POCO_LIBRARY )
2019-08-22 03:24:05 +00:00
dbms_target_include_directories ( SYSTEM PRIVATE ${ ODBC_INCLUDE_DIRS } ${ Poco_DataODBC_INCLUDE_DIR } )
2018-04-06 12:07:40 +00:00
endif ( )
2017-03-28 20:30:57 +00:00
endif ( )
2018-05-14 18:36:01 +00:00
if ( USE_POCO_MONGODB )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ Poco_MongoDB_LIBRARY } )
2017-03-28 20:30:57 +00:00
endif ( )
2019-11-19 08:56:18 +00:00
if ( USE_POCO_REDIS )
2019-11-19 08:50:57 +00:00
dbms_target_link_libraries ( PRIVATE ${ Poco_Redis_LIBRARY } )
endif ( )
2018-05-14 18:36:01 +00:00
if ( USE_POCO_NETSSL )
2018-11-21 19:20:27 +00:00
target_link_libraries ( clickhouse_common_io PRIVATE ${ Poco_NetSSL_LIBRARY } ${ Poco_Crypto_LIBRARY } )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ Poco_NetSSL_LIBRARY } ${ Poco_Crypto_LIBRARY } )
2017-03-28 20:30:57 +00:00
endif ( )
2020-01-10 22:46:48 +00:00
if ( USE_POCO_JSON )
dbms_target_link_libraries ( PRIVATE ${ Poco_JSON_LIBRARY } )
endif ( )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ Poco_Foundation_LIBRARY } )
2017-04-23 19:17:51 +00:00
if ( USE_ICU )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ ICU_LIBRARIES } )
dbms_target_include_directories ( SYSTEM PRIVATE ${ ICU_INCLUDE_DIRS } )
2017-04-23 19:17:51 +00:00
endif ( )
2017-10-04 00:00:22 +00:00
if ( USE_CAPNP )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ CAPNP_LIBRARIES } )
2018-01-11 18:39:52 +00:00
endif ( )
2018-10-01 16:44:55 +00:00
if ( USE_PARQUET )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ PARQUET_LIBRARY } )
2019-02-19 20:51:44 +00:00
if ( NOT USE_INTERNAL_PARQUET_LIBRARY OR USE_INTERNAL_PARQUET_LIBRARY_NATIVE_CMAKE )
2019-08-22 03:24:05 +00:00
dbms_target_include_directories ( SYSTEM BEFORE PRIVATE ${ PARQUET_INCLUDE_DIR } ${ ARROW_INCLUDE_DIR } )
2018-10-01 16:44:55 +00:00
endif ( )
endif ( )
2018-05-05 16:21:59 +00:00
2020-01-08 09:13:12 +00:00
if ( USE_AVRO )
dbms_target_link_libraries ( PRIVATE ${ AVROCPP_LIBRARY } )
dbms_target_include_directories ( SYSTEM BEFORE PRIVATE ${ AVROCPP_INCLUDE_DIR } )
endif ( )
2019-08-22 03:24:05 +00:00
if ( OPENSSL_CRYPTO_LIBRARY )
2019-09-11 02:53:56 +00:00
dbms_target_link_libraries ( PRIVATE ${ OPENSSL_CRYPTO_LIBRARY } )
target_link_libraries ( clickhouse_common_io PRIVATE ${ OPENSSL_CRYPTO_LIBRARY } )
2019-03-22 11:18:24 +00:00
endif ( )
2017-02-22 14:34:36 +00:00
2019-08-22 03:24:05 +00:00
dbms_target_include_directories ( SYSTEM BEFORE PRIVATE ${ DIVIDE_INCLUDE_DIR } )
2019-09-17 21:08:20 +00:00
dbms_target_include_directories ( SYSTEM BEFORE PRIVATE ${ SPARSEHASH_INCLUDE_DIR } )
2018-12-05 13:24:45 +00:00
2019-01-25 20:02:03 +00:00
if ( USE_PROTOBUF )
2019-08-22 03:24:05 +00:00
dbms_target_link_libraries ( PRIVATE ${ Protobuf_LIBRARY } )
dbms_target_include_directories ( SYSTEM BEFORE PRIVATE ${ Protobuf_INCLUDE_DIR } )
2019-01-25 20:02:03 +00:00
endif ( )
2019-01-23 19:19:23 +00:00
2018-12-05 13:24:45 +00:00
if ( USE_HDFS )
2019-07-24 09:51:02 +00:00
target_link_libraries ( clickhouse_common_io PUBLIC ${ HDFS3_LIBRARY } )
target_include_directories ( clickhouse_common_io SYSTEM BEFORE PUBLIC ${ HDFS3_INCLUDE_DIR } )
2018-12-05 13:24:45 +00:00
endif ( )
2017-10-13 20:52:42 +00:00
2019-12-03 16:23:24 +00:00
if ( USE_AWS_S3 )
target_link_libraries ( clickhouse_common_io PUBLIC ${ AWS_S3_LIBRARY } )
target_include_directories ( clickhouse_common_io SYSTEM BEFORE PUBLIC ${ AWS_S3_CORE_INCLUDE_DIR } )
target_include_directories ( clickhouse_common_io SYSTEM BEFORE PUBLIC ${ AWS_S3_INCLUDE_DIR } )
endif ( )
2019-02-02 13:33:50 +00:00
if ( USE_BROTLI )
target_link_libraries ( clickhouse_common_io PRIVATE ${ BROTLI_LIBRARY } )
target_include_directories ( clickhouse_common_io SYSTEM BEFORE PRIVATE ${ BROTLI_INCLUDE_DIR } )
endif ( )
2020-01-17 18:55:45 +00:00
dbms_target_include_directories ( PUBLIC ${ DBMS_INCLUDE_DIR } )
2017-11-21 19:17:24 +00:00
target_include_directories ( clickhouse_common_io PUBLIC ${ DBMS_INCLUDE_DIR } )
2019-08-22 03:24:05 +00:00
2018-06-06 20:21:58 +00:00
target_include_directories ( clickhouse_common_io SYSTEM BEFORE PUBLIC ${ DOUBLE_CONVERSION_INCLUDE_DIR } )
2017-10-14 00:53:01 +00:00
2019-01-25 20:02:03 +00:00
if ( ENABLE_TESTS AND USE_GTEST )
2018-08-26 01:41:08 +00:00
macro ( grep_gtest_sources BASE_DIR DST_VAR )
2018-01-09 17:27:02 +00:00
# Cold match files that are not in tests/ directories
file ( GLOB_RECURSE "${DST_VAR}" RELATIVE "${BASE_DIR}" "gtest*.cpp" )
endmacro ( )
2017-04-01 07:20:54 +00:00
# attach all dbms gtest sources
grep_gtest_sources ( ${ ClickHouse_SOURCE_DIR } /dbms dbms_gtest_sources )
add_executable ( unit_tests_dbms ${ dbms_gtest_sources } )
2019-07-08 01:58:15 +00:00
# gtest framework has substandard code
2020-01-11 13:09:07 +00:00
target_compile_options ( unit_tests_dbms PRIVATE
- W n o - z e r o - a s - n u l l - p o i n t e r - c o n s t a n t
- W n o - u n d e f
- W n o - s i g n - c o m p a r e
- W n o - u s e d - b u t - m a r k e d - u n u s e d
- W n o - m i s s i n g - n o r e t u r n
- W n o - g n u - z e r o - v a r i a d i c - m a c r o - a r g u m e n t s
)
2019-07-08 01:58:15 +00:00
2019-06-20 07:17:21 +00:00
target_link_libraries ( unit_tests_dbms PRIVATE ${ GTEST_BOTH_LIBRARIES } clickhouse_functions clickhouse_parsers dbms clickhouse_common_zookeeper string_utils )
2017-04-01 07:20:54 +00:00
add_check ( unit_tests_dbms )
2017-04-10 17:43:30 +00:00
endif ( )