mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Allow link with external libs: poco, tcmalloc
This commit is contained in:
parent
c3b69f1052
commit
ee3882f251
@ -1,6 +1,8 @@
|
||||
project (ClickHouse)
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
message(STATUS "Building for: ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
@ -71,6 +73,9 @@ if (USE_INTERNAL_BOOST_LIBRARY)
|
||||
add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
|
||||
endif ()
|
||||
|
||||
option (USE_INTERNAL_POCO_LIBRARY "Set to FALSE to use system poco library instead of bundled" ON)
|
||||
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" ON)
|
||||
|
||||
option (GLIBC_COMPATIBILITY "Set to TRUE to enable compatibility with older glibc libraries. Note that it is not compatible with ASan." OFF)
|
||||
if ($ENV{GLIBC_COMPATIBILITY})
|
||||
set (GLIBC_COMPATIBILITY TRUE)
|
||||
@ -100,15 +105,15 @@ else ()
|
||||
endif ()
|
||||
|
||||
set (CMAKE_BUILD_COLOR_MAKEFILE ON)
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++1y ${PLATFORM_EXTRA_CXX_FLAG} -fno-omit-frame-pointer ${COMMON_WARNING_FLAGS} ${CXX_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++1y ${PLATFORM_EXTRA_CXX_FLAG} -fno-omit-frame-pointer ${COMMON_WARNING_FLAGS} ${CXX_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI_FLAGS}")
|
||||
#set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3 -ggdb3 -fno-inline")
|
||||
|
||||
set (CMAKE_C_FLAGS "-fno-omit-frame-pointer ${COMMON_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g")
|
||||
set (CMAKE_C_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer ${COMMON_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI_FLAGS}")
|
||||
#set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O3")
|
||||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g3 -ggdb3 -fno-inline")
|
||||
|
||||
if (NOT APPLE AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_SYSTEM MATCHES "FreeBSD"))
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||
@ -120,10 +125,10 @@ endif ()
|
||||
|
||||
# -fuse-ld=gold - fix linkage for gcc-5.4, gcc-6.1
|
||||
# See more in http://stackoverflow.com/questions/37603238/fsanitize-not-using-gold-linker-in-gcc-6-1
|
||||
set (CMAKE_CXX_FLAGS_ASAN "-O3 -g -fsanitize=address -fno-omit-frame-pointer -fuse-ld=gold ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_C_FLAGS_ASAN "-O3 -g -fsanitize=address -fno-omit-frame-pointer -fuse-ld=gold ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_C_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS_ASAN} -O3 -g -fsanitize=address -fno-omit-frame-pointer -fuse-ld=gold ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS_UBSAN "${CMAKE_CXX_FLAGS_UBSAN} -O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_ASAN} -O3 -g -fsanitize=address -fno-omit-frame-pointer -fuse-ld=gold ${CXX11_ABI_FLAGS}")
|
||||
set (CMAKE_C_FLAGS_UBSAN "${CMAKE_C_FLAGS_UBSAN} -O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI_FLAGS}")
|
||||
|
||||
# Flags for test coverage
|
||||
if (TEST_COVERAGE)
|
||||
@ -156,27 +161,6 @@ include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libsparsehash/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libre2/)
|
||||
include_directories (BEFORE ${ClickHouse_BINARY_DIR}/contrib/libre2/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libzookeeper/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libtcmalloc/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Foundation/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Util/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Net/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/NetSSL_OpenSSL/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/MySQL/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/ODBC/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/SQLite/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Crypto/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/XML/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/JSON/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/MongoDB/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libpoco/Zip/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libboost/boost_1_62_0/)
|
||||
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng/)
|
||||
include_directories (BEFORE ${ClickHouse_BINARY_DIR}/contrib/libzlib-ng/)
|
||||
endif ()
|
||||
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/libs/libcommon/include/)
|
||||
include_directories (BEFORE ${ClickHouse_BINARY_DIR}/libs/libcommon/include/)
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/libs/libdaemon/include/)
|
||||
@ -186,16 +170,16 @@ include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/libs/libzkutil/include/)
|
||||
|
||||
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/dbms/include)
|
||||
|
||||
include_directories (/usr/local/include/)
|
||||
|
||||
link_directories (/usr/local/lib)
|
||||
|
||||
include (cmake/find_openssl.cmake)
|
||||
include (cmake/find_icu4c.cmake)
|
||||
include (cmake/find_boost.cmake)
|
||||
include (cmake/find_poco.cmake)
|
||||
include (cmake/find_libtool.cmake)
|
||||
include (cmake/find_mysqlclient.cmake)
|
||||
include (cmake/find_rt.cmake)
|
||||
if (ENABLE_LIBTCMALLOC)
|
||||
include (cmake/find_gperftools.cmake)
|
||||
endif ()
|
||||
|
||||
# Directory for Yandex specific files
|
||||
set (CLICKHOUSE_PRIVATE_DIR ${ClickHouse_SOURCE_DIR}/private/)
|
||||
|
53
cmake/Modules/FindGperftools.cmake
Normal file
53
cmake/Modules/FindGperftools.cmake
Normal file
@ -0,0 +1,53 @@
|
||||
# https://github.com/vast-io/vast/blob/master/cmake/FindGperftools.cmake
|
||||
|
||||
# Tries to find Gperftools.
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# find_package(Gperftools)
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour and need
|
||||
# to be set before calling find_package:
|
||||
#
|
||||
# Gperftools_ROOT_DIR Set this variable to the root installation of
|
||||
# Gperftools if the module has problems finding
|
||||
# the proper installation path.
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# GPERFTOOLS_FOUND System has Gperftools libs/headers
|
||||
# GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler)
|
||||
# GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers
|
||||
|
||||
find_library(GPERFTOOLS_TCMALLOC
|
||||
NAMES tcmalloc
|
||||
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||
|
||||
find_library(GPERFTOOLS_PROFILER
|
||||
NAMES profiler
|
||||
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||
|
||||
find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER
|
||||
NAMES tcmalloc_and_profiler
|
||||
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||
|
||||
find_path(GPERFTOOLS_INCLUDE_DIR
|
||||
NAMES gperftools/heap-profiler.h
|
||||
HINTS ${Gperftools_ROOT_DIR}/include)
|
||||
|
||||
set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
Gperftools
|
||||
DEFAULT_MSG
|
||||
GPERFTOOLS_LIBRARIES
|
||||
GPERFTOOLS_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(
|
||||
Gperftools_ROOT_DIR
|
||||
GPERFTOOLS_TCMALLOC
|
||||
GPERFTOOLS_PROFILER
|
||||
GPERFTOOLS_TCMALLOC_AND_PROFILER
|
||||
GPERFTOOLS_LIBRARIES
|
||||
GPERFTOOLS_INCLUDE_DIR)
|
218
cmake/Modules/FindPoco.cmake
Normal file
218
cmake/Modules/FindPoco.cmake
Normal file
@ -0,0 +1,218 @@
|
||||
# https://github.com/astahl/poco-cmake/blob/master/cmake/FindPoco.cmake
|
||||
|
||||
# - finds the Poco C++ libraries
|
||||
# This module finds the Applied Informatics Poco libraries.
|
||||
# It supports the following components:
|
||||
#
|
||||
# Util (loaded by default)
|
||||
# Foundation (loaded by default)
|
||||
# XML
|
||||
# Zip
|
||||
# Crypto
|
||||
# Data
|
||||
# Net
|
||||
# NetSSL_OpenSSL
|
||||
# OSP
|
||||
#
|
||||
# Usage:
|
||||
# set(ENV{Poco_DIR} path/to/poco/sdk)
|
||||
# find_package(Poco REQUIRED OSP Data Crypto)
|
||||
#
|
||||
# On completion, the script defines the following variables:
|
||||
#
|
||||
# - Compound variables:
|
||||
# Poco_FOUND
|
||||
# - true if all requested components were found.
|
||||
# Poco_LIBRARIES
|
||||
# - contains release (and debug if available) libraries for all requested components.
|
||||
# It has the form "optimized LIB1 debug LIBd1 optimized LIB2 ...", ready for use with the target_link_libraries command.
|
||||
# Poco_INCLUDE_DIRS
|
||||
# - Contains include directories for all requested components.
|
||||
#
|
||||
# - Component variables:
|
||||
# Poco_Xxx_FOUND
|
||||
# - Where Xxx is the properly cased component name (eg. 'Util', 'OSP').
|
||||
# True if a component's library or debug library was found successfully.
|
||||
# Poco_Xxx_LIBRARY
|
||||
# - Library for component Xxx.
|
||||
# Poco_Xxx_LIBRARY_DEBUG
|
||||
# - debug library for component Xxx
|
||||
# Poco_Xxx_INCLUDE_DIR
|
||||
# - include directory for component Xxx
|
||||
#
|
||||
# - OSP BundleCreator variables: (i.e. bundle.exe on windows, bundle on unix-likes)
|
||||
# (is only discovered if OSP is a requested component)
|
||||
# Poco_OSP_Bundle_EXECUTABLE_FOUND
|
||||
# - true if the bundle-creator executable was found.
|
||||
# Poco_OSP_Bundle_EXECUTABLE
|
||||
# - the path to the bundle-creator executable.
|
||||
#
|
||||
# Author: Andreas Stahl andreas.stahl@tu-dresden.de
|
||||
|
||||
set(Poco_HINTS
|
||||
/usr/local
|
||||
C:/AppliedInformatics
|
||||
${Poco_DIR}
|
||||
$ENV{Poco_DIR}
|
||||
)
|
||||
|
||||
if(NOT Poco_ROOT_DIR)
|
||||
# look for the root directory, first for the source-tree variant
|
||||
find_path(Poco_ROOT_DIR
|
||||
NAMES Foundation/include/Poco/Poco.h
|
||||
HINTS ${Poco_HINTS}
|
||||
)
|
||||
if(NOT Poco_ROOT_DIR)
|
||||
# this means poco may have a different directory structure, maybe it was installed, let's check for that
|
||||
message(STATUS "Looking for Poco install directory structure.")
|
||||
find_path(Poco_ROOT_DIR
|
||||
NAMES include/Poco/Poco.h
|
||||
HINTS ${Poco_HINTS}
|
||||
)
|
||||
if(NOT Poco_ROOT_DIR)
|
||||
# poco was still not found -> Fail
|
||||
if(Poco_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Poco: Could not find Poco install directory")
|
||||
endif()
|
||||
if(NOT Poco_FIND_QUIETLY)
|
||||
message(STATUS "Poco: Could not find Poco install directory")
|
||||
endif()
|
||||
return()
|
||||
else()
|
||||
# poco was found with the make install directory structure
|
||||
message(STATUS "Assuming Poco install directory structure at ${Poco_ROOT_DIR}.")
|
||||
set(Poco_INSTALLED true)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# add dynamic library directory
|
||||
if(WIN32)
|
||||
find_path(Poco_RUNTIME_LIBRARY_DIRS
|
||||
NAMES PocoFoundation.dll
|
||||
HINTS ${Poco_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
bin
|
||||
lib
|
||||
)
|
||||
endif()
|
||||
|
||||
# if installed directory structure, set full include dir
|
||||
if(Poco_INSTALLED)
|
||||
set(Poco_INCLUDE_DIRS ${Poco_ROOT_DIR}/include/ CACHE PATH "The global include path for Poco")
|
||||
endif()
|
||||
|
||||
# append the default minimum components to the list to find
|
||||
list(APPEND components
|
||||
${Poco_FIND_COMPONENTS}
|
||||
# default components:
|
||||
"Util"
|
||||
"Foundation"
|
||||
)
|
||||
list(REMOVE_DUPLICATES components) # remove duplicate defaults
|
||||
|
||||
foreach( component ${components} )
|
||||
#if(NOT Poco_${component}_FOUND)
|
||||
|
||||
# include directory for the component
|
||||
if(NOT Poco_${component}_INCLUDE_DIR)
|
||||
if (${component} STREQUAL "DataODBC")
|
||||
set (component_in_data "ODBC")
|
||||
else ()
|
||||
set (component_in_data "")
|
||||
endif ()
|
||||
find_path(Poco_${component}_INCLUDE_DIR
|
||||
NAMES
|
||||
Poco/${component}.h # e.g. Foundation.h
|
||||
Poco/${component}/${component}.h # e.g. OSP/OSP.h Util/Util.h
|
||||
Poco/Data/${component_in_data}/${component_in_data}.h # e.g. Data/ODBC/ODBC.h
|
||||
HINTS
|
||||
${Poco_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
${component}/include
|
||||
)
|
||||
endif()
|
||||
if(NOT Poco_${component}_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "Poco_${component}_INCLUDE_DIR NOT FOUND")
|
||||
else()
|
||||
list(APPEND Poco_INCLUDE_DIRS ${Poco_${component}_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# release library
|
||||
if(NOT Poco_${component}_LIBRARY)
|
||||
find_library(
|
||||
Poco_${component}_LIBRARY
|
||||
NAMES Poco${component}
|
||||
HINTS ${Poco_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
bin
|
||||
)
|
||||
if(Poco_${component}_LIBRARY)
|
||||
message(STATUS "Found Poco ${component}: ${Poco_${component}_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
if(Poco_${component}_LIBRARY)
|
||||
list(APPEND Poco_LIBRARIES "optimized" ${Poco_${component}_LIBRARY} )
|
||||
mark_as_advanced(Poco_${component}_LIBRARY)
|
||||
endif()
|
||||
|
||||
# debug library
|
||||
if(NOT Poco_${component}_LIBRARY_DEBUG)
|
||||
find_library(
|
||||
Poco_${component}_LIBRARY_DEBUG
|
||||
Names Poco${component}d
|
||||
HINTS ${Poco_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
bin
|
||||
)
|
||||
if(Poco_${component}_LIBRARY_DEBUG)
|
||||
message(STATUS "Found Poco ${component} (debug): ${Poco_${component}_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
endif(NOT Poco_${component}_LIBRARY_DEBUG)
|
||||
if(Poco_${component}_LIBRARY_DEBUG)
|
||||
list(APPEND Poco_LIBRARIES "debug" ${Poco_${component}_LIBRARY_DEBUG})
|
||||
mark_as_advanced(Poco_${component}_LIBRARY_DEBUG)
|
||||
endif()
|
||||
|
||||
# mark component as found or handle not finding it
|
||||
if(Poco_${component}_LIBRARY_DEBUG OR Poco_${component}_LIBRARY)
|
||||
set(Poco_${component}_FOUND TRUE)
|
||||
elseif(NOT Poco_FIND_QUIETLY)
|
||||
message(FATAL_ERROR "Could not find Poco component ${component}!")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(DEFINED Poco_LIBRARIES)
|
||||
set(Poco_FOUND true)
|
||||
endif()
|
||||
|
||||
if(${Poco_OSP_FOUND})
|
||||
# find the osp bundle program
|
||||
find_program(
|
||||
Poco_OSP_Bundle_EXECUTABLE
|
||||
NAMES bundle
|
||||
HINTS
|
||||
${Poco_RUNTIME_LIBRARY_DIRS}
|
||||
${Poco_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
bin
|
||||
OSP/BundleCreator/bin/Darwin/x86_64
|
||||
OSP/BundleCreator/bin/Darwin/i386
|
||||
DOC "The executable that bundles OSP packages according to a .bndlspec specification."
|
||||
)
|
||||
if(Poco_OSP_Bundle_EXECUTABLE)
|
||||
set(Poco_OSP_Bundle_EXECUTABLE_FOUND true)
|
||||
endif()
|
||||
# include bundle script file
|
||||
find_file(Poco_OSP_Bundles_file NAMES PocoBundles.cmake HINTS ${CMAKE_MODULE_PATH})
|
||||
if(${Poco_OSP_Bundles_file})
|
||||
include(${Poco_OSP_Bundles_file})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Found Poco: ${Poco_LIBRARIES}")
|
||||
|
||||
|
@ -2,10 +2,12 @@ if (USE_INTERNAL_BOOST_LIBRARY)
|
||||
set (Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options_internal)
|
||||
set (Boost_SYSTEM_LIBRARY boost_system_internal)
|
||||
set (Boost_FILESYSTEM_LIBRARY boost_filesystem_internal)
|
||||
set (Boost_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/libboost/boost_1_62_0/")
|
||||
include_directories (BEFORE ${Boost_INCLUDE_DIRS})
|
||||
else ()
|
||||
set (Boost_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES})
|
||||
set (BOOST_ROOT "/usr/local")
|
||||
find_package (Boost 1.58 COMPONENTS program_options system filesystem regex thread)
|
||||
find_package (Boost 1.55 COMPONENTS program_options system filesystem regex thread)
|
||||
if (NOT Boost_FOUND)
|
||||
# Try to find manually.
|
||||
set (BOOST_HINTS "")
|
||||
@ -19,4 +21,8 @@ else ()
|
||||
find_library (Boost_FILESYSTEM_LIBRARY boost_filesystem HINTS ${BOOST_HINTS})
|
||||
endif ()
|
||||
endif ()
|
||||
include_directories (${Boost_INCLUDE_DIRS})
|
||||
endif ()
|
||||
|
||||
message(STATUS "Using Boost: ${Boost_INCLUDE_DIRS} : ${Boost_PROGRAM_OPTIONS_LIBRARY},${Boost_SYSTEM_LIBRARY},${Boost_FILESYSTEM_LIBRARY}")
|
||||
|
||||
|
11
cmake/find_gperftools.cmake
Normal file
11
cmake/find_gperftools.cmake
Normal file
@ -0,0 +1,11 @@
|
||||
if (USE_INTERNAL_GPERFTOOLS_LIBRARY)
|
||||
set(GPERFTOOLS_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libtcmalloc/include/")
|
||||
set(GPERFTOOLS_TCMALLOC tcmalloc_minimal_internal)
|
||||
include_directories (BEFORE ${GPERFTOOLS_INCLUDE_DIR})
|
||||
else ()
|
||||
find_package (Gperftools REQUIRED)
|
||||
include_directories (${GPERFTOOLS_INCLUDE_DIR})
|
||||
endif ()
|
||||
|
||||
message(STATUS "Using gperftools: ${GPERFTOOLS_INCLUDE_DIR} : ${GPERFTOOLS_TCMALLOC}")
|
||||
|
@ -28,4 +28,4 @@ endif ()
|
||||
|
||||
include_directories (${MYSQL_INCLUDE_DIR})
|
||||
|
||||
message (STATUS "mysqlclient found: MYSQLCLIENT_LIB=${MYSQLCLIENT_LIB} MYSQL_INCLUDE_DIR=${MYSQL_INCLUDE_DIR} STATIC_MYSQLCLIENT_LIB=${STATIC_MYSQLCLIENT_LIB}")
|
||||
message (STATUS "mysqlclient found: ${MYSQL_INCLUDE_DIR}; ${MYSQLCLIENT_LIB}; static=${STATIC_MYSQLCLIENT_LIB}")
|
||||
|
38
cmake/find_poco.cmake
Normal file
38
cmake/find_poco.cmake
Normal file
@ -0,0 +1,38 @@
|
||||
if (USE_INTERNAL_POCO_LIBRARY)
|
||||
set (Poco_INCLUDE_DIRS
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Foundation/include/"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Util/include/"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Net/include/"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/NetSSL_OpenSSL/include/"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/include/"
|
||||
#"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/MySQL/include/"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/ODBC/include/"
|
||||
#"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/SQLite/include/"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Crypto/include/"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/XML/include/"
|
||||
#"${ClickHouse_SOURCE_DIR}/contrib/libpoco/JSON/include/"
|
||||
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/MongoDB/include/"
|
||||
#"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Zip/include/"
|
||||
)
|
||||
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
set (Poco_INCLUDE_DIRS ${Poco_INCLUDE_DIRS} "${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng/" "${ClickHouse_BINARY_DIR}/contrib/libzlib-ng/")
|
||||
endif ()
|
||||
|
||||
set (Poco_Net_LIBRARY PocoNet)
|
||||
set (Poco_Util_LIBRARY PocoUtil)
|
||||
set (Poco_XML_LIBRARY PocoXML)
|
||||
set (Poco_NetSSL_OpenSSL_LIBRARY PocoNetSSL_OpenSSL)
|
||||
set (Poco_Data_LIBRARY PocoData)
|
||||
set (Poco_Crypto_LIBRARY PocoCrypto)
|
||||
set (Poco_DataODBC_LIBRARY PocoDataODBC)
|
||||
set (Poco_MongoDB_LIBRARY PocoMongoDB)
|
||||
set (Poco_Foundation_LIBRARY PocoFoundation)
|
||||
include_directories (BEFORE ${Poco_INCLUDE_DIRS})
|
||||
else ()
|
||||
find_package (Poco REQUIRED Util Net XML NetSSL_OpenSSL Data Crypto DataODBC MongoDB Foundation)
|
||||
include_directories (${Poco_INCLUDE_DIRS})
|
||||
endif ()
|
||||
|
||||
message(STATUS "Using Poco: ${Poco_INCLUDE_DIRS} : ${Poco_Net_LIBRARY},${Poco_Util_LIBRARY},${Poco_XML_LIBRARY},${Poco_Data_LIBRARY},${Poco_DataODBC_LIBRARY},${Poco_MongoDB_LIBRARY},${Poco_Foundation_LIBRARY}")
|
||||
|
7
contrib/CMakeLists.txt
vendored
7
contrib/CMakeLists.txt
vendored
@ -4,7 +4,10 @@ if (USE_INTERNAL_BOOST_LIBRARY)
|
||||
add_subdirectory (libboost)
|
||||
endif ()
|
||||
|
||||
add_subdirectory (libpoco)
|
||||
if (USE_INTERNAL_POCO_LIBRARY)
|
||||
add_subdirectory (libpoco)
|
||||
endif ()
|
||||
|
||||
add_subdirectory (liblz4)
|
||||
add_subdirectory (libzstd)
|
||||
add_subdirectory (libre2)
|
||||
@ -15,7 +18,7 @@ add_subdirectory (libfarmhash)
|
||||
add_subdirectory (libmetrohash)
|
||||
add_subdirectory (libzlib-ng)
|
||||
|
||||
if (ENABLE_LIBTCMALLOC)
|
||||
if (ENABLE_LIBTCMALLOC AND USE_INTERNAL_GPERFTOOLS_LIBRARY)
|
||||
add_subdirectory (libtcmalloc)
|
||||
endif ()
|
||||
|
||||
|
@ -81,7 +81,7 @@ option(POCO_ENABLE_DATA_SQLITE "Enable Data SQlite" OFF)
|
||||
option(POCO_ENABLE_DATA_MYSQL "Enable Data MySQL" OFF)
|
||||
option(POCO_ENABLE_DATA_ODBC "Enable Data ODBC" ON)
|
||||
option(POCO_ENABLE_SEVENZIP "Enable SevenZip" OFF)
|
||||
option(POCO_ENABLE_ZIP "Enable Zip" ON)
|
||||
option(POCO_ENABLE_ZIP "Enable Zip" OFF)
|
||||
option(POCO_ENABLE_APACHECONNECTOR "Enable ApacheConnector" OFF)
|
||||
option(POCO_ENABLE_CPPPARSER "Enable C++ parser" OFF)
|
||||
option(POCO_ENABLE_POCODOC "Enable Poco Documentation Generator" OFF)
|
||||
|
@ -11,6 +11,8 @@ POCO_HEADERS_AUTO( SRCS ${HDRS_G})
|
||||
|
||||
#add_definitions(-D_USRDLL)
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -18,6 +18,8 @@ if(MSVC AND NOT(MSVC_VERSION LESS 1400))
|
||||
PROPERTIES COMPILE_FLAGS "/bigobj")
|
||||
endif()
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -90,6 +90,8 @@ endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
|
||||
# TODO: Why is this here?
|
||||
add_definitions( -DPCRE_STATIC)
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS})
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -39,5 +39,6 @@
|
||||
//
|
||||
#define POCO_VERSION 0x01060100
|
||||
|
||||
#define POCO_CLICKHOUSE_PATCH 1
|
||||
|
||||
#endif // Foundation_Version_INCLUDED
|
||||
|
@ -9,6 +9,8 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
|
||||
file(GLOB_RECURSE HDRS_G "include/*.h" )
|
||||
POCO_HEADERS_AUTO( SRCS ${HDRS_G})
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -23,6 +23,8 @@ else()
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -9,6 +9,8 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
|
||||
file(GLOB_RECURSE HDRS_G "include/*.h" )
|
||||
POCO_HEADERS_AUTO( SRCS ${HDRS_G})
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -15,6 +15,8 @@ POCO_SOURCES_AUTO_PLAT( SRCS WIN32
|
||||
src/WinService.cpp
|
||||
)
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -32,6 +32,8 @@ else()
|
||||
add_definitions(-DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H)
|
||||
endif()
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -9,6 +9,8 @@ POCO_SOURCES_AUTO( SRCS ${SRCS_G})
|
||||
file(GLOB_RECURSE HDRS_G "include/*.h" )
|
||||
POCO_HEADERS_AUTO( SRCS ${HDRS_G})
|
||||
|
||||
include_directories (BEFORE include)
|
||||
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
|
@ -138,9 +138,10 @@ target_link_libraries(dbms
|
||||
re2 re2_st
|
||||
${OPENSSL_CRYPTO_LIBRARY}
|
||||
${Boost_SYSTEM_LIBRARY}
|
||||
PocoData
|
||||
PocoDataODBC
|
||||
PocoMongoDB
|
||||
${Poco_Data_LIBRARY}
|
||||
${Poco_DataODBC_LIBRARY}
|
||||
${Poco_MongoDB_LIBRARY}
|
||||
${Poco_Foundation_LIBRARY}
|
||||
${APPLE_ICONV_LIB}
|
||||
${PLATFORM_LIBS}
|
||||
${CMAKE_DL_LIBS}
|
||||
|
@ -83,7 +83,11 @@ public:
|
||||
session.setKeepAlive(true);
|
||||
|
||||
/// устанавливаем таймаут
|
||||
#if POCO_CLICKHOUSE_PATCH || POCO_VERSION >= 0x02000000
|
||||
session.setTimeout(connection_timeout, send_timeout, receive_timeout);
|
||||
#else
|
||||
session.setTimeout(connection_timeout);
|
||||
#endif
|
||||
|
||||
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, uri_str, Poco::Net::HTTPRequest::HTTP_1_1);
|
||||
|
||||
|
@ -49,7 +49,11 @@ InterserverWriteBuffer::InterserverWriteBuffer(const std::string & host_, int po
|
||||
session.setKeepAlive(true);
|
||||
|
||||
/// устанавливаем таймаут
|
||||
#if POCO_CLICKHOUSE_PATCH || POCO_VERSION >= 0x02000000
|
||||
session.setTimeout(connection_timeout, send_timeout, receive_timeout);
|
||||
#else
|
||||
session.setTimeout(connection_timeout);
|
||||
#endif
|
||||
|
||||
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, uri_str, Poco::Net::HTTPRequest::HTTP_1_1);
|
||||
|
||||
|
@ -70,7 +70,11 @@ ReadBufferFromHTTP::ReadBufferFromHTTP(
|
||||
session.setHost(resolveHost(host).toString()); /// Cache DNS forever (until server restart)
|
||||
session.setPort(port);
|
||||
|
||||
#if POCO_CLICKHOUSE_PATCH || POCO_VERSION >= 0x02000000
|
||||
session.setTimeout(connection_timeout, send_timeout, receive_timeout);
|
||||
#else
|
||||
session.setTimeout(connection_timeout);
|
||||
#endif
|
||||
|
||||
Poco::Net::HTTPRequest request(method, path_params.str());
|
||||
Poco::Net::HTTPResponse response;
|
||||
|
@ -49,7 +49,11 @@ ReadWriteBufferFromHTTP::ReadWriteBufferFromHTTP(
|
||||
session.setHost(resolveHost(uri.getHost()).toString()); /// Cache DNS forever (until server restart)
|
||||
session.setPort(uri.getPort());
|
||||
|
||||
#if POCO_CLICKHOUSE_PATCH || POCO_VERSION >= 0x02000000
|
||||
session.setTimeout(timeouts.connection_timeout, timeouts.send_timeout, timeouts.receive_timeout);
|
||||
#else
|
||||
session.setTimeout(timeouts.connection_timeout);
|
||||
#endif
|
||||
|
||||
Poco::Net::HTTPRequest request(method, uri.getPathAndQuery(), Poco::Net::HTTPRequest::HTTP_1_1);
|
||||
if (out_stream_callback)
|
||||
|
@ -16,5 +16,10 @@ git clone https://github.com/yandex/ClickHouse.git
|
||||
mkdir -p ClickHouse/build
|
||||
cd ClickHouse/build
|
||||
cmake .. -DCMAKE_CXX_COMPILER=`which g++6` -DCMAKE_C_COMPILER=`which gcc6`
|
||||
|
||||
# WIP: variant with libs from ports:
|
||||
# pkg install boost-libs poco google-perftools
|
||||
# cmake .. -DCMAKE_CXX_COMPILER=`which g++6` -DCMAKE_C_COMPILER=`which gcc6` -DUSE_INTERNAL_BOOST_LIBRARY=0 -DUSE_INTERNAL_POCO_LIBRARY=0 -DUSE_INTERNAL_GPERFTOOLS_LIBRARY=0 -DCXX11_ABI= -DUSE_STATIC_LIBRARIES=0
|
||||
|
||||
make -j $(nproc || sysctl -n hw.ncpu || echo 2)
|
||||
cd ..
|
||||
|
@ -68,7 +68,7 @@ if (ENABLE_LIBTCMALLOC)
|
||||
set (MALLOC_LIBRARIES libtcmalloc_minimal_debug.a)
|
||||
else ()
|
||||
message (STATUS "Link libtcmalloc_minimal")
|
||||
set (MALLOC_LIBRARIES tcmalloc_minimal_internal)
|
||||
set (MALLOC_LIBRARIES ${GPERFTOOLS_TCMALLOC})
|
||||
endif ()
|
||||
else ()
|
||||
message (STATUS "Disabling libtcmalloc for valgrind better analysis")
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
|
||||
double musl_exp10(double x);
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
//const auto& exp10 = musl_exp10; // it must be the name of a function with external linkage
|
||||
#define exp10 musl_exp10
|
||||
#endif
|
||||
|
@ -142,7 +142,11 @@ protected:
|
||||
virtual void handleSignal(int signal_id);
|
||||
|
||||
/// реализация обработки сигналов завершения через pipe не требует блокировки сигнала с помощью sigprocmask во всех потоках
|
||||
void waitForTerminationRequest() override;
|
||||
void waitForTerminationRequest()
|
||||
#if POCO_CLICKHOUSE_PATCH || POCO_VERSION >= 0x02000000 // in old upstream poco not vitrual
|
||||
override
|
||||
#endif
|
||||
;
|
||||
/// thread safe
|
||||
virtual void onInterruptSignals(int signal_id);
|
||||
|
||||
|
@ -4,5 +4,5 @@ add_executable (mysqlxx_test mysqlxx_test.cpp)
|
||||
add_executable (failover failover.cpp)
|
||||
|
||||
target_link_libraries (mysqlxx_test mysqlxx dbms ${RT_LIBRARIES})
|
||||
target_link_libraries (failover mysqlxx PocoUtil PocoFoundation)
|
||||
target_link_libraries (failover mysqlxx ${Poco_Util_LIBRARY} ${Poco_Foundation_LIBRARY})
|
||||
target_link_rt_by_force (failover)
|
||||
|
@ -5,5 +5,7 @@ add_library (pocoext
|
||||
include/Poco/Ext/LevelFilterChannel.h
|
||||
include/Poco/Ext/ThreadNumber.h)
|
||||
|
||||
add_dependencies (pocoext PocoUtil PocoNet PocoXML PocoFoundation)
|
||||
target_link_libraries(pocoext PocoUtil PocoNet PocoXML PocoFoundation)
|
||||
if (USE_INTERNAL_POCO_LIBRARY)
|
||||
add_dependencies (pocoext ${Poco_Util_LIBRARY} ${Poco_Net_LIBRARY} ${Poco_XML_LIBRARY} ${Poco_Foundation_LIBRARY})
|
||||
endif ()
|
||||
target_link_libraries(pocoext ${Poco_Util_LIBRARY} ${Poco_Net_LIBRARY} ${Poco_XML_LIBRARY} ${Poco_Foundation_LIBRARY})
|
||||
|
@ -18,6 +18,6 @@ add_library(zkutil
|
||||
|
||||
find_package (Threads)
|
||||
|
||||
target_link_libraries(zkutil zookeeper PocoFoundation ${CMAKE_THREAD_LIBS_INIT} string_utils)
|
||||
target_link_libraries(zkutil zookeeper ${Poco_Foundation_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} string_utils)
|
||||
|
||||
add_subdirectory (src)
|
||||
|
Loading…
Reference in New Issue
Block a user