Permalink
Browse files

Fix clock_gettime detection on osx

  • Loading branch information...
xzcvczx committed Jan 21, 2017
1 parent d6e7193 commit cbfdba8762e0a3787c7669977e8883366cf2b3e5
Showing with 10 additions and 8 deletions.
  1. +1 −0 CMakeLists.txt
  2. +5 −7 adm/cmake/TKernel/CMakeLists.txt
  3. +3 −0 adm/cmake/config/oce_build_config.h.cmake
  4. +1 −1 src/OSD/OSD_Chronometer.cxx
View
@@ -609,6 +609,7 @@ if (NOT WIN32)
# Check library functions
include(CheckFunctionExists)
check_function_exists(localtime_r HAVE_LOCALTIME_R)
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN)
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
@@ -28,19 +28,17 @@ set(TOOLKIT_LIBS ${TOOLKIT_LIBS} ${CMAKE_DL_LIBS} ${LM})
if(WIN32)
set(TOOLKIT_LIBS ${TOOLKIT_LIBS} ${CSF_SOCKETLibs_LIB} ${CSF_advapi32_LIB} ${CSF_gdi32_LIB} ${CSF_user32_LIB} ${CSF_kernel32_LIB} ${CSF_psapi_LIB})
else(WIN32)
#  An implementation for Mac OS X has been added in src/OSD/gettime_osx.h
if(NOT APPLE)
include( CheckFunctionExists )
check_function_exists( clock_gettime CLOCK_GETTIME_IN_LIBC )
if(NOT CLOCK_GETTIME_IN_LIBC)
if(NOT HAVE_CLOCK_GETTIME)
# An implementation for macOS has been added in src/OSD/gettime_osx.h
if(NOT APPLE)
include( CheckLibraryExists )
check_library_exists(rt clock_gettime "" CLOCK_GETTIME_IN_LIBRT)
if(NOT CLOCK_GETTIME_IN_LIBRT)
message(FATAL_ERROR "Could not find clock_gettime.")
endif(NOT CLOCK_GETTIME_IN_LIBRT)
set(TOOLKIT_LIBS ${TOOLKIT_LIBS} rt)
endif(NOT CLOCK_GETTIME_IN_LIBC)
endif(NOT APPLE)
endif(NOT APPLE)
endif(NOT HAVE_CLOCK_GETTIME)
endif(WIN32)
# Adde-DHAVE_TBB in TKernel in order to benefit from Standard_MMgrTBBalloc
@@ -22,6 +22,9 @@
/* Define to 1 if the localtime_r function is available. */
#cmakedefine HAVE_LOCALTIME_R 1
/* Define to 1 if the clock_gettime function is available in libc. */
#cmakedefine HAVE_CLOCK_GETTIME 1
/* Define to 1 if the posix_memalign function is available. */
#cmakedefine HAVE_POSIX_MEMALIGN 1
@@ -51,7 +51,7 @@
#include <mach/mach.h>
#endif
#if defined(__APPLE__) && defined(__MACH__)
#if defined(__APPLE__) && !defined(HAVE_CLOCK_GETTIME)
#include "gettime_osx.h"
#endif

0 comments on commit cbfdba8

Please sign in to comment.