2016-10-26 22:27:38 +00:00
|
|
|
if (APPLE)
|
2017-04-01 07:20:54 +00:00
|
|
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT "${CMAKE_SYSTEM_VERSION}" VERSION_LESS "16.1.0")
|
|
|
|
set (APPLE_SIERRA_OR_NEWER 1)
|
|
|
|
else ()
|
|
|
|
set (APPLE_SIERRA_OR_NEWER 0)
|
|
|
|
endif ()
|
2017-01-25 22:24:36 +00:00
|
|
|
endif ()
|
2017-01-18 23:28:23 +00:00
|
|
|
|
2017-03-14 13:47:39 +00:00
|
|
|
set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_common.h)
|
2017-01-25 22:24:36 +00:00
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/common/config_common.h.in ${CONFIG_COMMON})
|
2017-01-18 23:28:23 +00:00
|
|
|
|
|
|
|
if (APPLE)
|
2017-04-01 07:20:54 +00:00
|
|
|
add_library (apple_rt
|
|
|
|
src/apple_rt.cpp
|
|
|
|
include/common/apple_rt.h
|
|
|
|
)
|
2017-08-03 13:23:41 +00:00
|
|
|
target_include_directories (apple_rt PUBLIC ${COMMON_INCLUDE_DIR})
|
2017-01-25 22:24:36 +00:00
|
|
|
endif ()
|
2016-10-26 22:27:38 +00:00
|
|
|
|
2016-02-07 21:58:58 +00:00
|
|
|
add_library (common
|
2017-04-01 07:20:54 +00:00
|
|
|
src/DateLUT.cpp
|
|
|
|
src/DateLUTImpl.cpp
|
|
|
|
src/exp10.cpp
|
2017-11-16 19:17:09 +00:00
|
|
|
src/mremap.cpp
|
2017-04-01 07:20:54 +00:00
|
|
|
src/JSON.cpp
|
2017-06-22 15:57:37 +00:00
|
|
|
src/getMemoryAmount.cpp
|
2017-06-23 20:22:35 +00:00
|
|
|
src/ThreadPool.cpp
|
2017-06-22 18:56:40 +00:00
|
|
|
src/iostream_debug_helpers.cpp
|
2016-02-07 21:58:58 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
include/common/ApplicationServerExt.h
|
2017-04-16 05:40:17 +00:00
|
|
|
include/common/Types.h
|
2017-04-01 07:20:54 +00:00
|
|
|
include/common/DateLUT.h
|
|
|
|
include/common/DateLUTImpl.h
|
|
|
|
include/common/LocalDate.h
|
|
|
|
include/common/LocalDateTime.h
|
|
|
|
include/common/ErrorHandlers.h
|
|
|
|
include/common/exp10.h
|
2017-11-16 19:17:09 +00:00
|
|
|
include/common/mremap.h
|
2017-04-01 07:20:54 +00:00
|
|
|
include/common/likely.h
|
|
|
|
include/common/logger_useful.h
|
|
|
|
include/common/MultiVersion.h
|
|
|
|
include/common/strong_typedef.h
|
|
|
|
include/common/JSON.h
|
2017-06-22 15:57:37 +00:00
|
|
|
include/common/getMemoryAmount.h
|
2017-06-23 20:22:35 +00:00
|
|
|
include/common/ThreadPool.h
|
2017-06-22 18:56:40 +00:00
|
|
|
include/common/iostream_debug_helpers.h
|
2016-02-07 21:58:58 +00:00
|
|
|
|
2017-06-07 01:48:22 +00:00
|
|
|
include/ext/bit_cast.h
|
|
|
|
include/ext/collection_cast.h
|
|
|
|
include/ext/enumerate.h
|
|
|
|
include/ext/function_traits.h
|
|
|
|
include/ext/identity.h
|
|
|
|
include/ext/map.h
|
|
|
|
include/ext/range.h
|
|
|
|
include/ext/scope_guard.h
|
|
|
|
include/ext/size.h
|
|
|
|
include/ext/unlock_guard.h
|
2017-07-10 04:34:14 +00:00
|
|
|
include/ext/singleton.h
|
2016-02-07 21:58:58 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
${CONFIG_COMMON}
|
2016-02-07 21:58:58 +00:00
|
|
|
)
|
|
|
|
|
2017-01-27 20:00:02 +00:00
|
|
|
# When testing for memory leaks, dont link tcmalloc or jemalloc.
|
|
|
|
|
|
|
|
if (USE_JEMALLOC)
|
2017-04-01 07:20:54 +00:00
|
|
|
message (STATUS "Link jemalloc : ${JEMALLOC_LIBRARIES}")
|
|
|
|
set (MALLOC_LIBRARIES ${JEMALLOC_LIBRARIES})
|
2017-01-27 20:00:02 +00:00
|
|
|
elseif (USE_TCMALLOC)
|
2017-04-01 07:20:54 +00:00
|
|
|
if (DEBUG_LIBTCMALLOC)
|
|
|
|
message (STATUS "Link libtcmalloc_minimal_debug for testing: ${GPERFTOOLS_TCMALLOC_MINIMAL_DEBUG}")
|
|
|
|
set (MALLOC_LIBRARIES ${GPERFTOOLS_TCMALLOC_MINIMAL_DEBUG})
|
|
|
|
else ()
|
|
|
|
message (STATUS "Link libtcmalloc_minimal : ${GPERFTOOLS_TCMALLOC_MINIMAL}")
|
|
|
|
set (MALLOC_LIBRARIES ${GPERFTOOLS_TCMALLOC_MINIMAL})
|
|
|
|
endif ()
|
2016-12-01 22:44:59 +00:00
|
|
|
else ()
|
2017-04-01 07:20:54 +00:00
|
|
|
message (STATUS "Disabling libtcmalloc for valgrind better analysis")
|
2016-12-01 22:44:59 +00:00
|
|
|
endif ()
|
2016-02-07 21:58:58 +00:00
|
|
|
|
2017-09-15 05:27:09 +00:00
|
|
|
if (GLIBC_COMPATIBILITY)
|
|
|
|
set (GLIBC_COMPATIBILITY_LIBRARIES glibc-compatibility)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (USE_INTERNAL_MEMCPY)
|
|
|
|
set (MEMCPY_LIBRARIES memcpy)
|
|
|
|
endif ()
|
|
|
|
|
2017-01-11 13:40:02 +00:00
|
|
|
find_package (Threads)
|
|
|
|
|
2017-06-23 20:22:35 +00:00
|
|
|
target_include_directories (common BEFORE PRIVATE ${CCTZ_INCLUDE_DIR})
|
|
|
|
target_include_directories (common BEFORE PUBLIC ${CITYHASH_INCLUDE_DIR})
|
2017-08-03 12:44:39 +00:00
|
|
|
target_include_directories (common PUBLIC ${COMMON_INCLUDE_DIR})
|
2017-06-23 14:41:07 +00:00
|
|
|
|
2016-05-28 00:16:28 +00:00
|
|
|
target_link_libraries (
|
2017-04-01 07:20:54 +00:00
|
|
|
common
|
|
|
|
pocoext
|
2017-08-09 20:52:55 +00:00
|
|
|
${CITYHASH_LIBRARIES}
|
2017-06-23 14:41:07 +00:00
|
|
|
${CCTZ_LIBRARY}
|
2017-04-01 07:20:54 +00:00
|
|
|
${Boost_SYSTEM_LIBRARY}
|
|
|
|
${Boost_FILESYSTEM_LIBRARY}
|
|
|
|
${MALLOC_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
2017-09-15 05:06:52 +00:00
|
|
|
${RT_LIBRARIES}
|
2017-09-15 05:27:09 +00:00
|
|
|
${GLIBC_COMPATIBILITY_LIBRARIES}
|
|
|
|
${MEMCPY_LIBRARIES})
|
2016-05-28 00:16:28 +00:00
|
|
|
|
2016-12-01 22:44:59 +00:00
|
|
|
if (ENABLE_TESTS)
|
2017-04-01 07:20:54 +00:00
|
|
|
add_subdirectory (src/tests)
|
2017-04-10 17:43:30 +00:00
|
|
|
endif ()
|