]> git.mxchange.org Git - simgear.git/commitdiff
Fixed for FreeBSD
authorJames Turner <zakalawe@mac.com>
Thu, 3 Apr 2014 12:42:11 +0000 (13:42 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 3 Apr 2014 12:42:11 +0000 (13:42 +0100)
(From Gerald Laplanche)

CMakeLists.txt
simgear/canvas/ShivaVG/src/shDefs.h
simgear/timing/timestamp.cxx

index 364aec23e7509280f43495fb9913f02d437bca32..c2ad568b3a3931f055b4fd4c7435f93128d1567c 100644 (file)
@@ -260,7 +260,9 @@ check_cxx_source_compiles(
 
 if(HAVE_DLFCN_H)
     check_library_exists(dl dlerror "" HAVE_DL)
-    set(DL_LIBRARY "dl")
+    if(HAVE_DL)
+        set(DL_LIBRARY "dl")
+    endif()
 endif()
 
 SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually 'd' on windows")
@@ -333,9 +335,11 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} ${BOOST_CXX_FLAGS}")
 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")
 
-include_directories(${PROJECT_SOURCE_DIR})
-include_directories(${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include)
-include_directories(${PROJECT_BINARY_DIR}/simgear)
+# use BEFORE to ensure local directories are used first, 
+# ahead of system-installed libs
+include_directories(BEFORE ${PROJECT_SOURCE_DIR})
+include_directories(BEFORE ${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include)
+include_directories(BEFORE ${PROJECT_BINARY_DIR}/simgear)
 
 include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS} 
     ${Boost_INCLUDE_DIRS} 
index d0f3bb84db810a46105b800effc0c4a4279b86fa..ea5d59c8cd0294a8ec5bae809b2cc78675b7aca1 100644 (file)
@@ -34,7 +34,7 @@
 #include <math.h>
 #include <float.h>
 
-#ifndef VG_API_MACOSX
+#if !defined(VG_API_MACOSX) && !defined(__FreeBSD__)
 #  include <malloc.h>
 #endif
 
index 297f665aebcbd055003e59e42952263fb978d9ae..24cad841a9995b941de601604e2af122dd249d05 100644 (file)
@@ -139,7 +139,9 @@ void SGTimeStamp::stamp() {
 // the timer tick) accuracy which is too bad to catch 60Hz...
 bool SGTimeStamp::sleepUntil(const SGTimeStamp& abstime)
 {
-#if defined(_POSIX_TIMERS) && (0 < _POSIX_TIMERS)
+    // FreeBSD is missing clock_nanosleep, see
+    // https://wiki.freebsd.org/FreeBSD_and_Standards
+#if defined(_POSIX_TIMERS) && (0 < _POSIX_TIMERS) && !defined(__FreeBSD__)
     SGTimeStamp abstimeForSleep = abstime;
 
     // Always undersleep by resolution of the clock
@@ -234,7 +236,8 @@ bool SGTimeStamp::sleepUntil(const SGTimeStamp& abstime)
 
 bool SGTimeStamp::sleepFor(const SGTimeStamp& reltime)
 {
-#if defined(_POSIX_TIMERS) && (0 < _POSIX_TIMERS)
+    // see comment above regarding FreeBSD
+#if defined(_POSIX_TIMERS) && (0 < _POSIX_TIMERS) && !defined(__FreeBSD__)
     struct timespec ts;
     ts.tv_sec = reltime._sec;
     ts.tv_nsec = reltime._nsec;