mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
cmake: More options. [#METR-23701]
This commit is contained in:
parent
02eb36fd03
commit
bcc5500f91
@ -8,7 +8,13 @@ insert_final_newline = true
|
||||
|
||||
# Matches multiple files with brace expansion notation
|
||||
# Set default charset
|
||||
[*.{c,cpp,cxx,h,hpp,hxx,py}]
|
||||
[*.{c,cpp,cxx,h,hpp,hxx,py,cmake}]
|
||||
charset = utf-8
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[CMakeLists.txt]
|
||||
charset = utf-8
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
220
CMakeLists.txt
220
CMakeLists.txt
@ -1,108 +1,123 @@
|
||||
project (ClickHouse)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# require at least gcc 5
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# Require at least gcc 5
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
|
||||
message(FATAL_ERROR "GCC version must be at least 5! For example, if GCC 5 is available under gcc-5, g++-5 names, do the following: export CC=gcc-5 CXX=g++-5; rm -rf CMakeCache.txt CMakeFiles; and re run cmake or ./release.")
|
||||
endif()
|
||||
message (FATAL_ERROR "GCC version must be at least 5! For example, if GCC 5 is available under gcc-5, g++-5 names, do the following: export CC=gcc-5 CXX=g++-5; rm -rf CMakeCache.txt CMakeFiles; and re run cmake or ./release.")
|
||||
endif ()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# require at least clang 3.8
|
||||
# Require at least clang 3.8
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8)
|
||||
message(FATAL_ERROR "Clang version must be at least 3.8!")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang 3.8+ and GCC 5+.")
|
||||
endif()
|
||||
message (FATAL_ERROR "Clang version must be at least 3.8!")
|
||||
endif ()
|
||||
else ()
|
||||
message (WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang 3.8+ and GCC 5+.")
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
set(APPLE_EXTRA_CXX_FLAG "-Dexp10=__exp10") # Also needed for libc++
|
||||
endif()
|
||||
|
||||
# отключаем варнинг о том, что в каждой директории должен быть CMakeLists.txt
|
||||
cmake_policy(SET CMP0014 OLD)
|
||||
set (APPLE_EXTRA_CXX_FLAG "-Dexp10=__exp10") # Also needed for libc++
|
||||
endif ()
|
||||
|
||||
cmake_policy(SET CMP0014 OLD) # Ignore warning about CMakeLists.txt in each directory
|
||||
cmake_policy(SET CMP0012 NEW) # Don't dereference TRUE and FALSE
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "CMAKE_BUILD_TYPE is not set, set to default = RELWITHDEBINFO")
|
||||
SET(CMAKE_BUILD_TYPE "RELWITHDEBINFO")
|
||||
ENDIF()
|
||||
MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
message (STATUS "CMAKE_BUILD_TYPE is not set, set to default = RELWITHDEBINFO")
|
||||
set (CMAKE_BUILD_TYPE "RELWITHDEBINFO")
|
||||
endif ()
|
||||
message (STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
|
||||
|
||||
# ASan - build type with address sanitizer
|
||||
# UBSan - build type with undefined behaviour sanitizer
|
||||
# TSan is not supported due to false positive errors in libstdc++ and necessity to rebuild libstdc++ with TSan
|
||||
set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release;MinSizeRel;ASan;UBSan" CACHE STRING "" FORCE)
|
||||
set (CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release;MinSizeRel;ASan;UBSan" CACHE STRING "" FORCE)
|
||||
|
||||
|
||||
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
|
||||
SET(AARCH64 1)
|
||||
ENDIF()
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
|
||||
set (AARCH64 1)
|
||||
endif ()
|
||||
|
||||
IF (NOT AARCH64)
|
||||
SET(MACHINE_FLAGS "-msse4 -mpopcnt")
|
||||
ENDIF()
|
||||
if (NOT AARCH64)
|
||||
set (MACHINE_FLAGS "-msse4 -mpopcnt")
|
||||
endif ()
|
||||
|
||||
SET(COMMON_WARNING_FLAGS "-Wall -Werror")
|
||||
SET(CXX_WARNING_FLAGS "-Wnon-virtual-dtor -Wold-style-cast")
|
||||
set (COMMON_WARNING_FLAGS "-Wall -Werror")
|
||||
set (CXX_WARNING_FLAGS "-Wnon-virtual-dtor -Wold-style-cast")
|
||||
|
||||
set (ENABLE_CXX11_ABI TRUE CACHE BOOL "Enables C++11 ABI")
|
||||
set (TEST_COVERAGE FALSE CACHE BOOL "Enables flags for test coverage")
|
||||
set (ENABLE_TESTS TRUE CACHE BOOL "Enables tests")
|
||||
|
||||
set (USE_STATIC_LIBRARIES TRUE CACHE BOOL "Set to FALSE to use shared libraries")
|
||||
if (NOT $ENV{USE_STATIC_LIBRARIES})
|
||||
set (USE_STATIC_LIBRARIES FALSE)
|
||||
endif ()
|
||||
|
||||
set (GLIBC_COMPATIBILITY FALSE CACHE BOOL "Set to TRUE to enable compatibility with older glibc libraries")
|
||||
|
||||
if ($ENV{GLIBC_COMPATIBILITY})
|
||||
set (GLIBC_COMPATIBILITY TRUE)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
set (ENABLE_MONGODB TRUE CACHE BOOL "Set to TRUE to enable MongoDB support as source for external dictionaries")
|
||||
if (NOT $ENV{ENABLE_MONGODB})
|
||||
set (ENABLE_MONGODB FALSE)
|
||||
endif ()
|
||||
|
||||
set (ENABLE_LIBTCMALLOC TRUE CACHE BOOL "Set to TRUE to enable libtcmalloc.")
|
||||
if (NOT $ENV{ENABLE_LIBTCMALLOC})
|
||||
set (ENABLE_LIBTCMALLOC FALSE)
|
||||
endif ()
|
||||
|
||||
set (DEBUG_LIBTCMALLOC FALSE CACHE BOOL "Set to TRUE to use debug version of libtcmalloc.")
|
||||
if ($ENV{DEBUG_LIBTCMALLOC})
|
||||
set (ENABLE_LIBTCMALLOC TRUE)
|
||||
endif ()
|
||||
|
||||
if (GLIBC_COMPATIBILITY)
|
||||
SET(GLIBC_COMPATIBILITY_COMPILE_FLAGS "-include ${ClickHouse_SOURCE_DIR}/libs/libcommon/include/common/glibc_compatibility.h")
|
||||
SET(GLIBC_COMPATIBILITY_LINK_FLAGS "-Wl,--wrap=memcpy")
|
||||
endif()
|
||||
set (GLIBC_COMPATIBILITY_COMPILE_FLAGS "-include ${ClickHouse_SOURCE_DIR}/libs/libcommon/include/common/glibc_compatibility.h")
|
||||
set (GLIBC_COMPATIBILITY_LINK_FLAGS "-Wl,--wrap=memcpy")
|
||||
endif ()
|
||||
|
||||
if (DISABLE_CXX11_ABI)
|
||||
SET(CXX11_ABI "-D_GLIBCXX_USE_CXX11_ABI=0")
|
||||
endif()
|
||||
if (NOT ENABLE_CXX11_ABI)
|
||||
set (CXX11_ABI "-D_GLIBCXX_USE_CXX11_ABI=0")
|
||||
endif ()
|
||||
|
||||
SET(CMAKE_BUILD_COLOR_MAKEFILE ON)
|
||||
SET(CMAKE_CXX_FLAGS "-std=gnu++1y ${APPLE_EXTRA_CXX_FLAG} -fno-omit-frame-pointer ${COMMON_WARNING_FLAGS} ${CXX_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI}")
|
||||
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_BUILD_COLOR_MAKEFILE ON)
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++1y ${APPLE_EXTRA_CXX_FLAG} -fno-omit-frame-pointer ${COMMON_WARNING_FLAGS} ${CXX_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI}")
|
||||
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_C_FLAGS "-fno-omit-frame-pointer ${COMMON_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI}")
|
||||
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 "-fno-omit-frame-pointer ${COMMON_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI}")
|
||||
set (CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g")
|
||||
set (CMAKE_C_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline")
|
||||
|
||||
if (NOT APPLE)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ ${GLIBC_COMPATIBILITY_LINK_FLAGS} ${CXX11_ABI}")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ ${GLIBC_COMPATIBILITY_LINK_FLAGS} ${CXX11_ABI}")
|
||||
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}")
|
||||
SET(CMAKE_CXX_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI}")
|
||||
SET(CMAKE_C_FLAGS_ASAN "-O3 -g -fsanitize=address -fno-omit-frame-pointer -fuse-ld=gold ${CXX11_ABI}")
|
||||
SET(CMAKE_C_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI}")
|
||||
# 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}")
|
||||
set (CMAKE_CXX_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI}")
|
||||
set (CMAKE_C_FLAGS_ASAN "-O3 -g -fsanitize=address -fno-omit-frame-pointer -fuse-ld=gold ${CXX11_ABI}")
|
||||
set (CMAKE_C_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI}")
|
||||
|
||||
# Флаги для test coverage
|
||||
IF (TEST_COVERAGE)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage -fPIC -DIS_DEBUG ${CXX11_ABI}")
|
||||
ENDIF(TEST_COVERAGE)
|
||||
# Flags for test coverage
|
||||
if (TEST_COVERAGE)
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage -fPIC -DIS_DEBUG ${CXX11_ABI}")
|
||||
endif (TEST_COVERAGE)
|
||||
|
||||
# Собирать тесты?
|
||||
IF (NOT DEFINED TESTS)
|
||||
MESSAGE(STATUS "Tests are enabled")
|
||||
SET(TESTS YES)
|
||||
ENDIF()
|
||||
# Run tests with "make check"
|
||||
if (ENABLE_TESTS)
|
||||
message (STATUS "Tests are enabled")
|
||||
include (add.test.cmake)
|
||||
endif (ENABLE_TESTS)
|
||||
|
||||
# тесты запускать с помощью "make check"
|
||||
IF(TESTS)
|
||||
INCLUDE(add.test.cmake)
|
||||
ENDIF(TESTS)
|
||||
|
||||
# Префикс для установки
|
||||
SET(CMAKE_INSTALL_PREFIX /usr)
|
||||
# Installation prefix
|
||||
set (CMAKE_INSTALL_PREFIX /usr)
|
||||
|
||||
include_directories (${ClickHouse_SOURCE_DIR}/contrib/libcityhash/include/)
|
||||
include_directories (${ClickHouse_SOURCE_DIR}/contrib/liblz4/include/)
|
||||
@ -145,11 +160,11 @@ include_directories (/usr/local/lib/glib-2.0/include/)
|
||||
include_directories (/usr/include/glib-2.0/)
|
||||
include_directories (/usr/lib64/glib-2.0/include/)
|
||||
|
||||
IF (AARCH64)
|
||||
if (AARCH64)
|
||||
include_directories (/usr/lib/aarch64-linux-gnu/glib-2.0/include/)
|
||||
ELSE()
|
||||
else ()
|
||||
include_directories (/usr/lib/x86_64-linux-gnu/glib-2.0/include/)
|
||||
ENDIF()
|
||||
endif ()
|
||||
|
||||
include_directories (/usr/local/include/)
|
||||
|
||||
@ -160,47 +175,64 @@ link_directories (/usr/local/lib)
|
||||
# 1. openssl
|
||||
include_directories ("/usr/local/opt/openssl/include")
|
||||
set (OPENSSL_HINTS "/usr/local/opt/openssl/lib")
|
||||
find_library (LIBSSL libssl.a HINTS ${OPENSSL_HINTS})
|
||||
find_library (LIBCRYPTO libcrypto.a HINTS ${OPENSSL_HINTS})
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (LIBSSL libssl.a HINTS ${OPENSSL_HINTS})
|
||||
find_library (LIBCRYPTO libcrypto.a HINTS ${OPENSSL_HINTS})
|
||||
else ()
|
||||
find_library (LIBSSL ssl HINTS ${OPENSSL_HINTS})
|
||||
find_library (LIBCRYPTO crypto HINTS ${OPENSSL_HINTS})
|
||||
endif ()
|
||||
set (OPENSSL_LIBS ${LIBSSL} ${LIBCRYPTO})
|
||||
|
||||
# 2. icu4c
|
||||
include_directories ("/usr/local/opt/icu4c/include")
|
||||
set (ICU_HINTS "/usr/local/opt/icu4c/lib")
|
||||
find_library (ICUI18N libicui18n.a HINTS ${ICU_HINTS})
|
||||
find_library (ICUUC libicuuc.a HINTS ${ICU_HINTS})
|
||||
find_library (ICUDATA libicudata.a HINTS ${ICU_HINTS})
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (ICUI18N libicui18n.a HINTS ${ICU_HINTS})
|
||||
find_library (ICUUC libicuuc.a HINTS ${ICU_HINTS})
|
||||
find_library (ICUDATA libicudata.a HINTS ${ICU_HINTS})
|
||||
else ()
|
||||
find_library (ICUI18N icui18n HINTS ${ICU_HINTS})
|
||||
find_library (ICUUC icuuc HINTS ${ICU_HINTS})
|
||||
find_library (ICUDATA icudata HINTS ${ICU_HINTS})
|
||||
endif ()
|
||||
set (ICU_LIBS ${ICUI18N} ${ICUUC} ${ICUDATA})
|
||||
|
||||
# 3. boost
|
||||
set (BOOST_HINTS "/usr/local/opt/boost/lib")
|
||||
find_library (BOOST_PROGRAM_OPTIONS_LIB libboost_program_options.a HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_SYSTEM_LIB libboost_system.a HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_FILESYSTEM_LIB libboost_filesystem.a HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_REGEX_LIB libboost_regex.a HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_THREAD_LIB libboost_thread.a HINTS ${BOOST_HINTS})
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (BOOST_PROGRAM_OPTIONS_LIB libboost_program_options.a HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_SYSTEM_LIB libboost_system.a HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_FILESYSTEM_LIB libboost_filesystem.a HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_REGEX_LIB libboost_regex.a HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_THREAD_LIB libboost_thread.a HINTS ${BOOST_HINTS})
|
||||
else ()
|
||||
find_library (BOOST_PROGRAM_OPTIONS_LIB boost_program_options HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_SYSTEM_LIB boost_system HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_FILESYSTEM_LIB boost_filesystem HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_REGEX_LIB boost_regex HINTS ${BOOST_HINTS})
|
||||
find_library (BOOST_THREAD_LIB boost_thread HINTS ${BOOST_HINTS})
|
||||
endif ()
|
||||
|
||||
# 4. ltdl
|
||||
set (LTDL_HINTS "/usr/local/opt/libtool/lib")
|
||||
find_library (LTDL_LIB libltdl.a HINTS ${LTDL_HINTS})
|
||||
|
||||
# 5. tcmalloc
|
||||
if(NOT DEFINED DISABLE_LIBTCMALLOC)
|
||||
set(DISABLE_LIBTCMALLOC $ENV{DISABLE_LIBTCMALLOC} CACHE STRING "Don't use libtcmalloc" FORCE)
|
||||
set(DEBUG_LIBTCMALLOC $ENV{DEBUG_LIBTCMALLOC} CACHE STRING "Use debug version of libtcmalloc" FORCE)
|
||||
endif()
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (LTDL_LIB libltdl.a HINTS ${LTDL_HINTS})
|
||||
else ()
|
||||
find_library (LTDL_LIB ltdl HINTS ${LTDL_HINTS})
|
||||
endif ()
|
||||
|
||||
# Directory for Yandex specific files
|
||||
SET(CLICKHOUSE_PRIVATE_DIR ${ClickHouse_SOURCE_DIR}/private/)
|
||||
set (CLICKHOUSE_PRIVATE_DIR ${ClickHouse_SOURCE_DIR}/private/)
|
||||
|
||||
add_subdirectory (contrib)
|
||||
add_subdirectory (libs)
|
||||
add_subdirectory (utils)
|
||||
add_subdirectory (dbms)
|
||||
|
||||
IF (EXISTS ${CLICKHOUSE_PRIVATE_DIR})
|
||||
if (EXISTS ${CLICKHOUSE_PRIVATE_DIR})
|
||||
add_subdirectory (private)
|
||||
ENDIF()
|
||||
endif ()
|
||||
|
||||
message(STATUS "C_FLAGS: =${CMAKE_C_FLAGS}")
|
||||
message(STATUS "CXX_FLAGS:=${CMAKE_CXX_FLAGS}")
|
||||
message (STATUS "C_FLAGS: =${CMAKE_C_FLAGS}")
|
||||
message (STATUS "CXX_FLAGS:=${CMAKE_CXX_FLAGS}")
|
||||
|
@ -1,13 +1,13 @@
|
||||
# добавляем вывод программы при ошибке теста
|
||||
# Adding test output on failure
|
||||
enable_testing()
|
||||
if (CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
--force-new-ctest-process --output-on-failure
|
||||
--build-config "$<CONFIGURATION>")
|
||||
else()
|
||||
else ()
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
--force-new-ctest-process --output-on-failure)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
macro (add_check target)
|
||||
add_test(NAME test_${target} COMMAND ${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
10
contrib/CMakeLists.txt
vendored
10
contrib/CMakeLists.txt
vendored
@ -1,4 +1,4 @@
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
|
||||
|
||||
add_subdirectory (libcityhash)
|
||||
add_subdirectory (liblz4)
|
||||
@ -10,10 +10,10 @@ add_subdirectory (libpoco)
|
||||
add_subdirectory (libre2)
|
||||
add_subdirectory (libzookeeper)
|
||||
|
||||
if (NOT DISABLE_LIBTCMALLOC)
|
||||
if (ENABLE_LIBTCMALLOC)
|
||||
add_subdirectory (libtcmalloc)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
IF (NOT AARCH64)
|
||||
if (NOT AARCH64)
|
||||
add_subdirectory (libcpuid)
|
||||
ENDIF()
|
||||
endif ()
|
||||
|
@ -1,8 +1,8 @@
|
||||
include_directories (${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
IF (NOT AARCH64) # Не используется. Портировать не сложно.
|
||||
SET(SOURCES_ONLY_ON_X86_64 src/metrohash128crc.cpp)
|
||||
ENDIF()
|
||||
if (NOT AARCH64) # Not used. Pretty easy to port.
|
||||
set (SOURCES_ONLY_ON_X86_64 src/metrohash128crc.cpp)
|
||||
endif ()
|
||||
|
||||
add_library(metrohash
|
||||
src/metrohash.h
|
||||
|
@ -101,14 +101,14 @@ option(POCO_UNBUNDLED
|
||||
"Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF)
|
||||
|
||||
# Uncomment from next two lines to force statitc or dynamic library, default is autodetection
|
||||
if(POCO_STATIC)
|
||||
if (POCO_STATIC)
|
||||
add_definitions( -DPOCO_STATIC -DPOCO_NO_AUTOMATIC_LIBS)
|
||||
set( LIB_MODE STATIC )
|
||||
message(STATUS "Building static libraries")
|
||||
else(POCO_STATIC)
|
||||
else (POCO_STATIC)
|
||||
set( LIB_MODE SHARED )
|
||||
message(STATUS "Building dynamic libraries")
|
||||
endif(POCO_STATIC)
|
||||
endif (POCO_STATIC)
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
include(CTest)
|
||||
@ -172,46 +172,46 @@ endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
|
||||
# iOS
|
||||
if (IOS)
|
||||
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES )
|
||||
endif(IOS)
|
||||
endif (IOS)
|
||||
|
||||
#Android
|
||||
if (ANDROID)
|
||||
add_definitions( -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY )
|
||||
endif(ANDROID)
|
||||
endif (ANDROID)
|
||||
|
||||
|
||||
# Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file
|
||||
set(Poco_COMPONENTS "")
|
||||
set (Poco_COMPONENTS "")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(CppUnit)
|
||||
#if (ENABLE_TESTS)
|
||||
# add_subdirectory (CppUnit)
|
||||
#endif ()
|
||||
|
||||
add_subdirectory (Foundation)
|
||||
if (ENABLE_XML)
|
||||
add_subdirectory (XML)
|
||||
list (APPEND Poco_COMPONENTS "XML")
|
||||
endif ()
|
||||
|
||||
add_subdirectory(Foundation)
|
||||
if(ENABLE_XML)
|
||||
add_subdirectory(XML)
|
||||
list(APPEND Poco_COMPONENTS "XML")
|
||||
endif()
|
||||
if(ENABLE_JSON)
|
||||
add_subdirectory(JSON)
|
||||
list(APPEND Poco_COMPONENTS "JSON")
|
||||
endif()
|
||||
if(ENABLE_MONGODB)
|
||||
add_subdirectory(MongoDB)
|
||||
list(APPEND Poco_COMPONENTS "MongoDB")
|
||||
endif()
|
||||
if(ENABLE_PDF)
|
||||
add_subdirectory(PDF)
|
||||
list(APPEND Poco_COMPONENTS "PDF")
|
||||
endif()
|
||||
if(ENABLE_UTIL)
|
||||
add_subdirectory(Util)
|
||||
list(APPEND Poco_COMPONENTS "Util")
|
||||
endif()
|
||||
if(ENABLE_NET)
|
||||
add_subdirectory(Net)
|
||||
list(APPEND Poco_COMPONENTS "Net")
|
||||
if (ENABLE_JSON)
|
||||
add_subdirectory (JSON)
|
||||
list (APPEND Poco_COMPONENTS "JSON")
|
||||
endif ()
|
||||
if (ENABLE_MONGODB)
|
||||
add_subdirectory (MongoDB)
|
||||
list (APPEND Poco_COMPONENTS "MongoDB")
|
||||
endif ()
|
||||
if (ENABLE_PDF)
|
||||
add_subdirectory (PDF)
|
||||
list (APPEND Poco_COMPONENTS "PDF")
|
||||
endif()
|
||||
if (ENABLE_UTIL)
|
||||
add_subdirectory (Util)
|
||||
list (APPEND Poco_COMPONENTS "Util")
|
||||
endif ()
|
||||
if (ENABLE_NET)
|
||||
add_subdirectory (Net)
|
||||
list (APPEND Poco_COMPONENTS "Net")
|
||||
endif ()
|
||||
|
||||
|
||||
#NetSSL
|
||||
|
@ -1,59 +1,56 @@
|
||||
SET(re2_headers
|
||||
./re2/tostring.cc
|
||||
./re2/dfa.cc
|
||||
./re2/prefilter.cc
|
||||
./re2/compile.cc
|
||||
./re2/regexp.cc
|
||||
./re2/onepass.cc
|
||||
./re2/prefilter_tree.cc
|
||||
./re2/set.cc
|
||||
./re2/filtered_re2.cc
|
||||
./re2/perl_groups.cc
|
||||
./re2/parse.cc
|
||||
./re2/nfa.cc
|
||||
./re2/bitstate.cc
|
||||
./re2/simplify.cc
|
||||
./re2/unicode_groups.cc
|
||||
./re2/mimics_pcre.cc
|
||||
./re2/re2.cc
|
||||
./re2/prog.cc
|
||||
./re2/unicode_casefold.cc
|
||||
./util/test.cc
|
||||
./util/strutil.cc
|
||||
./util/stringpiece.cc
|
||||
./util/hash.cc
|
||||
./util/arena.cc
|
||||
./util/benchmark.cc
|
||||
./util/valgrind.cc
|
||||
./util/pcre.cc
|
||||
./util/stringprintf.cc
|
||||
./util/rune.cc
|
||||
./util/random.cc
|
||||
./util/thread.cc
|
||||
set (re2_headers
|
||||
./re2/tostring.cc
|
||||
./re2/dfa.cc
|
||||
./re2/prefilter.cc
|
||||
./re2/compile.cc
|
||||
./re2/regexp.cc
|
||||
./re2/onepass.cc
|
||||
./re2/prefilter_tree.cc
|
||||
./re2/set.cc
|
||||
./re2/filtered_re2.cc
|
||||
./re2/perl_groups.cc
|
||||
./re2/parse.cc
|
||||
./re2/nfa.cc
|
||||
./re2/bitstate.cc
|
||||
./re2/simplify.cc
|
||||
./re2/unicode_groups.cc
|
||||
./re2/mimics_pcre.cc
|
||||
./re2/re2.cc
|
||||
./re2/prog.cc
|
||||
./re2/unicode_casefold.cc
|
||||
./util/test.cc
|
||||
./util/strutil.cc
|
||||
./util/stringpiece.cc
|
||||
./util/hash.cc
|
||||
./util/arena.cc
|
||||
./util/benchmark.cc
|
||||
./util/valgrind.cc
|
||||
./util/pcre.cc
|
||||
./util/stringprintf.cc
|
||||
./util/rune.cc
|
||||
./util/random.cc
|
||||
./util/thread.cc
|
||||
)
|
||||
|
||||
# Смысл в том, чтобы собрать две версии библиотеки - потокобезопасную (re2) и непотокобезопасную (re2_st).
|
||||
# Библиотека re2, при выполнении регекспа, изменяет некоторое состояние - создаёт временные DFA.
|
||||
# Для того, чтобы один объект-регексп можно было использовать одновременно из разных потоков, она использует RWLock.
|
||||
# При этом, даже если использовать в разных потоках разные объекты re2 (созданные из одинакового регекспа),
|
||||
# то, не смотря на отсутствие блокировок, RWLock "вхолостую" всё-равно очень существенно тормозит.
|
||||
# Решение: собрать непотокобезопасную версию библиотеки и использовать разные объекты re2 в разных потоках.
|
||||
|
||||
add_definitions( -DNDEBUG )
|
||||
# Building re2 which is thread-safe and re2_st which is not.
|
||||
# re2 changes its state during matching of regular expression, e.g. creates temporary DFA.
|
||||
# It uses RWLock to process the same regular expression object from different threads.
|
||||
# In order to avoid redundant locks in some cases, we use not thread-safe version of the library (re2_st).
|
||||
add_definitions (-DNDEBUG)
|
||||
|
||||
add_library (re2 ${re2_headers})
|
||||
add_library (re2_st ${re2_headers})
|
||||
|
||||
set_target_properties(re2_st PROPERTIES COMPILE_DEFINITIONS "NO_THREADS;re2=re2_st")
|
||||
set_target_properties (re2_st PROPERTIES COMPILE_DEFINITIONS "NO_THREADS;re2=re2_st")
|
||||
|
||||
message ("Creating headers for re2_st library.")
|
||||
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/re2_st)
|
||||
foreach (FILENAME filtered_re2.h re2.h set.h stringpiece.h variadic_function.h)
|
||||
file (READ ${CMAKE_CURRENT_SOURCE_DIR}/re2/${FILENAME} CONTENT)
|
||||
string(REGEX REPLACE "using re2::RE2;" "" CONTENT "${CONTENT}")
|
||||
string(REGEX REPLACE "namespace re2" "namespace re2_st" CONTENT "${CONTENT}")
|
||||
string(REGEX REPLACE "re2::" "re2_st::" CONTENT "${CONTENT}")
|
||||
string(REGEX REPLACE "\"re2/" "\"re2_st/" CONTENT "${CONTENT}")
|
||||
string(REGEX REPLACE "(.\\*?_H)" "\\1_ST" CONTENT "${CONTENT}")
|
||||
string (REGEX REPLACE "using re2::RE2;" "" CONTENT "${CONTENT}")
|
||||
string (REGEX REPLACE "namespace re2" "namespace re2_st" CONTENT "${CONTENT}")
|
||||
string (REGEX REPLACE "re2::" "re2_st::" CONTENT "${CONTENT}")
|
||||
string (REGEX REPLACE "\"re2/" "\"re2_st/" CONTENT "${CONTENT}")
|
||||
string (REGEX REPLACE "(.\\*?_H)" "\\1_ST" CONTENT "${CONTENT}")
|
||||
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/re2_st/${FILENAME} "${CONTENT}")
|
||||
endforeach ()
|
||||
|
@ -1,49 +1,32 @@
|
||||
include_directories(include)
|
||||
include_directories(/usr/include/mysql)
|
||||
include_directories (include)
|
||||
include_directories (/usr/include/mysql)
|
||||
|
||||
add_subdirectory (src)
|
||||
|
||||
option(ENABLE_MONGODB "Set to TRUE to enable MongoDB support as source for external dictionaries" True)
|
||||
set (DISABLE_MONGODB FALSE CACHE BOOL "Set to TRUE to disable MongoDB support as source for external dictionaries")
|
||||
|
||||
if (ENABLE_MONGODB)
|
||||
set (DISABLE_MONGODB FALSE)
|
||||
else()
|
||||
set (DISABLE_MONGODB TRUE)
|
||||
endif()
|
||||
|
||||
if ($ENV{DISABLE_MONGODB})
|
||||
set (DISABLE_MONGODB TRUE)
|
||||
endif()
|
||||
|
||||
if (DISABLE_MONGODB)
|
||||
add_definitions(-D DISABLE_MONGODB)
|
||||
else()
|
||||
set (LINK_MONGOCLIENT libmongoclient.a ${OPENSSL_LIBS} ${BOOST_THREAD_LIB})
|
||||
endif()
|
||||
add_definitions(-D ENABLE_MONGODB)
|
||||
endif ()
|
||||
|
||||
if (DISABLE_LIBTCMALLOC)
|
||||
if (NOT ENABLE_LIBTCMALLOC)
|
||||
add_definitions(-D NO_TCMALLOC)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
set (AIO_CPP_FILES "")
|
||||
set (AIO_H_FILES "")
|
||||
set (APPLE_ICONV_LIB iconv)
|
||||
|
||||
else()
|
||||
set (AIO_H_FILES include/DB/Common/AIO.h
|
||||
include/DB/IO/WriteBufferAIO.h
|
||||
include/DB/IO/ReadBufferAIO.h
|
||||
)
|
||||
include/DB/IO/ReadBufferAIO.h)
|
||||
set (AIO_CPP_FILES
|
||||
src/IO/ReadBufferAIO.cpp
|
||||
src/IO/WriteBufferAIO.cpp
|
||||
)
|
||||
src/IO/WriteBufferAIO.cpp)
|
||||
set (APPLE_ICONV_LIB "")
|
||||
endif()
|
||||
|
||||
add_library(string_utils
|
||||
add_library (string_utils
|
||||
include/DB/Common/StringUtils.h
|
||||
src/Common/StringUtils.cpp)
|
||||
|
||||
@ -978,9 +961,8 @@ add_library (dbms
|
||||
)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# Не генерируем отладочную информацию для файлов с большим количеством инстанцирований шаблонов
|
||||
# - для более быстрой линковки и меньшего размера бинарника.
|
||||
SET_SOURCE_FILES_PROPERTIES(
|
||||
# Won't generate debug info for files with heavy template instantiation to achieve faster linking and lower size.
|
||||
set_source_files_properties(
|
||||
src/Functions/FunctionsArithmetic.cpp
|
||||
src/Functions/FunctionsArray.cpp
|
||||
src/Functions/FunctionsCoding.cpp
|
||||
@ -1012,11 +994,11 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
src/Dictionaries/ComplexKeyHashedDictionary.cpp
|
||||
src/Dictionaries/ComplexKeyCacheDictionary.cpp
|
||||
PROPERTIES COMPILE_FLAGS -g0)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
IF (NOT AARCH64)
|
||||
SET(LINK_LIBRARIES_ONLY_ON_X86_64 cpuid)
|
||||
ENDIF()
|
||||
if (NOT AARCH64)
|
||||
set (LINK_LIBRARIES_ONLY_ON_X86_64 cpuid)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(dbms
|
||||
common
|
||||
@ -1028,7 +1010,7 @@ target_link_libraries(dbms
|
||||
double-conversion
|
||||
${LINK_LIBRARIES_ONLY_ON_X86_64}
|
||||
re2 re2_st
|
||||
libcrypto.a
|
||||
${LIBCRYPTO}
|
||||
${BOOST_SYSTEM_LIB}
|
||||
${LINK_MONGOCLIENT}
|
||||
${BOOST_REGEX_LIB}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <DB/Dictionaries/MySQLDictionarySource.h>
|
||||
#include <DB/Dictionaries/ClickHouseDictionarySource.h>
|
||||
|
||||
#ifndef DISABLE_MONGODB
|
||||
#ifdef ENABLE_MONGODB
|
||||
#include <DB/Dictionaries/MongoDBDictionarySource.h>
|
||||
#endif
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
}
|
||||
else if ("mongodb" == source_type)
|
||||
{
|
||||
#ifndef DISABLE_MONGODB
|
||||
#ifdef ENABLE_MONGODB
|
||||
return std::make_unique<MongoDBDictionarySource>(dict_struct, config, config_prefix + ".mongodb", sample_block);
|
||||
#else
|
||||
throw Exception{
|
||||
|
@ -1,30 +1,45 @@
|
||||
find_library(READLINE_LIB
|
||||
NAMES libreadline.a libreadline.so
|
||||
HINTS "/usr/local/opt/readline/lib")
|
||||
set (READLINE_HINTS "/usr/local/opt/readline/lib")
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (READLINE_LIB NAMES libreadline.a HINTS ${READLINE_HINTS})
|
||||
else ()
|
||||
find_library (READLINE_LIB NAMES readline HINTS ${READLINE_HINTS})
|
||||
endif ()
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (EDIT_LIB NAMES libedit.a)
|
||||
else ()
|
||||
find_library (EDIT_LIB NAMES edit)
|
||||
endif ()
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (CURSES_LIB NAMES libcurses.a)
|
||||
else ()
|
||||
find_library (CURSES_LIB NAMES curses)
|
||||
endif ()
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (TERMCAP_LIB NAMES libtermcap.a termcap)
|
||||
else ()
|
||||
find_library (TERMCAP_LIB NAMES termcap)
|
||||
endif ()
|
||||
|
||||
find_library(LIBEDIT_LIB
|
||||
NAMES libedit.a libedit.so)
|
||||
if (READLINE_LIB)
|
||||
include_directories ("/usr/local/opt/readline/include")
|
||||
add_definitions (-D USE_READLINE)
|
||||
set (LINE_EDITING_LIBS ${READLINE_LIB} ${TERMCAP_LIB})
|
||||
message (STATUS "Using line editing libraries: ${LINE_EDITING_LIBS}")
|
||||
elseif (EDIT_LIB)
|
||||
add_definitions (-D USE_LIBEDIT)
|
||||
set (LINE_EDITING_LIBS ${EDIT_LIB} ${CURSES_LIB} ${TERMCAP_LIB})
|
||||
message (STATUS "Using line editing libraries: ${LINE_EDITING_LIBS}")
|
||||
else ()
|
||||
message (STATUS "Not using any library for line editing.")
|
||||
endif ()
|
||||
|
||||
if(READLINE_LIB)
|
||||
include_directories("/usr/local/opt/readline/include")
|
||||
add_definitions(-D USE_READLINE)
|
||||
set(LINE_EDITING_LIBS ${READLINE_LIB} libtermcap.a)
|
||||
message(STATUS "Using line editing libraries: ${LINE_EDITING_LIBS}")
|
||||
elseif(LIBEDIT_LIB)
|
||||
add_definitions(-D USE_LIBEDIT)
|
||||
set(LINE_EDITING_LIBS ${LIBEDIT_LIB} libcurses.a libtermcap.a)
|
||||
message(STATUS "Using line editing libraries: ${LINE_EDITING_LIBS}")
|
||||
else()
|
||||
message(STATUS "Not using any library for line editing.")
|
||||
endif()
|
||||
|
||||
add_library(clickhouse-client Client.cpp)
|
||||
add_library (clickhouse-client Client.cpp)
|
||||
target_link_libraries (clickhouse-client dbms ${LINE_EDITING_LIBS} ${BOOST_PROGRAM_OPTIONS_LIB})
|
||||
INSTALL(FILES config.xml DESTINATION /etc/clickhouse-client COMPONENT clickhouse-client)
|
||||
install (FILES config.xml DESTINATION /etc/clickhouse-client COMPONENT clickhouse-client)
|
||||
|
||||
add_library(clickhouse-benchmark Benchmark.cpp)
|
||||
add_library (clickhouse-benchmark Benchmark.cpp)
|
||||
target_link_libraries (clickhouse-benchmark dbms ${BOOST_PROGRAM_OPTIONS_LIB})
|
||||
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -24,7 +24,7 @@ brew install boost --cc=gcc-6
|
||||
## Install required libraries
|
||||
|
||||
```
|
||||
brew install icu4c mysql openssl unixodbc glib libtool gettext
|
||||
brew install icu4c mysql openssl unixodbc glib libtool gettext homebrew/dupes/libiconv homebrew/dupes/zlib
|
||||
```
|
||||
|
||||
## Install optional libraries
|
||||
|
@ -59,37 +59,54 @@ add_library (common
|
||||
${REVISIONFILE}
|
||||
)
|
||||
|
||||
# TESTIRT-3687 DISABLE_LIBTCMALLOC - when testing for memory leaks, disable libtcmalloc
|
||||
IF(DISABLE_LIBTCMALLOC)
|
||||
message(STATUS "Disabling libtcmalloc for valgrind better analysis")
|
||||
ELSE(DISABLE_LIBTCMALLOC)
|
||||
IF(DEBUG_LIBTCMALLOC)
|
||||
find_library(LIBTCMALLOC_DEBUG libtcmalloc_minimal_debug.a tcmalloc_minimal_debug) # debug version of tcmalloc from package
|
||||
message(STATUS "Link libtcmalloc_minimal_debug for testing from ${LIBTCMALLOC_DEBUG}")
|
||||
SET(MALLOC_LIBRARIES ${LIBTCMALLOC_DEBUG})
|
||||
ELSE(DEBUG_LIBTCMALLOC)
|
||||
message(STATUS "Link libtcmalloc_minimal")
|
||||
SET(MALLOC_LIBRARIES tcmalloc_minimal_internal)
|
||||
ENDIF(DEBUG_LIBTCMALLOC)
|
||||
ENDIF(DISABLE_LIBTCMALLOC)
|
||||
# When testing for memory leaks, disable libtcmalloc.
|
||||
if (ENABLE_LIBTCMALLOC)
|
||||
if (DEBUG_LIBTCMALLOC)
|
||||
message (STATUS "Link libtcmalloc_minimal_debug for testing")
|
||||
set (MALLOC_LIBRARIES libtcmalloc_minimal_debug.a)
|
||||
else ()
|
||||
message (STATUS "Link libtcmalloc_minimal")
|
||||
set (MALLOC_LIBRARIES tcmalloc_minimal_internal)
|
||||
endif ()
|
||||
else ()
|
||||
message (STATUS "Disabling libtcmalloc for valgrind better analysis")
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
SET(RT_LIBRARIES "apple_rt")
|
||||
else()
|
||||
SET(RT_LIBRARIES "librt.a")
|
||||
endif()
|
||||
set (RT_LIBRARIES "apple_rt")
|
||||
else ()
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
set (RT_LIBRARIES "librt.a")
|
||||
else ()
|
||||
set (RT_LIBRARIES "rt")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set (GLIB_HINTS "/usr/local/opt/glib/lib")
|
||||
find_library (GLIB_LIB libglib-2.0.a HINTS ${GLIB_HINTS})
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (GLIB_LIB libglib-2.0.a HINTS ${GLIB_HINTS})
|
||||
else ()
|
||||
find_library (GLIB_LIB glib-2.0 HINTS ${GLIB_HINTS})
|
||||
endif ()
|
||||
if (APPLE)
|
||||
set (INTL_HINTS "/usr/local/opt/gettext/lib")
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (INTL_LIB libintl.a HINTS ${INTL_HINTS})
|
||||
else ()
|
||||
find_library (INTL_LIB intl HINTS ${INTL_HINTS})
|
||||
endif ()
|
||||
set (ICONV_HINTS "/usr/local/opt/libiconv/lib")
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (ICONV_LIB libiconv.a HINTS ${ICONV_HINTS})
|
||||
else ()
|
||||
find_library (ICONV_LIB iconv HINTS ${ICONV_HINTS})
|
||||
endif ()
|
||||
find_library (CORE_FOUNDATION_LIB CoreFoundation)
|
||||
find_library (CARBON_LIB Carbon)
|
||||
set (GLIB_LIBS ${GLIB_LIB} ${INTL_LIB} libiconv.a ${CORE_FOUNDATION_LIB} ${CARBON_LIB})
|
||||
else ()
|
||||
set (GLIB_LIBS ${GLIB_LIB} ${INTL_LIB} ${ICONV_LIB} ${CORE_FOUNDATION_LIB} ${CARBON_LIB})
|
||||
else (APPLE)
|
||||
set (GLIB_LIBS ${GLIB_LIB})
|
||||
endif ()
|
||||
endif (APPLE)
|
||||
|
||||
target_link_libraries (
|
||||
common
|
||||
@ -100,6 +117,6 @@ target_link_libraries (
|
||||
${ICU_LIBS}
|
||||
${RT_LIBRARIES})
|
||||
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (src/tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -27,19 +27,33 @@ add_library (mysqlxx
|
||||
add_dependencies (mysqlxx common)
|
||||
|
||||
set (MYSQL_HINTS "/usr/local/opt/mysql/lib")
|
||||
find_library (MYSQLCLIENT_LIB libmysqlclient.a HINTS ${MYSQL_HINTS})
|
||||
set (OUR_MYSQLCLIENT_LIB ${CMAKE_CURRENT_BINARY_DIR}/libmysqlclient.a)
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (STATIC_MYSQLCLIENT_LIB libmysqlclient.a HINTS ${MYSQL_HINTS})
|
||||
else ()
|
||||
find_library (MYSQLCLIENT_LIB mysqlclient HINTS ${MYSQL_HINTS})
|
||||
endif ()
|
||||
|
||||
target_link_libraries (mysqlxx common ${OUR_MYSQLCLIENT_LIB} ${OPENSSL_LIBS} libz.a dl)
|
||||
set (Z_HINTS "/usr/local/opt/zlib/lib")
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library (Z_LIB libz.a HINTS ${Z_HINTS})
|
||||
else ()
|
||||
find_library (Z_LIB z HINTS ${Z_HINTS})
|
||||
endif ()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${OUR_MYSQLCLIENT_LIB}
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/patch.sh ${MYSQLCLIENT_LIB} ${OUR_MYSQLCLIENT_LIB}
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
set (MYSQLCLIENT_LIB ${CMAKE_CURRENT_BINARY_DIR}/libmysqlclient.a)
|
||||
target_link_libraries (mysqlxx common ${MYSQLCLIENT_LIB} ${OPENSSL_LIBS} ${Z_LIB} dl)
|
||||
add_custom_command(
|
||||
OUTPUT ${MYSQLCLIENT_LIB}
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/patch.sh ${STATIC_MYSQLCLIENT_LIB} ${MYSQLCLIENT_LIB}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Patching mysqlclient library.")
|
||||
add_custom_target(our_mysql_client DEPENDS ${OUR_MYSQLCLIENT_LIB})
|
||||
add_dependencies(mysqlxx our_mysql_client)
|
||||
add_custom_target(our_mysql_client DEPENDS ${MYSQLCLIENT_LIB})
|
||||
add_dependencies(mysqlxx our_mysql_client)
|
||||
endif ()
|
||||
|
||||
if (TESTS)
|
||||
target_link_libraries (mysqlxx common ${MYSQLCLIENT_LIB} ${OPENSSL_LIBS} ${Z_LIB} dl)
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (src/tests)
|
||||
endif (TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
@ -1,3 +1,3 @@
|
||||
IF(TESTS)
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory (tests)
|
||||
ENDIF(TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
Loading…
Reference in New Issue
Block a user