2017-09-10 06:51:27 +00:00
|
|
|
if (USE_INCLUDE_WHAT_YOU_USE)
|
|
|
|
set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_PATH})
|
|
|
|
endif ()
|
|
|
|
|
2017-03-14 15:57:27 +00:00
|
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/find_vectorclass.cmake)
|
2017-03-14 13:47:39 +00:00
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/src/Common/config_version.h)
|
|
|
|
set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/src/Common/config.h)
|
2017-03-14 13:47:39 +00:00
|
|
|
set (CONFIG_BUILD ${CMAKE_CURRENT_BINARY_DIR}/src/Common/config_build.cpp)
|
|
|
|
|
|
|
|
include (cmake/version.cmake)
|
|
|
|
message (STATUS "Will build ${VERSION_FULL}")
|
2017-04-01 09:19:00 +00:00
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/Common/config.h.in ${CONFIG_COMMON})
|
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/Common/config_version.h.in ${CONFIG_VERSION})
|
2017-03-14 13:47:39 +00:00
|
|
|
|
|
|
|
get_property (BUILD_COMPILE_DEFINITIONS DIRECTORY ${ClickHouse_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
|
|
|
|
get_property (BUILD_INCLUDE_DIRECTORIES DIRECTORY ${ClickHouse_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
|
|
|
string (TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
|
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/Common/config_build.cpp.in ${CONFIG_BUILD})
|
|
|
|
|
2017-12-02 03:39:38 +00:00
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
2017-12-01 17:49:12 +00:00
|
|
|
|
2017-01-19 19:30:58 +00:00
|
|
|
if (NOT NO_WERROR)
|
2017-04-01 07:20:54 +00:00
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
2017-01-19 19:30:58 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-02-28 23:49:04 +00:00
|
|
|
find_package (Threads)
|
|
|
|
|
2017-01-18 15:09:10 +00:00
|
|
|
add_subdirectory (src)
|
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
|
|
|
|
2016-12-13 11:09:22 +00:00
|
|
|
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
|
2017-11-17 19:19:49 +00:00
|
|
|
|
2017-11-21 19:17:24 +00:00
|
|
|
add_headers_and_sources(clickhouse_common_io src/Common)
|
|
|
|
add_headers_and_sources(clickhouse_common_io src/Common/HashTable)
|
|
|
|
add_headers_and_sources(clickhouse_common_io src/IO)
|
2017-11-17 19:19:49 +00:00
|
|
|
|
2017-04-03 19:57:07 +00:00
|
|
|
add_headers_and_sources(dbms src/Analyzers)
|
|
|
|
add_headers_and_sources(dbms src/Core)
|
|
|
|
add_headers_and_sources(dbms src/DataStreams)
|
|
|
|
add_headers_and_sources(dbms src/DataTypes)
|
|
|
|
add_headers_and_sources(dbms src/Databases)
|
|
|
|
add_headers_and_sources(dbms src/Dictionaries)
|
|
|
|
add_headers_and_sources(dbms src/Dictionaries/Embedded)
|
2017-11-28 22:15:06 +00:00
|
|
|
add_headers_and_sources(dbms src/Dictionaries/Embedded/GeodataProviders)
|
2017-04-03 19:57:07 +00:00
|
|
|
add_headers_and_sources(dbms src/Interpreters)
|
|
|
|
add_headers_and_sources(dbms src/Interpreters/ClusterProxy)
|
|
|
|
add_headers_and_sources(dbms src/Columns)
|
|
|
|
add_headers_and_sources(dbms src/Storages)
|
|
|
|
add_headers_and_sources(dbms src/Storages/Distributed)
|
|
|
|
add_headers_and_sources(dbms src/Storages/MergeTree)
|
|
|
|
add_headers_and_sources(dbms src/Client)
|
|
|
|
add_headers_only(dbms src/Server)
|
2016-12-06 20:55:13 +00:00
|
|
|
|
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
|
|
|
|
2017-07-25 18:20:50 +00:00
|
|
|
list (APPEND dbms_sources src/Functions/IFunction.cpp src/Functions/FunctionFactory.cpp src/Functions/FunctionHelpers.cpp)
|
2017-07-25 18:32:52 +00:00
|
|
|
list (APPEND dbms_headers src/Functions/IFunction.h src/Functions/FunctionFactory.h src/Functions/FunctionHelpers.h)
|
2017-06-10 09:04:31 +00:00
|
|
|
|
2017-05-05 20:39:25 +00:00
|
|
|
list (APPEND dbms_sources
|
|
|
|
src/AggregateFunctions/AggregateFunctionFactory.cpp
|
2017-12-24 06:50:11 +00:00
|
|
|
src/AggregateFunctions/AggregateFunctionCombinatorFactory.cpp
|
2017-12-24 10:12:49 +00:00
|
|
|
src/AggregateFunctions/AggregateFunctionState.cpp
|
2017-12-20 20:25:22 +00:00
|
|
|
src/AggregateFunctions/FactoryHelpers.cpp
|
2017-07-25 18:32:52 +00:00
|
|
|
src/AggregateFunctions/parseAggregateFunctionParameters.cpp)
|
2017-05-05 20:39:25 +00:00
|
|
|
|
|
|
|
list (APPEND dbms_headers
|
|
|
|
src/AggregateFunctions/IAggregateFunction.h
|
2017-12-24 06:50:11 +00:00
|
|
|
src/AggregateFunctions/IAggregateFunctionCombinator.h
|
2017-05-05 20:39:25 +00:00
|
|
|
src/AggregateFunctions/AggregateFunctionFactory.h
|
2017-12-24 06:50:11 +00:00
|
|
|
src/AggregateFunctions/AggregateFunctionCombinatorFactory.h
|
2017-12-24 10:12:49 +00:00
|
|
|
src/AggregateFunctions/AggregateFunctionState.h
|
2017-12-20 20:25:22 +00:00
|
|
|
src/AggregateFunctions/FactoryHelpers.h
|
2017-07-25 18:32:52 +00:00
|
|
|
src/AggregateFunctions/parseAggregateFunctionParameters.h)
|
2017-06-10 09:04:31 +00:00
|
|
|
|
|
|
|
list (APPEND dbms_sources src/TableFunctions/TableFunctionFactory.cpp)
|
|
|
|
list (APPEND dbms_headers src/TableFunctions/ITableFunction.h src/TableFunctions/TableFunctionFactory.h)
|
2017-05-05 20:39:25 +00:00
|
|
|
|
2017-11-21 19:17:24 +00:00
|
|
|
add_library(clickhouse_common_io ${SPLIT_SHARED} ${clickhouse_common_io_headers} ${clickhouse_common_io_sources})
|
2017-11-17 19:19:49 +00:00
|
|
|
|
2018-02-27 17:17:02 +00:00
|
|
|
if (ARCH_FREEBSD)
|
|
|
|
target_compile_definitions (clickhouse_common_io PUBLIC CLOCK_MONOTONIC_COARSE=CLOCK_MONOTONIC_FAST)
|
|
|
|
endif ()
|
|
|
|
|
2018-01-15 19:07:47 +00:00
|
|
|
add_subdirectory(src/Common/ZooKeeper)
|
2018-02-28 20:34:25 +00:00
|
|
|
add_subdirectory(src/Common/Config)
|
2018-01-15 19:07:47 +00:00
|
|
|
|
2017-03-27 12:26:24 +00:00
|
|
|
if (MAKE_STATIC_LIBRARIES)
|
2017-04-01 07:20:54 +00:00
|
|
|
add_library(dbms ${dbms_headers} ${dbms_sources})
|
2017-02-08 18:53:00 +00:00
|
|
|
else ()
|
2017-04-01 07:20:54 +00:00
|
|
|
add_library(dbms SHARED ${dbms_headers} ${dbms_sources})
|
|
|
|
set_target_properties (dbms PROPERTIES SOVERSION ${VERSION_MAJOR} VERSION ${VERSION_SO} OUTPUT_NAME clickhouse)
|
2017-04-10 17:43:30 +00:00
|
|
|
install (TARGETS dbms LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT clickhouse)
|
2017-02-08 18:53:00 +00:00
|
|
|
endif ()
|
2016-12-06 20:55:13 +00:00
|
|
|
|
|
|
|
|
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(
|
|
|
|
src/Dictionaries/FlatDictionary.cpp
|
|
|
|
src/Dictionaries/HashedDictionary.cpp
|
|
|
|
src/Dictionaries/CacheDictionary.cpp
|
2017-05-12 21:23:12 +00:00
|
|
|
src/Dictionaries/TrieDictionary.cpp
|
2017-04-01 07:20:54 +00:00
|
|
|
src/Dictionaries/RangeHashedDictionary.cpp
|
|
|
|
src/Dictionaries/ComplexKeyHashedDictionary.cpp
|
|
|
|
src/Dictionaries/ComplexKeyCacheDictionary.cpp
|
2017-10-24 13:30:44 +00:00
|
|
|
src/Dictionaries/ComplexKeyCacheDictionary_generate1.cpp
|
|
|
|
src/Dictionaries/ComplexKeyCacheDictionary_generate2.cpp
|
|
|
|
src/Dictionaries/ComplexKeyCacheDictionary_generate3.cpp
|
|
|
|
src/Dictionaries/ODBCBlockInputStream.cpp
|
|
|
|
src/Dictionaries/HTTPDictionarySource.cpp
|
|
|
|
src/Dictionaries/LibraryDictionarySource.cpp
|
|
|
|
src/Dictionaries/ExecutableDictionarySource.cpp
|
|
|
|
src/Dictionaries/ClickHouseDictionarySource.cpp
|
2017-04-01 07:20:54 +00:00
|
|
|
PROPERTIES COMPILE_FLAGS -g0)
|
2016-12-01 22:44:59 +00:00
|
|
|
endif ()
|
2016-03-12 05:53:04 +00:00
|
|
|
|
2017-08-09 20:52:55 +00:00
|
|
|
if (NOT ARCH_ARM)
|
2017-04-01 07:20:54 +00:00
|
|
|
set (LINK_LIBRARIES_ONLY_ON_X86_64 cpuid)
|
2016-12-07 14:58:31 +00:00
|
|
|
endif()
|
|
|
|
|
2017-11-21 19:17:24 +00:00
|
|
|
target_link_libraries (clickhouse_common_io
|
2017-04-01 07:20:54 +00:00
|
|
|
common
|
2017-11-17 19:40:27 +00:00
|
|
|
string_utils
|
2017-11-17 19:19:49 +00:00
|
|
|
${LINK_LIBRARIES_ONLY_ON_X86_64}
|
2017-04-01 07:20:54 +00:00
|
|
|
${LZ4_LIBRARY}
|
|
|
|
${ZSTD_LIBRARY}
|
2017-06-19 20:06:35 +00:00
|
|
|
${ZOOKEEPER_LIBRARY}
|
2017-08-09 20:52:55 +00:00
|
|
|
${DOUBLE_CONVERSION_LIBRARIES}
|
2017-11-17 19:40:27 +00:00
|
|
|
${Poco_Net_LIBRARY}
|
2017-12-27 21:45:05 +00:00
|
|
|
${Poco_Data_LIBRARY}
|
2018-01-15 18:57:10 +00:00
|
|
|
${ZLIB_LIBRARIES}
|
2017-12-13 19:07:12 +00:00
|
|
|
${EXECINFO_LIBRARY}
|
2018-01-15 18:57:10 +00:00
|
|
|
${Boost_SYSTEM_LIBRARY}
|
2018-01-20 02:35:16 +00:00
|
|
|
${CMAKE_DL_LIBS}
|
2017-11-17 19:19:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries (dbms
|
2017-11-21 19:17:24 +00:00
|
|
|
clickhouse_parsers
|
2018-02-28 20:34:25 +00:00
|
|
|
clickhouse_common_config
|
2017-11-24 13:55:31 +00:00
|
|
|
clickhouse_common_io
|
2017-11-17 19:19:49 +00:00
|
|
|
${MYSQLXX_LIBRARY}
|
|
|
|
${FARMHASH_LIBRARIES}
|
|
|
|
${METROHASH_LIBRARIES}
|
2017-04-01 07:20:54 +00:00
|
|
|
${RE2_LIBRARY}
|
|
|
|
${RE2_ST_LIBRARY}
|
|
|
|
${OPENSSL_CRYPTO_LIBRARY}
|
2017-08-09 20:52:55 +00:00
|
|
|
${BTRIE_LIBRARIES}
|
2017-03-28 20:30:57 +00:00
|
|
|
)
|
|
|
|
|
2018-01-11 18:39:52 +00:00
|
|
|
if (NOT USE_INTERNAL_RE2_LIBRARY)
|
|
|
|
target_include_directories (dbms BEFORE PRIVATE ${RE2_INCLUDE_DIR})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (NOT USE_INTERNAL_ZOOKEEPER_LIBRARY)
|
|
|
|
target_include_directories (clickhouse_common_io BEFORE PUBLIC ${ZOOKEEPER_INCLUDE_DIR})
|
|
|
|
endif ()
|
|
|
|
|
2018-01-15 18:57:10 +00:00
|
|
|
if (NOT USE_INTERNAL_BOOST_LIBRARY)
|
|
|
|
target_include_directories (clickhouse_common_io BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
|
|
|
|
endif ()
|
|
|
|
|
2017-03-28 20:30:57 +00:00
|
|
|
if (Poco_DataODBC_FOUND)
|
2017-04-01 07:20:54 +00:00
|
|
|
target_link_libraries (dbms ${Poco_DataODBC_LIBRARY})
|
2018-02-26 18:34:22 +00:00
|
|
|
target_include_directories (dbms PRIVATE ${ODBC_INCLUDE_DIRECTORIES})
|
2017-03-28 20:30:57 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (Poco_MongoDB_FOUND)
|
2017-04-01 07:20:54 +00:00
|
|
|
target_link_libraries (dbms ${Poco_MongoDB_LIBRARY})
|
2017-03-28 20:30:57 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (Poco_NetSSL_FOUND)
|
2017-11-21 19:17:24 +00:00
|
|
|
target_link_libraries (clickhouse_common_io ${Poco_NetSSL_LIBRARY})
|
2017-03-28 20:30:57 +00:00
|
|
|
endif()
|
|
|
|
|
2017-04-23 19:17:51 +00:00
|
|
|
target_link_libraries (dbms ${Poco_Foundation_LIBRARY})
|
|
|
|
|
|
|
|
if (USE_ICU)
|
|
|
|
target_link_libraries (dbms ${ICU_LIBS})
|
2018-01-11 18:39:52 +00:00
|
|
|
target_include_directories (dbms PRIVATE ${ICU_INCLUDE_DIR})
|
2017-04-23 19:17:51 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-10-04 00:00:22 +00:00
|
|
|
if (USE_CAPNP)
|
2018-01-11 18:39:52 +00:00
|
|
|
target_link_libraries (dbms ${CAPNP_LIBRARY})
|
|
|
|
if (NOT USE_INTERNAL_CAPNP_LIBRARY)
|
|
|
|
target_include_directories (dbms BEFORE PRIVATE ${CAPNP_INCLUDE_DIR})
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (USE_RDKAFKA)
|
|
|
|
target_link_libraries (dbms ${RDKAFKA_LIBRARY})
|
|
|
|
if (NOT USE_INTERNAL_RDKAFKA_LIBRARY)
|
|
|
|
target_include_directories (dbms BEFORE PRIVATE ${RDKAFKA_INCLUDE_DIR})
|
|
|
|
endif ()
|
2017-10-04 00:00:22 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-03-28 20:30:57 +00:00
|
|
|
target_link_libraries (dbms
|
2017-11-24 13:55:31 +00:00
|
|
|
Threads::Threads
|
2017-02-22 14:34:36 +00:00
|
|
|
)
|
|
|
|
|
2017-08-09 20:52:55 +00:00
|
|
|
target_include_directories (dbms BEFORE PRIVATE ${DIVIDE_INCLUDE_DIR})
|
2017-08-09 23:11:28 +00:00
|
|
|
target_include_directories (dbms BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR})
|
2017-10-13 20:52:42 +00:00
|
|
|
|
2017-10-13 18:52:23 +00:00
|
|
|
if (NOT USE_INTERNAL_LZ4_LIBRARY)
|
|
|
|
target_include_directories (dbms BEFORE PRIVATE ${LZ4_INCLUDE_DIR})
|
|
|
|
endif ()
|
|
|
|
if (NOT USE_INTERNAL_ZSTD_LIBRARY)
|
|
|
|
target_include_directories (dbms BEFORE PRIVATE ${ZSTD_INCLUDE_DIR})
|
|
|
|
endif ()
|
2017-10-13 20:52:42 +00:00
|
|
|
|
2017-06-23 20:22:35 +00:00
|
|
|
target_include_directories (dbms PUBLIC ${DBMS_INCLUDE_DIR})
|
2017-11-21 19:17:24 +00:00
|
|
|
target_include_directories (clickhouse_common_io PUBLIC ${DBMS_INCLUDE_DIR})
|
|
|
|
target_include_directories (clickhouse_common_io PUBLIC ${PCG_RANDOM_INCLUDE_DIR})
|
|
|
|
target_include_directories (clickhouse_common_io BEFORE PUBLIC ${DOUBLE_CONVERSION_INCLUDE_DIR})
|
2017-10-14 00:53:01 +00:00
|
|
|
|
2017-11-17 19:19:49 +00:00
|
|
|
# also for copy_headers.sh:
|
2017-11-21 19:17:24 +00:00
|
|
|
target_include_directories (clickhouse_common_io BEFORE PRIVATE ${COMMON_INCLUDE_DIR})
|
2017-08-09 20:52:55 +00:00
|
|
|
|
2017-12-27 19:01:57 +00:00
|
|
|
add_subdirectory (tests)
|
|
|
|
|
2017-03-22 16:59:02 +00:00
|
|
|
if (ENABLE_TESTS)
|
2018-01-20 02:35:16 +00:00
|
|
|
include (${ClickHouse_SOURCE_DIR}/cmake/find_gtest.cmake)
|
2018-01-09 17:27:02 +00:00
|
|
|
|
|
|
|
if (USE_INTERNAL_GTEST_LIBRARY)
|
|
|
|
# Google Test from sources
|
|
|
|
add_subdirectory(${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest ${CMAKE_CURRENT_BINARY_DIR}/googletest)
|
|
|
|
# avoid problems with <regexp.h>
|
|
|
|
target_compile_definitions (gtest INTERFACE GTEST_HAS_POSIX_RE=0)
|
|
|
|
target_include_directories (gtest INTERFACE ${ClickHouse_SOURCE_DIR}/contrib/googletest/include)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
macro(grep_gtest_sources BASE_DIR DST_VAR)
|
|
|
|
# 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})
|
|
|
|
target_link_libraries(unit_tests_dbms gtest_main dbms)
|
|
|
|
add_check(unit_tests_dbms)
|
2017-04-10 17:43:30 +00:00
|
|
|
endif ()
|