提交 7be750af 编写于 作者: P proller 提交者: alexey-milovidov

Apple build fixes

上级 a1684d4a
......@@ -144,6 +144,7 @@ target_link_libraries (clickhouse_common_io
${EXECINFO_LIBRARY}
${ELF_LIBRARY}
${Boost_SYSTEM_LIBRARY}
apple_rt
${CMAKE_DL_LIBS}
)
......
......@@ -6,6 +6,9 @@ add_library (apple_rt
include/port/clock.h
)
target_include_directories (apple_rt PUBLIC ${COMMON_INCLUDE_DIR})
if (DEFINED APPLE_HAVE_CLOCK_GETTIME)
target_compile_definitions(apple_rt PUBLIC -DAPPLE_HAVE_CLOCK_GETTIME=${APPLE_HAVE_CLOCK_GETTIME})
endif ()
add_library (common ${SPLIT_SHARED}
src/DateLUT.cpp
......
......@@ -10,13 +10,15 @@
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#ifndef MAC_OS_X_VERSION_10_12
#define MAC_OS_X_VERSION_10_12 101200
#endif
#define APPLE_HAVE_CLOCK_GETTIME MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
#if !APPLE_HAVE_CLOCK_GETTIME || !defined(CLOCK_MONOTONIC)
# if !defined(APPLE_HAVE_CLOCK_GETTIME)
# include <AvailabilityMacros.h>
# if !defined(MAC_OS_X_VERSION_10_12)
# define MAC_OS_X_VERSION_10_12 101200
# endif
# define APPLE_HAVE_CLOCK_GETTIME MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
# endif
# if !APPLE_HAVE_CLOCK_GETTIME || !defined(CLOCK_MONOTONIC)
/**
* MacOS X doesn't support different clock sources
*
......@@ -24,24 +26,24 @@
* CLOCK_THREAD_CPUTIME_ID, because there is a way
* to implement it using in-kernel stats about threads
*/
#if !defined(CLOCK_MONOTONIC)
#define CLOCK_MONOTONIC 0
#endif
#if !defined(CLOCK_REALTIME)
#define CLOCK_REALTIME CLOCK_MONOTONIC
#endif
#if !defined(CLOCK_THREAD_CPUTIME_ID)
#define CLOCK_THREAD_CPUTIME_ID 3
#endif
# if !defined(CLOCK_MONOTONIC)
# define CLOCK_MONOTONIC 0
# endif
# if !defined(CLOCK_REALTIME)
# define CLOCK_REALTIME CLOCK_MONOTONIC
# endif
# if !defined(CLOCK_THREAD_CPUTIME_ID)
# define CLOCK_THREAD_CPUTIME_ID 3
# endif
typedef int clockid_t;
int clock_gettime(int clk_id, struct timespec* t);
#else
# else
#endif
# endif
#if !defined(CLOCK_MONOTONIC_COARSE)
#define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC
#endif
# if !defined(CLOCK_MONOTONIC_COARSE)
# define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC
# endif
#endif
......@@ -35,7 +35,10 @@ if (USE_MYSQL)
target_include_directories (mysqlxx SYSTEM PRIVATE ${MYSQL_INCLUDE_DIR})
endif ()
if (USE_STATIC_LIBRARIES AND STATIC_MYSQLCLIENT_LIB)
if (APPLE)
find_library (ICONV_LIBRARY iconv)
set (MYSQLCLIENT_LIBRARIES ${STATIC_MYSQLCLIENT_LIB} ${ICONV_LIBRARY})
elseif (USE_STATIC_LIBRARIES AND STATIC_MYSQLCLIENT_LIB)
set (MYSQLCLIENT_LIB ${CMAKE_CURRENT_BINARY_DIR}/libmysqlclient.a)
add_custom_command (
OUTPUT ${MYSQLCLIENT_LIB}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册