changeset 492:6fce645a848a

Fix build on OS X < 10.12 and X Code >= 8
author Louis Opter <kalessin@kalessin.fr>
date Sat, 01 Oct 2016 17:18:16 -0700
parents 6b153374b871
children d9f90a882319
files fix_xcode_8_build.patch series
diffstat 2 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fix_xcode_8_build.patch	Sat Oct 01 17:18:16 2016 -0700
@@ -0,0 +1,36 @@
+# HG changeset patch
+# Parent  aa0c0e4862f619dbc9b1db472c36663595708af2
+Fix build with X Code >= 8 and Mac OS < 10.12
+
+Hopefully clock_gettime still gets selected on Mac OS 10.12.
+
+diff --git a/CMakeScripts/CompatTimeMonotonic.cmake b/CMakeScripts/CompatTimeMonotonic.cmake
+--- a/CMakeScripts/CompatTimeMonotonic.cmake
++++ b/CMakeScripts/CompatTimeMonotonic.cmake
+@@ -5,6 +5,18 @@
+     SET(GENERIC_TIME_MONOTONIC_H "${LIGHTSD_SOURCE_DIR}/compat/generic/time_monotonic.h")
+     SET(TIME_MONOTONIC_LIBRARY time_monotonic CACHE INTERNAL "lgtd_time_monotonic implementation")
+ 
++    IF (APPLE)
++        # Hopefully my intuition is right and this fixes false positives on mac
++        # os < 10.12 with X Code >= 8 (where clock_gettime is defined in the
++        # SDKs but actually doesn't exists so dyld blows up at run time).
++        #
++        # -u symbol_name
++        #         Specified that symbol symbol_name must be defined for the
++        #         link to succeed.  This is useful to force selected functions
++        #         to be loaded from a static library.
++        SET(CMAKE_REQUIRED_FLAGS "-Wl,-u=clock_gettime")
++    ENDIF ()
++
+     SET(CMAKE_REQUIRED_QUIET TRUE)
+     MESSAGE(STATUS "Looking for clock_gettime")
+     CHECK_FUNCTION_EXISTS("clock_gettime" HAVE_CLOCK_GETTIME)
+@@ -21,6 +33,7 @@
+         ENDIF ()
+     ENDIF ()
+     UNSET(CMAKE_REQUIRED_QUIET)
++    UNSET(CMAKE_REQUIRED_FLAGS)
+ 
+     IF (HAVE_CLOCK_GETTIME)
+         MESSAGE(STATUS "Looking for clock_gettime - found")
--- a/series	Sun Sep 04 22:42:09 2016 -0700
+++ b/series	Sat Oct 01 17:18:16 2016 -0700
@@ -1,4 +1,5 @@
 ask_for_remote_dest_before_running_hg_out.patch
+fix_xcode_8_build.patch
 add_monolight.patch
 docker_images.patch
 add_power_transition.patch