2020-05-18 01:19:50 +00:00
if ( USE_CLANG_TIDY )
set ( CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}" )
endif ( )
2022-06-30 21:35:44 +00:00
include ( ${ ClickHouse_SOURCE_DIR } /cmake/split_debug_symbols.cmake )
2022-03-10 21:23:28 +00:00
2020-09-19 16:42:36 +00:00
# The `clickhouse` binary is a multi purpose tool that contains multiple execution modes (client, server, etc.),
2020-09-15 21:12:37 +00:00
# each of them may be built and linked as a separate library.
2020-09-17 15:46:55 +00:00
# If you do not know what modes you need, turn this option OFF and enable SERVER and CLIENT only.
2022-04-22 09:30:35 +00:00
if ( USE_MUSL )
# Only clickhouse-keeper can be built with musl currently
option ( ENABLE_CLICKHOUSE_ALL "Enable all ClickHouse modes by default" OFF )
2022-04-21 11:43:24 +00:00
else ( )
2022-04-22 09:30:35 +00:00
option ( ENABLE_CLICKHOUSE_ALL "Enable all ClickHouse modes by default" ON )
2022-04-21 11:43:24 +00:00
endif ( )
2020-09-15 21:12:37 +00:00
2020-09-18 13:09:22 +00:00
option ( ENABLE_CLICKHOUSE_SERVER "Server mode (main mode)" ${ ENABLE_CLICKHOUSE_ALL } )
option ( ENABLE_CLICKHOUSE_CLIENT "Client mode (interactive tui/shell that connects to the server)"
$ { E N A B L E _ C L I C K H O U S E _ A L L } )
2020-09-15 21:12:37 +00:00
2022-06-27 15:41:23 +00:00
if ( CLICKHOUSE_SPLIT_BINARY OR NOT ENABLE_UTILS )
2022-06-27 05:36:27 +00:00
option ( ENABLE_CLICKHOUSE_SELF_EXTRACTING "Self-extracting executable" OFF )
else ( )
option ( ENABLE_CLICKHOUSE_SELF_EXTRACTING "Self-extracting executable" ON )
endif ( )
2021-09-22 00:22:57 +00:00
# https://clickhouse.com/docs/en/operations/utilities/clickhouse-local/
2020-09-17 15:09:59 +00:00
option ( ENABLE_CLICKHOUSE_LOCAL "Local files fast processing mode" ${ ENABLE_CLICKHOUSE_ALL } )
2020-09-15 21:12:37 +00:00
2021-09-22 00:22:57 +00:00
# https://clickhouse.com/docs/en/operations/utilities/clickhouse-benchmark/
2020-09-17 15:09:59 +00:00
option ( ENABLE_CLICKHOUSE_BENCHMARK "Queries benchmarking mode" ${ ENABLE_CLICKHOUSE_ALL } )
2020-09-15 21:12:37 +00:00
2020-09-18 13:09:22 +00:00
option ( ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG "Configs processor (extract values etc.)" ${ ENABLE_CLICKHOUSE_ALL } )
2020-09-15 21:12:37 +00:00
2021-09-22 00:22:57 +00:00
# https://clickhouse.com/docs/en/operations/utilities/clickhouse-compressor/
2020-09-19 16:42:36 +00:00
option ( ENABLE_CLICKHOUSE_COMPRESSOR "Data compressor and decompressor" ${ ENABLE_CLICKHOUSE_ALL } )
2020-09-15 21:12:37 +00:00
2021-09-22 00:22:57 +00:00
# https://clickhouse.com/docs/en/operations/utilities/clickhouse-copier/
2020-09-17 15:09:59 +00:00
option ( ENABLE_CLICKHOUSE_COPIER "Inter-cluster data copying mode" ${ ENABLE_CLICKHOUSE_ALL } )
2020-09-15 21:12:37 +00:00
2020-09-18 13:09:22 +00:00
option ( ENABLE_CLICKHOUSE_FORMAT "Queries pretty-printer and formatter with syntax highlighting"
$ { E N A B L E _ C L I C K H O U S E _ A L L } )
2020-09-15 21:12:37 +00:00
2021-09-22 00:22:57 +00:00
# https://clickhouse.com/docs/en/operations/utilities/clickhouse-obfuscator/
2020-09-18 13:09:22 +00:00
option ( ENABLE_CLICKHOUSE_OBFUSCATOR "Table data obfuscator (convert real data to benchmark-ready one)"
$ { E N A B L E _ C L I C K H O U S E _ A L L } )
2020-09-15 21:12:37 +00:00
2021-09-22 00:22:57 +00:00
# https://clickhouse.com/docs/en/operations/utilities/odbc-bridge/
2021-06-20 08:24:43 +00:00
# TODO Also needs NANODBC.
2022-01-09 08:34:05 +00:00
if ( ENABLE_ODBC AND NOT USE_MUSL )
2021-04-20 11:07:05 +00:00
option ( ENABLE_CLICKHOUSE_ODBC_BRIDGE "HTTP-server working like a proxy to ODBC driver"
$ { E N A B L E _ C L I C K H O U S E _ A L L } )
else ( )
option ( ENABLE_CLICKHOUSE_ODBC_BRIDGE "HTTP-server working like a proxy to ODBC driver" OFF )
endif ( )
2020-08-09 20:10:51 +00:00
2022-01-09 08:34:05 +00:00
if ( NOT USE_MUSL )
option ( ENABLE_CLICKHOUSE_LIBRARY_BRIDGE "HTTP-server working like a proxy to Library dictionary source"
$ { E N A B L E _ C L I C K H O U S E _ A L L } )
endif ( )
2021-03-05 09:38:00 +00:00
2021-09-22 00:22:57 +00:00
# https://presentations.clickhouse.com/matemarketing_2020/
2021-06-18 11:21:05 +00:00
option ( ENABLE_CLICKHOUSE_GIT_IMPORT "A tool to analyze Git repositories" ${ ENABLE_CLICKHOUSE_ALL } )
2020-12-18 21:19:11 +00:00
2021-08-29 14:18:04 +00:00
option ( ENABLE_CLICKHOUSE_STATIC_FILES_DISK_UPLOADER "A tool to export table data files to be later put to a static files web server" ${ ENABLE_CLICKHOUSE_ALL } )
2021-05-12 10:39:07 +00:00
option ( ENABLE_CLICKHOUSE_KEEPER "ClickHouse alternative to ZooKeeper" ${ ENABLE_CLICKHOUSE_ALL } )
2021-06-17 16:32:50 +00:00
option ( ENABLE_CLICKHOUSE_KEEPER_CONVERTER "Util allows to convert ZooKeeper logs and snapshots into clickhouse-keeper snapshot" ${ ENABLE_CLICKHOUSE_ALL } )
2022-05-23 00:03:13 +00:00
option ( ENABLE_CLICKHOUSE_SU "A tool similar to 'su'" ${ ENABLE_CLICKHOUSE_ALL } )
2022-04-08 07:52:16 +00:00
option ( ENABLE_CLICKHOUSE_DISKS "A tool to manage disks" ${ ENABLE_CLICKHOUSE_ALL } )
2022-01-17 18:45:54 +00:00
if ( NOT ENABLE_NURAFT )
2021-05-22 23:26:40 +00:00
# RECONFIGURE_MESSAGE_LEVEL should not be used here,
2022-01-17 18:45:54 +00:00
# since ENABLE_NURAFT is set to OFF for FreeBSD and Darwin.
2021-06-17 16:32:50 +00:00
message ( STATUS "clickhouse-keeper and clickhouse-keeper-converter will not be built (lack of NuRaft)" )
2021-05-22 23:26:40 +00:00
set ( ENABLE_CLICKHOUSE_KEEPER OFF )
2021-06-17 16:32:50 +00:00
set ( ENABLE_CLICKHOUSE_KEEPER_CONVERTER OFF )
2021-05-22 23:26:40 +00:00
endif ( )
2021-05-12 10:39:07 +00:00
2020-08-09 20:10:51 +00:00
if ( CLICKHOUSE_SPLIT_BINARY )
2020-09-18 13:09:22 +00:00
option ( ENABLE_CLICKHOUSE_INSTALL "Install ClickHouse without .deb/.rpm/.tgz packages (having the binary only)" OFF )
2020-08-09 20:10:51 +00:00
else ( )
2020-09-18 13:09:22 +00:00
option ( ENABLE_CLICKHOUSE_INSTALL "Install ClickHouse without .deb/.rpm/.tgz packages (having the binary only)"
$ { E N A B L E _ C L I C K H O U S E _ A L L } )
2020-08-09 20:10:51 +00:00
endif ( )
2018-08-07 17:57:44 +00:00
2020-10-12 12:38:52 +00:00
message ( STATUS "ClickHouse modes:" )
if ( NOT ENABLE_CLICKHOUSE_SERVER )
message ( WARNING "ClickHouse server mode is not going to be built." )
else ( )
message ( STATUS "Server mode: ON" )
endif ( )
if ( NOT ENABLE_CLICKHOUSE_CLIENT )
2020-12-18 21:04:03 +00:00
message ( WARNING "ClickHouse client mode is not going to be built. You won't be able to connect to the server and run tests" )
2020-10-12 12:38:52 +00:00
else ( )
message ( STATUS "Client mode: ON" )
endif ( )
if ( ENABLE_CLICKHOUSE_LOCAL )
message ( STATUS "Local mode: ON" )
else ( )
message ( STATUS "Local mode: OFF" )
endif ( )
2022-06-27 05:36:27 +00:00
if ( ENABLE_CLICKHOUSE_SELF_EXTRACTING )
message ( STATUS "Self-extracting executable: ON" )
else ( )
message ( STATUS "Self-extracting executable: OFF" )
endif ( )
2020-10-12 12:38:52 +00:00
if ( ENABLE_CLICKHOUSE_BENCHMARK )
message ( STATUS "Benchmark mode: ON" )
else ( )
message ( STATUS "Benchmark mode: OFF" )
endif ( )
if ( ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG )
message ( STATUS "Extract from config mode: ON" )
else ( )
message ( STATUS "Extract from config mode: OFF" )
endif ( )
if ( ENABLE_CLICKHOUSE_COMPRESSOR )
message ( STATUS "Compressor mode: ON" )
else ( )
message ( STATUS "Compressor mode: OFF" )
endif ( )
if ( ENABLE_CLICKHOUSE_COPIER )
message ( STATUS "Copier mode: ON" )
else ( )
message ( STATUS "Copier mode: OFF" )
endif ( )
if ( ENABLE_CLICKHOUSE_FORMAT )
message ( STATUS "Format mode: ON" )
else ( )
message ( STATUS "Format mode: OFF" )
endif ( )
if ( ENABLE_CLICKHOUSE_OBFUSCATOR )
message ( STATUS "Obfuscator mode: ON" )
else ( )
message ( STATUS "Obfuscator mode: OFF" )
endif ( )
if ( ENABLE_CLICKHOUSE_ODBC_BRIDGE )
message ( STATUS "ODBC bridge mode: ON" )
else ( )
message ( STATUS "ODBC bridge mode: OFF" )
endif ( )
2021-03-05 09:38:00 +00:00
if ( ENABLE_CLICKHOUSE_LIBRARY_BRIDGE )
message ( STATUS "Library bridge mode: ON" )
else ( )
message ( STATUS "Library bridge mode: OFF" )
endif ( )
2020-10-12 12:38:52 +00:00
if ( ENABLE_CLICKHOUSE_INSTALL )
message ( STATUS "ClickHouse install: ON" )
else ( )
message ( STATUS "ClickHouse install: OFF" )
endif ( )
2020-12-18 21:04:03 +00:00
if ( ENABLE_CLICKHOUSE_GIT_IMPORT )
message ( STATUS "ClickHouse git-import: ON" )
else ( )
message ( STATUS "ClickHouse git-import: OFF" )
endif ( )
2021-05-12 10:39:07 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER )
message ( STATUS "ClickHouse keeper mode: ON" )
else ( )
message ( STATUS "ClickHouse keeper mode: OFF" )
endif ( )
2021-06-17 16:32:50 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER_CONVERTER )
message ( STATUS "ClickHouse keeper-converter mode: ON" )
else ( )
message ( STATUS "ClickHouse keeper-converter mode: OFF" )
endif ( )
2022-01-24 11:32:17 +00:00
if ( NOT ( USE_STATIC_LIBRARIES OR SPLIT_SHARED_LIBRARIES ) )
2020-09-15 21:12:37 +00:00
set ( CLICKHOUSE_ONE_SHARED ON )
2019-03-04 17:47:31 +00:00
endif ( )
2022-04-08 07:52:16 +00:00
if ( ENABLE_CLICKHOUSE_DISKS )
message ( STATUS "Clickhouse disks mode: ON" )
else ( )
message ( STATUS "ClickHouse disks mode: OFF" )
endif ( )
2019-12-15 06:34:43 +00:00
configure_file ( config_tools.h.in ${ ConfigIncludePath } /config_tools.h )
2018-02-15 20:57:08 +00:00
2019-03-04 17:47:31 +00:00
macro ( clickhouse_target_link_split_lib target name )
if ( NOT CLICKHOUSE_ONE_SHARED )
2019-09-30 11:58:32 +00:00
target_link_libraries ( ${ target } PRIVATE clickhouse- ${ name } -lib )
2019-03-04 17:47:31 +00:00
else ( )
2019-09-30 11:58:32 +00:00
target_link_libraries ( ${ target } PRIVATE clickhouse-lib )
2019-03-04 17:47:31 +00:00
endif ( )
endmacro ( )
macro ( clickhouse_program_link_split_binary name )
clickhouse_target_link_split_lib ( clickhouse- ${ name } ${ name } )
endmacro ( )
macro ( clickhouse_program_add_library name )
string ( TOUPPER ${ name } name_uc )
string ( REPLACE "-" "_" name_uc ${ name_uc } )
# Some dark magic
set ( CLICKHOUSE_ ${ name_uc } _SOURCES ${ CLICKHOUSE_${name_uc } _SOURCES} PARENT_SCOPE )
set ( CLICKHOUSE_ ${ name_uc } _LINK ${ CLICKHOUSE_${name_uc } _LINK} PARENT_SCOPE )
set ( CLICKHOUSE_ ${ name_uc } _INCLUDE ${ CLICKHOUSE_${name_uc } _INCLUDE} PARENT_SCOPE )
if ( NOT CLICKHOUSE_ONE_SHARED )
2019-04-24 09:06:28 +00:00
add_library ( clickhouse- ${ name } -lib ${ CLICKHOUSE_${name_uc } _SOURCES} )
2019-03-04 17:47:31 +00:00
set ( _link ${ CLICKHOUSE_${name_uc } _LINK} ) # can't use ${} in if()
if ( _link )
target_link_libraries ( clickhouse- ${ name } -lib ${ CLICKHOUSE_${name_uc } _LINK} )
endif ( )
set ( _include ${ CLICKHOUSE_${name_uc } _INCLUDE} ) # can't use ${} in if()
if ( _include )
target_include_directories ( clickhouse- ${ name } -lib ${ CLICKHOUSE_${name_uc } _INCLUDE} )
endif ( )
endif ( )
endmacro ( )
macro ( clickhouse_program_add_executable name )
if ( CLICKHOUSE_SPLIT_BINARY )
add_executable ( clickhouse- ${ name } clickhouse- ${ name } .cpp )
clickhouse_program_link_split_binary ( ${ name } )
install ( TARGETS clickhouse- ${ name } ${ CLICKHOUSE_ALL_TARGETS } RUNTIME DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
endif ( )
endmacro ( )
macro ( clickhouse_program_add name )
clickhouse_program_add_library ( ${ name } )
clickhouse_program_add_executable ( ${ name } )
endmacro ( )
2018-06-05 20:09:51 +00:00
add_subdirectory ( server )
add_subdirectory ( client )
add_subdirectory ( local )
add_subdirectory ( benchmark )
add_subdirectory ( extract-from-config )
add_subdirectory ( compressor )
add_subdirectory ( copier )
add_subdirectory ( format )
2018-06-16 00:27:59 +00:00
add_subdirectory ( obfuscator )
2020-08-08 18:38:34 +00:00
add_subdirectory ( install )
2020-09-07 03:22:47 +00:00
add_subdirectory ( git-import )
2021-03-18 07:14:13 +00:00
add_subdirectory ( bash-completion )
2021-08-28 20:21:05 +00:00
add_subdirectory ( static-files-disk-uploader )
2022-05-23 00:03:13 +00:00
add_subdirectory ( su )
2022-04-08 07:52:16 +00:00
add_subdirectory ( disks )
2021-05-22 23:26:40 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER )
add_subdirectory ( keeper )
endif ( )
2018-12-14 19:28:37 +00:00
2021-06-17 16:32:50 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER_CONVERTER )
add_subdirectory ( keeper-converter )
endif ( )
2018-12-14 19:28:37 +00:00
if ( ENABLE_CLICKHOUSE_ODBC_BRIDGE )
add_subdirectory ( odbc-bridge )
endif ( )
2017-11-12 17:08:52 +00:00
2021-03-05 09:38:00 +00:00
if ( ENABLE_CLICKHOUSE_LIBRARY_BRIDGE )
add_subdirectory ( library-bridge )
endif ( )
2022-06-27 12:25:21 +00:00
if ( ENABLE_CLICKHOUSE_SELF_EXTRACTING )
2022-06-27 05:36:27 +00:00
add_subdirectory ( self-extracting )
2022-06-27 12:25:21 +00:00
endif ( )
2022-06-27 05:36:27 +00:00
2019-03-04 17:47:31 +00:00
if ( CLICKHOUSE_ONE_SHARED )
2021-06-17 16:32:50 +00:00
add_library ( clickhouse-lib SHARED
$ { C L I C K H O U S E _ S E R V E R _ S O U R C E S }
$ { C L I C K H O U S E _ C L I E N T _ S O U R C E S }
$ { C L I C K H O U S E _ L O C A L _ S O U R C E S }
$ { C L I C K H O U S E _ B E N C H M A R K _ S O U R C E S }
$ { C L I C K H O U S E _ C O P I E R _ S O U R C E S }
$ { C L I C K H O U S E _ E X T R A C T _ F R O M _ C O N F I G _ S O U R C E S }
$ { C L I C K H O U S E _ C O M P R E S S O R _ S O U R C E S }
$ { C L I C K H O U S E _ F O R M A T _ S O U R C E S }
$ { C L I C K H O U S E _ O B F U S C A T O R _ S O U R C E S }
$ { C L I C K H O U S E _ G I T _ I M P O R T _ S O U R C E S }
$ { C L I C K H O U S E _ O D B C _ B R I D G E _ S O U R C E S }
$ { C L I C K H O U S E _ K E E P E R _ S O U R C E S }
2021-08-06 19:41:03 +00:00
$ { C L I C K H O U S E _ K E E P E R _ C O N V E R T E R _ S O U R C E S }
2022-05-23 00:03:13 +00:00
$ { C L I C K H O U S E _ S T A T I C _ F I L E S _ D I S K _ U P L O A D E R _ S O U R C E S }
$ { C L I C K H O U S E _ S U _ S O U R C E S } )
2021-06-17 16:32:50 +00:00
target_link_libraries ( clickhouse-lib
$ { C L I C K H O U S E _ S E R V E R _ L I N K }
$ { C L I C K H O U S E _ C L I E N T _ L I N K }
$ { C L I C K H O U S E _ L O C A L _ L I N K }
$ { C L I C K H O U S E _ B E N C H M A R K _ L I N K }
$ { C L I C K H O U S E _ C O P I E R _ L I N K }
$ { C L I C K H O U S E _ E X T R A C T _ F R O M _ C O N F I G _ L I N K }
$ { C L I C K H O U S E _ C O M P R E S S O R _ L I N K }
$ { C L I C K H O U S E _ F O R M A T _ L I N K }
$ { C L I C K H O U S E _ O B F U S C A T O R _ L I N K }
$ { C L I C K H O U S E _ G I T _ I M P O R T _ L I N K }
$ { C L I C K H O U S E _ O D B C _ B R I D G E _ L I N K }
$ { C L I C K H O U S E _ K E E P E R _ L I N K }
2021-08-06 19:41:03 +00:00
$ { C L I C K H O U S E _ K E E P E R _ C O N V E R T E R _ L I N K }
2022-05-23 00:03:13 +00:00
$ { C L I C K H O U S E _ S T A T I C _ F I L E S _ D I S K _ U P L O A D E R _ L I N K }
$ { C L I C K H O U S E _ S U _ L I N K } )
2021-06-17 16:32:50 +00:00
target_include_directories ( clickhouse-lib
$ { C L I C K H O U S E _ S E R V E R _ I N C L U D E }
$ { C L I C K H O U S E _ C L I E N T _ I N C L U D E }
$ { C L I C K H O U S E _ L O C A L _ I N C L U D E }
$ { C L I C K H O U S E _ B E N C H M A R K _ I N C L U D E }
$ { C L I C K H O U S E _ C O P I E R _ I N C L U D E }
$ { C L I C K H O U S E _ E X T R A C T _ F R O M _ C O N F I G _ I N C L U D E }
$ { C L I C K H O U S E _ C O M P R E S S O R _ I N C L U D E }
$ { C L I C K H O U S E _ F O R M A T _ I N C L U D E }
$ { C L I C K H O U S E _ O B F U S C A T O R _ I N C L U D E }
$ { C L I C K H O U S E _ G I T _ I M P O R T _ I N C L U D E }
$ { C L I C K H O U S E _ O D B C _ B R I D G E _ I N C L U D E }
$ { C L I C K H O U S E _ K E E P E R _ I N C L U D E }
$ { C L I C K H O U S E _ K E E P E R _ C O N V E R T E R _ I N C L U D E } )
2019-03-15 11:36:59 +00:00
set_target_properties ( clickhouse-lib PROPERTIES SOVERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } VERSION ${ VERSION_SO } OUTPUT_NAME clickhouse DEBUG_POSTFIX "" )
2019-03-27 15:05:05 +00:00
install ( TARGETS clickhouse-lib LIBRARY DESTINATION ${ CMAKE_INSTALL_LIBDIR } COMPONENT clickhouse )
2019-03-04 17:47:31 +00:00
endif ( )
2017-12-09 21:55:10 +00:00
if ( CLICKHOUSE_SPLIT_BINARY )
2021-05-22 23:26:40 +00:00
set ( CLICKHOUSE_ALL_TARGETS
c l i c k h o u s e - s e r v e r
c l i c k h o u s e - c l i e n t
c l i c k h o u s e - l o c a l
c l i c k h o u s e - b e n c h m a r k
c l i c k h o u s e - e x t r a c t - f r o m - c o n f i g
c l i c k h o u s e - c o m p r e s s o r
c l i c k h o u s e - f o r m a t
c l i c k h o u s e - o b f u s c a t o r
c l i c k h o u s e - g i t - i m p o r t
c l i c k h o u s e - c o p i e r
2021-08-28 20:21:05 +00:00
c l i c k h o u s e - s t a t i c - f i l e s - d i s k - u p l o a d e r
2022-04-08 07:52:16 +00:00
c l i c k h o u s e - d i s k s )
2018-12-14 19:28:37 +00:00
if ( ENABLE_CLICKHOUSE_ODBC_BRIDGE )
list ( APPEND CLICKHOUSE_ALL_TARGETS clickhouse-odbc-bridge )
endif ( )
2017-12-13 19:07:12 +00:00
2021-03-10 08:09:05 +00:00
if ( ENABLE_CLICKHOUSE_LIBRARY_BRIDGE )
list ( APPEND CLICKHOUSE_ALL_TARGETS clickhouse-library-bridge )
endif ( )
2021-05-22 23:26:40 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER )
list ( APPEND CLICKHOUSE_ALL_TARGETS clickhouse-keeper )
endif ( )
2021-06-17 16:32:50 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER_CONVERTER )
list ( APPEND CLICKHOUSE_ALL_TARGETS clickhouse-keeper-converter )
endif ( )
2018-06-19 18:09:09 +00:00
set_target_properties ( ${ CLICKHOUSE_ALL_TARGETS } PROPERTIES RUNTIME_OUTPUT_DIRECTORY .. )
2017-12-13 19:07:12 +00:00
add_custom_target ( clickhouse-bundle ALL DEPENDS ${ CLICKHOUSE_ALL_TARGETS } )
2017-12-15 19:34:19 +00:00
add_custom_target ( clickhouse ALL DEPENDS clickhouse-bundle )
2019-03-11 18:03:32 +00:00
2019-03-12 13:29:35 +00:00
install ( PROGRAMS clickhouse-split-helper DESTINATION ${ CMAKE_INSTALL_BINDIR } RENAME clickhouse COMPONENT clickhouse )
2017-12-09 21:55:10 +00:00
else ( )
2017-12-11 12:38:34 +00:00
add_executable ( clickhouse main.cpp )
2021-01-04 14:08:58 +00:00
# A library that prevent usage of several functions from libc.
if ( ARCH_AMD64 AND OS_LINUX AND NOT OS_ANDROID )
set ( HARMFUL_LIB harmful )
endif ( )
target_link_libraries ( clickhouse PRIVATE clickhouse_common_io string_utils ${ HARMFUL_LIB } )
2018-02-15 20:57:08 +00:00
target_include_directories ( clickhouse PRIVATE ${ CMAKE_CURRENT_BINARY_DIR } )
2017-12-28 12:58:39 +00:00
2018-02-15 20:57:08 +00:00
if ( ENABLE_CLICKHOUSE_SERVER )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse server )
2018-02-15 20:57:08 +00:00
endif ( )
if ( ENABLE_CLICKHOUSE_CLIENT )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse client )
2018-02-15 20:57:08 +00:00
endif ( )
if ( ENABLE_CLICKHOUSE_LOCAL )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse local )
2018-02-15 20:57:08 +00:00
endif ( )
if ( ENABLE_CLICKHOUSE_BENCHMARK )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse benchmark )
2018-02-15 20:57:08 +00:00
endif ( )
if ( ENABLE_CLICKHOUSE_COPIER )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse copier )
2018-02-15 20:57:08 +00:00
endif ( )
2018-06-05 20:09:51 +00:00
if ( ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse extract-from-config )
2018-06-05 20:09:51 +00:00
endif ( )
if ( ENABLE_CLICKHOUSE_COMPRESSOR )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse compressor )
2018-06-05 20:09:51 +00:00
endif ( )
if ( ENABLE_CLICKHOUSE_FORMAT )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse format )
2018-06-05 20:09:51 +00:00
endif ( )
2018-06-16 00:27:59 +00:00
if ( ENABLE_CLICKHOUSE_OBFUSCATOR )
2019-03-11 18:03:32 +00:00
clickhouse_target_link_split_lib ( clickhouse obfuscator )
2018-06-16 00:27:59 +00:00
endif ( )
2020-09-07 03:22:47 +00:00
if ( ENABLE_CLICKHOUSE_GIT_IMPORT )
clickhouse_target_link_split_lib ( clickhouse git-import )
endif ( )
2021-08-28 20:21:05 +00:00
if ( ENABLE_CLICKHOUSE_STATIC_FILES_DISK_UPLOADER )
clickhouse_target_link_split_lib ( clickhouse static-files-disk-uploader )
2021-06-18 11:21:05 +00:00
endif ( )
2022-05-23 00:03:13 +00:00
if ( ENABLE_CLICKHOUSE_SU )
clickhouse_target_link_split_lib ( clickhouse su )
endif ( )
2021-05-12 10:39:07 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER )
clickhouse_target_link_split_lib ( clickhouse keeper )
endif ( )
2021-06-17 16:32:50 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER_CONVERTER )
clickhouse_target_link_split_lib ( clickhouse keeper-converter )
endif ( )
2020-08-08 18:38:34 +00:00
if ( ENABLE_CLICKHOUSE_INSTALL )
clickhouse_target_link_split_lib ( clickhouse install )
endif ( )
2022-04-08 07:52:16 +00:00
if ( ENABLE_CLICKHOUSE_DISKS )
clickhouse_target_link_split_lib ( clickhouse disks )
endif ( )
2017-11-12 12:58:40 +00:00
2018-02-15 20:57:08 +00:00
set ( CLICKHOUSE_BUNDLE )
if ( ENABLE_CLICKHOUSE_SERVER )
add_custom_target ( clickhouse-server ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-server DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-server" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-02-15 20:57:08 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-server )
endif ( )
if ( ENABLE_CLICKHOUSE_CLIENT )
add_custom_target ( clickhouse-client ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-client DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-client" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-02-15 20:57:08 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-client )
endif ( )
if ( ENABLE_CLICKHOUSE_LOCAL )
add_custom_target ( clickhouse-local ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-local DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-local" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-02-15 20:57:08 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-local )
endif ( )
if ( ENABLE_CLICKHOUSE_BENCHMARK )
add_custom_target ( clickhouse-benchmark ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-benchmark DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-benchmark" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-02-15 20:57:08 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-benchmark )
endif ( )
2018-06-16 00:27:59 +00:00
if ( ENABLE_CLICKHOUSE_COPIER )
add_custom_target ( clickhouse-copier ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-copier DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-copier" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-06-16 00:27:59 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-copier )
endif ( )
2018-06-05 20:09:51 +00:00
if ( ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG )
2018-02-15 20:57:08 +00:00
add_custom_target ( clickhouse-extract-from-config ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-extract-from-config DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-extract-from-config" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-06-05 20:09:51 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-extract-from-config )
endif ( )
if ( ENABLE_CLICKHOUSE_COMPRESSOR )
2018-02-15 20:57:08 +00:00
add_custom_target ( clickhouse-compressor ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-compressor DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-compressor" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-06-05 20:09:51 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-compressor )
endif ( )
if ( ENABLE_CLICKHOUSE_FORMAT )
2018-02-15 20:57:08 +00:00
add_custom_target ( clickhouse-format ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-format DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-format" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-06-05 20:09:51 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-format )
2018-02-15 20:57:08 +00:00
endif ( )
2019-01-31 17:18:30 +00:00
if ( ENABLE_CLICKHOUSE_OBFUSCATOR )
2018-06-16 00:27:59 +00:00
add_custom_target ( clickhouse-obfuscator ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-obfuscator DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-obfuscator" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2018-06-16 00:27:59 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-obfuscator )
2018-02-15 20:57:08 +00:00
endif ( )
2020-09-07 03:22:47 +00:00
if ( ENABLE_CLICKHOUSE_GIT_IMPORT )
add_custom_target ( clickhouse-git-import ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-git-import DEPENDS clickhouse )
2021-04-24 19:47:52 +00:00
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-git-import" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2020-09-07 03:22:47 +00:00
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-git-import )
endif ( )
2021-08-28 20:21:05 +00:00
if ( ENABLE_CLICKHOUSE_STATIC_FILES_DISK_UPLOADER )
add_custom_target ( clickhouse-static-files-disk-uploader ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-static-files-disk-uploader DEPENDS clickhouse )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-static-files-disk-uploader" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-static-files-disk-uploader )
2021-06-18 11:21:05 +00:00
endif ( )
2022-05-23 00:03:13 +00:00
if ( ENABLE_CLICKHOUSE_SU )
add_custom_target ( clickhouse-su ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-su DEPENDS clickhouse )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-su" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-su )
endif ( )
2022-04-20 10:11:55 +00:00
2021-05-12 10:39:07 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER )
2022-04-20 10:11:55 +00:00
if ( NOT BUILD_STANDALONE_KEEPER AND CREATE_KEEPER_SYMLINK )
2022-03-11 14:47:07 +00:00
add_custom_target ( clickhouse-keeper ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-keeper DEPENDS clickhouse )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-keeper" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
endif ( )
2022-04-20 10:11:55 +00:00
# otherwise we don't build keeper
if ( BUILD_STANDALONE_KEEPER OR CREATE_KEEPER_SYMLINK )
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-keeper )
endif ( )
2021-05-12 10:39:07 +00:00
endif ( )
2021-06-17 16:32:50 +00:00
if ( ENABLE_CLICKHOUSE_KEEPER_CONVERTER )
add_custom_target ( clickhouse-keeper-converter ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-keeper-converter DEPENDS clickhouse )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-keeper-converter" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-keeper-converter )
endif ( )
2022-04-08 07:52:16 +00:00
if ( ENABLE_CLICKHOUSE_DISKS )
add_custom_target ( clickhouse-disks ALL COMMAND ${ CMAKE_COMMAND } -E create_symlink clickhouse clickhouse-disks DEPENDS clickhouse )
install ( FILES "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-disks" DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
list ( APPEND CLICKHOUSE_BUNDLE clickhouse-disks )
endif ( )
2018-06-16 00:27:59 +00:00
2018-02-15 20:57:08 +00:00
add_custom_target ( clickhouse-bundle ALL DEPENDS ${ CLICKHOUSE_BUNDLE } )
2018-06-05 20:09:51 +00:00
2019-09-17 09:49:27 +00:00
if ( USE_GDB_ADD_INDEX )
add_custom_command ( TARGET clickhouse POST_BUILD COMMAND ${ GDB_ADD_INDEX_EXE } clickhouse COMMENT "Adding .gdb-index to clickhouse" VERBATIM )
endif ( )
2021-01-07 02:56:57 +00:00
if ( USE_BINARY_HASH )
2022-06-14 08:50:53 +00:00
add_custom_command ( TARGET clickhouse POST_BUILD COMMAND ./clickhouse hash-binary > hash && ${ OBJCOPY_PATH } --add-section .clickhouse.hash=hash clickhouse COMMENT "Adding section '.clickhouse.hash' to clickhouse binary" VERBATIM )
2021-01-07 02:56:57 +00:00
endif ( )
2018-06-06 19:00:11 +00:00
2022-06-30 21:35:44 +00:00
if ( SPLIT_DEBUG_SYMBOLS )
clickhouse_split_debug_symbols ( TARGET clickhouse DESTINATION_DIR ${ CMAKE_CURRENT_BINARY_DIR } / ${ SPLITTED_DEBUG_SYMBOLS_DIR } BINARY_PATH clickhouse )
2022-03-16 11:53:15 +00:00
else ( )
2022-06-30 21:35:44 +00:00
clickhouse_make_empty_debug_info_for_nfpm ( TARGET clickhouse DESTINATION_DIR ${ CMAKE_CURRENT_BINARY_DIR } / ${ SPLITTED_DEBUG_SYMBOLS_DIR } )
2022-03-16 11:53:15 +00:00
install ( TARGETS clickhouse RUNTIME DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2022-03-10 21:23:28 +00:00
endif ( )
endif ( )
2022-01-17 20:26:05 +00:00
if ( ENABLE_TESTS )
2021-03-04 03:49:46 +00:00
set ( CLICKHOUSE_UNIT_TESTS_TARGETS unit_tests_dbms )
2020-06-04 08:26:22 +00:00
add_custom_target ( clickhouse-tests ALL DEPENDS ${ CLICKHOUSE_UNIT_TESTS_TARGETS } )
2020-05-21 15:02:52 +00:00
add_dependencies ( clickhouse-bundle clickhouse-tests )
endif ( )
2021-10-07 18:01:36 +00:00
if ( ENABLE_FUZZING )
add_compile_definitions ( FUZZING_MODE=1 )
endif ( )