2017-06-16 16:20:51 +00:00
|
|
|
# 'clickhouse' binary is a multi purpose tool,
|
|
|
|
# that contain multiple execution modes (client, server, etc.)
|
|
|
|
# each of them is built and linked as a separate library, defined below.
|
|
|
|
|
2018-02-15 20:57:08 +00:00
|
|
|
option (ENABLE_CLICKHOUSE_ALL "Enable all tools" ON)
|
|
|
|
option (ENABLE_CLICKHOUSE_SERVER "Enable server" ${ENABLE_CLICKHOUSE_ALL})
|
|
|
|
option (ENABLE_CLICKHOUSE_CLIENT "Enable client" ${ENABLE_CLICKHOUSE_ALL})
|
|
|
|
option (ENABLE_CLICKHOUSE_LOCAL "Enable local" ${ENABLE_CLICKHOUSE_ALL})
|
|
|
|
option (ENABLE_CLICKHOUSE_BENCHMARK "Enable benchmark" ${ENABLE_CLICKHOUSE_ALL})
|
|
|
|
option (ENABLE_CLICKHOUSE_PERFORMANCE "Enable performance" ${ENABLE_CLICKHOUSE_ALL})
|
2018-06-05 20:09:51 +00:00
|
|
|
option (ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG "Enable extract-from-config" ${ENABLE_CLICKHOUSE_ALL})
|
|
|
|
option (ENABLE_CLICKHOUSE_COMPRESSOR "Enable compressor" ${ENABLE_CLICKHOUSE_ALL})
|
2018-03-07 17:47:58 +00:00
|
|
|
option (ENABLE_CLICKHOUSE_COPIER "Enable copier" ${ENABLE_CLICKHOUSE_ALL})
|
2018-06-05 20:09:51 +00:00
|
|
|
option (ENABLE_CLICKHOUSE_FORMAT "Enable format" ${ENABLE_CLICKHOUSE_ALL})
|
2018-02-15 20:57:08 +00:00
|
|
|
|
|
|
|
configure_file (config_tools.h.in ${CMAKE_CURRENT_BINARY_DIR}/config_tools.h)
|
|
|
|
|
2018-06-05 20:09:51 +00:00
|
|
|
add_subdirectory (server)
|
|
|
|
add_subdirectory (client)
|
|
|
|
add_subdirectory (local)
|
|
|
|
add_subdirectory (benchmark)
|
|
|
|
add_subdirectory (performance-test)
|
|
|
|
add_subdirectory (extract-from-config)
|
|
|
|
add_subdirectory (compressor)
|
|
|
|
add_subdirectory (copier)
|
|
|
|
add_subdirectory (format)
|
2018-06-06 18:41:39 +00:00
|
|
|
add_subdirectory (clang)
|
2017-11-12 17:08:52 +00:00
|
|
|
|
2017-12-09 21:55:10 +00:00
|
|
|
if (CLICKHOUSE_SPLIT_BINARY)
|
2018-01-22 18:33:18 +00:00
|
|
|
set (CLICKHOUSE_ALL_TARGETS clickhouse-server clickhouse-client clickhouse-local clickhouse-benchmark clickhouse-performance-test
|
2018-03-07 18:17:17 +00:00
|
|
|
clickhouse-extract-from-config clickhouse-format clickhouse-copier)
|
2017-12-13 19:07:12 +00:00
|
|
|
|
2017-12-09 21:55:10 +00:00
|
|
|
if (USE_EMBEDDED_COMPILER)
|
2017-12-13 19:07:12 +00:00
|
|
|
list (APPEND CLICKHOUSE_ALL_TARGETS clickhouse-clang clickhouse-lld)
|
2017-12-09 21:55:10 +00:00
|
|
|
endif ()
|
|
|
|
|
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)
|
2017-12-09 21:55:10 +00:00
|
|
|
else ()
|
2018-06-05 20:09:51 +00:00
|
|
|
if (USE_EMBEDDED_COMPILER)
|
|
|
|
# before add_executable !
|
|
|
|
link_directories (${LLVM_LIBRARY_DIRS})
|
|
|
|
endif ()
|
2017-12-11 12:38:34 +00:00
|
|
|
add_executable (clickhouse main.cpp)
|
2018-02-15 20:57:08 +00:00
|
|
|
target_link_libraries (clickhouse clickhouse_common_io)
|
2017-12-11 12:38:34 +00:00
|
|
|
target_include_directories (clickhouse BEFORE PRIVATE ${COMMON_INCLUDE_DIR})
|
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
|
|
|
|
|
|
|
if (USE_EMBEDDED_COMPILER)
|
|
|
|
target_link_libraries (clickhouse clickhouse-compiler-lib)
|
|
|
|
endif ()
|
2018-02-15 20:57:08 +00:00
|
|
|
if (ENABLE_CLICKHOUSE_SERVER)
|
|
|
|
target_link_libraries (clickhouse clickhouse-server-lib)
|
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_CLIENT)
|
|
|
|
target_link_libraries (clickhouse clickhouse-client-lib)
|
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_LOCAL)
|
|
|
|
target_link_libraries (clickhouse clickhouse-local-lib)
|
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_BENCHMARK)
|
|
|
|
target_link_libraries (clickhouse clickhouse-benchmark-lib)
|
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_PERFORMANCE)
|
|
|
|
target_link_libraries (clickhouse clickhouse-performance-test-lib)
|
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_COPIER)
|
2018-03-07 18:17:17 +00:00
|
|
|
target_link_libraries (clickhouse clickhouse-copier-lib)
|
2018-02-15 20:57:08 +00:00
|
|
|
endif ()
|
2018-06-05 20:09:51 +00:00
|
|
|
if (ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG)
|
|
|
|
target_link_libraries (clickhouse clickhouse-extract-from-config-lib)
|
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_COMPRESSOR)
|
|
|
|
target_link_libraries (clickhouse clickhouse-compressor-lib)
|
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_FORMAT)
|
|
|
|
target_link_libraries (clickhouse clickhouse-format-lib)
|
|
|
|
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)
|
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-server DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
|
|
|
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)
|
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-client DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
|
|
|
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)
|
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-local DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
|
|
|
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)
|
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-benchmark DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
|
|
|
list(APPEND CLICKHOUSE_BUNDLE clickhouse-benchmark)
|
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_PERFORMANCE)
|
|
|
|
add_custom_target (clickhouse-performance-test ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-performance-test DEPENDS clickhouse)
|
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-performance-test DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
|
|
|
list(APPEND CLICKHOUSE_BUNDLE clickhouse-performance-test)
|
|
|
|
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)
|
2018-06-05 20:09:51 +00:00
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-extract-from-config DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
|
|
|
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)
|
2018-06-05 20:09:51 +00:00
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-compressor DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
|
|
|
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)
|
2018-06-05 20:09:51 +00:00
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-format DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
|
|
|
list(APPEND CLICKHOUSE_BUNDLE clickhouse-format)
|
2018-02-15 20:57:08 +00:00
|
|
|
endif ()
|
|
|
|
if (ENABLE_CLICKHOUSE_COPIER)
|
2018-03-07 18:17:17 +00:00
|
|
|
add_custom_target (clickhouse-copier ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-copier DEPENDS clickhouse)
|
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/clickhouse-copier DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
2018-02-15 20:57:08 +00:00
|
|
|
list(APPEND CLICKHOUSE_BUNDLE clickhouse-copier)
|
|
|
|
endif ()
|
2017-12-11 12:38:34 +00:00
|
|
|
# install always because depian package want this files:
|
|
|
|
add_custom_target (clickhouse-clang ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-clang DEPENDS clickhouse)
|
|
|
|
add_custom_target (clickhouse-lld ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-lld DEPENDS clickhouse)
|
2018-02-15 20:57:08 +00:00
|
|
|
list(APPEND CLICKHOUSE_BUNDLE clickhouse-clang clickhouse-lld)
|
2017-12-11 17:27:22 +00:00
|
|
|
|
|
|
|
install (TARGETS clickhouse RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
2018-02-15 20:57:08 +00:00
|
|
|
|
2017-12-11 17:27:22 +00:00
|
|
|
install (FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-clang
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-lld
|
|
|
|
DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
2017-12-13 19:07:12 +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
|
|
|
|
2017-12-09 21:55:10 +00:00
|
|
|
endif ()
|
2018-06-06 19:00:11 +00:00
|
|
|
|
|
|
|
if (USE_EMBEDDED_COMPILER AND ENABLE_CLICKHOUSE_SERVER)
|
|
|
|
add_dependencies(clickhouse-server copy-headers)
|
|
|
|
endif ()
|