Fixed for FreeBSD

(From Gerald Laplanche)
This commit is contained in:
James Turner 2014-04-03 13:42:11 +01:00
parent 338a748823
commit 15d3c12139
3 changed files with 14 additions and 7 deletions

View File

@ -260,7 +260,9 @@ check_cxx_source_compiles(
if(HAVE_DLFCN_H) if(HAVE_DLFCN_H)
check_library_exists(dl dlerror "" HAVE_DL) check_library_exists(dl dlerror "" HAVE_DL)
set(DL_LIBRARY "dl") if(HAVE_DL)
set(DL_LIBRARY "dl")
endif()
endif() endif()
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually 'd' on windows") 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_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}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")
include_directories(${PROJECT_SOURCE_DIR}) # use BEFORE to ensure local directories are used first,
include_directories(${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include) # ahead of system-installed libs
include_directories(${PROJECT_BINARY_DIR}/simgear) 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} include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}

View File

@ -34,7 +34,7 @@
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#ifndef VG_API_MACOSX #if !defined(VG_API_MACOSX) && !defined(__FreeBSD__)
# include <malloc.h> # include <malloc.h>
#endif #endif

View File

@ -139,7 +139,9 @@ void SGTimeStamp::stamp() {
// the timer tick) accuracy which is too bad to catch 60Hz... // the timer tick) accuracy which is too bad to catch 60Hz...
bool SGTimeStamp::sleepUntil(const SGTimeStamp& abstime) 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; SGTimeStamp abstimeForSleep = abstime;
// Always undersleep by resolution of the clock // Always undersleep by resolution of the clock
@ -234,7 +236,8 @@ bool SGTimeStamp::sleepUntil(const SGTimeStamp& abstime)
bool SGTimeStamp::sleepFor(const SGTimeStamp& reltime) 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; struct timespec ts;
ts.tv_sec = reltime._sec; ts.tv_sec = reltime._sec;
ts.tv_nsec = reltime._nsec; ts.tv_nsec = reltime._nsec;