osx
This commit is contained in:
parent
41fb41b8d1
commit
65c5e984e7
|
@ -1,9 +1,9 @@
|
|||
##################################################
|
||||
# Makefile for building lib and main test routine#
|
||||
##################################################
|
||||
LOCATION=debian7
|
||||
#LOCATION=debian6
|
||||
#LOCATION=osx10.8
|
||||
LOCATION=DEBIAN_7
|
||||
#LOCATION=DEBIAN_6
|
||||
#LOCATION=OSX_10_8
|
||||
|
||||
SYSTEM = $(shell uname -s)
|
||||
|
||||
|
@ -14,10 +14,10 @@ CC = gcc
|
|||
PRODORDEV += -ggdb3
|
||||
|
||||
CXXFLAGS = $(PRODORDEV) -Wall -Wpointer-arith -Wcast-qual -D_REENTRANT -fPIC
|
||||
CPPFLAGS = -fPIC -D_GNU_SOURCE -DACLOC=$(LOCATION)
|
||||
CXXFLAGS += -D_GNU_SOURCE -O0 -DACLOC=$(LOCATION)
|
||||
CPPFLAGS = -fPIC -D_GNU_SOURCE -D$(LOCATION)
|
||||
CXXFLAGS += -D_GNU_SOURCE -O0 -D$(LOCATION)
|
||||
|
||||
ifeq ($(LOCATION),debian7)
|
||||
ifeq ($(LOCATION),DEBIAN_7)
|
||||
XALAN_LIB_DIR = /usr/local/lib/
|
||||
XALAN_LIB = xalan-c
|
||||
XALAN_INC_DIR = /usr/local/include/xalanc
|
||||
|
@ -25,7 +25,7 @@ XERCES_LIB_DIR = /usr/local/lib/
|
|||
XERCES_LIB = xerces-c
|
||||
XERCES_INC_DIR = /usr/local/include/xercesc
|
||||
endif
|
||||
ifeq ($(LOCATION),debian6)
|
||||
ifeq ($(LOCATION),DEBIAN_6)
|
||||
XALAN_LIB_DIR = /usr/lib/
|
||||
XALAN_LIB = xalan-c
|
||||
XALAN_INC_DIR = /usr/include/xalanc
|
||||
|
@ -33,7 +33,7 @@ XERCES_LIB_DIR = /usr/lib/
|
|||
XERCES_LIB = xerces-c
|
||||
XERCES_INC_DIR = /usr/include/xercesc
|
||||
endif
|
||||
ifeq ($(LOCATION),osx10.8)
|
||||
ifeq ($(LOCATION),OSX_10_8)
|
||||
XALAN_LIB_DIR = /opt/local/lib/
|
||||
XALAN_LIB = xalan-c
|
||||
XALAN_INC_DIR = /opt/local/include/
|
||||
|
|
|
@ -11,14 +11,36 @@ long long Timer::now()
|
|||
{
|
||||
if (!useRealTime) return fixedTime;
|
||||
struct timespec ts;
|
||||
#ifndef OSX_10_8
|
||||
clock_gettime(Timer::getClock(), &ts);
|
||||
#else
|
||||
clock_get_time(Timer::getClock(), &ts);
|
||||
#endif
|
||||
return static_cast<long long>(ts.tv_sec) * 1000 + static_cast<long long>(ts.tv_nsec) / 1000000;
|
||||
}
|
||||
|
||||
#ifndef OSX_10_8
|
||||
clockid_t Timer::getClock()
|
||||
{
|
||||
return CLOCK_REALTIME;
|
||||
}
|
||||
#else
|
||||
clock_t Timer::getClock()
|
||||
{
|
||||
clock_t value;
|
||||
struct timespec ts;
|
||||
|
||||
#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
|
||||
clock_serv_t cclock;
|
||||
mach_timespec_t mts;
|
||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||
clock_get_time(cclock, &mts);
|
||||
mach_port_deallocate(mach_task_self(), cclock);
|
||||
ts.tv_sec = mts.tv_sec;
|
||||
ts.tv_nsec = mts.tv_nsec;
|
||||
return value;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
long long Timer::msDiff(long long compareTime)
|
||||
{
|
||||
|
@ -64,10 +86,12 @@ struct timespec Timer::msOffset2abs(long long msOffset)
|
|||
|
||||
struct timespec now;
|
||||
struct timespec until;
|
||||
|
||||
#ifndef OSX_10_8
|
||||
clock_gettime(Timer::getClock(), &now);
|
||||
until.tv_sec = now.tv_sec + msOffset / ms_per_sec;
|
||||
until.tv_nsec = now.tv_nsec + msOffset * ns_per_ms;
|
||||
#else
|
||||
#endif
|
||||
|
||||
return until;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
#include "common/ParameterSyntaxException.hpp"
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __MACH__
|
||||
#include <mach/clock.h>
|
||||
#include <mach/mach.h>
|
||||
#endif
|
||||
|
||||
class Timer
|
||||
{
|
||||
public:
|
||||
|
@ -29,7 +34,8 @@ public:
|
|||
static struct timespec msOffset2abs(long long msOffset);
|
||||
|
||||
private:
|
||||
#if ACLOC != osx10.8
|
||||
|
||||
#ifndef OSX_10_8
|
||||
static clockid_t getClock();
|
||||
#else
|
||||
static clock_t getClock();
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
LOCATION=debian7
|
||||
LOCATION=DEBIAN_7
|
||||
#LOCATION=DEBIAN_6
|
||||
#LOCATION=OSX_10_8
|
||||
#
|
||||
# Add other locations and move target differences into the macros as needed,
|
||||
# setup for my primary development and testing hosts.
|
||||
|
@ -11,20 +13,25 @@ Cc=gcc
|
|||
LOG4LIB=-L/usr/lib
|
||||
CLIENT=drde
|
||||
|
||||
ifeq ($(LOCATION),debian7)
|
||||
ifeq ($(LOCATION),DEBIAN_7)
|
||||
ARTKLIB=-L/home/jdaugherty/clients/reg.de/git/ACTK1_0/lib
|
||||
ARTKINCL=-I/home/jdaugherty/clients/reg.de/git/ACTK1_0
|
||||
else
|
||||
endif
|
||||
ifeq ($(LOCATION),DEBIAN_6)
|
||||
ARTKLIB=-L/home/jdaugherty/dnseppus/ACTK1_0/lib
|
||||
ARTKINCL=-I/home/jdaugherty/dnseppus/ACTK1_0
|
||||
endif
|
||||
ifeq ($(LOCATION),OSX_10_8)
|
||||
ARTKLIB=-L/Users/juand/dnseppus/ACTK1_0/lib
|
||||
ARTKINCL=-I/Users/juand/dnseppus/ACTK1_0
|
||||
endif
|
||||
|
||||
SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) $(ARTKLIB) -l boost_system -l boost_thread -l log4cpp -l ACTK1_0
|
||||
|
||||
SINCL= -I include -I /usr/include/log4cpp $(BOSINCL)
|
||||
CFLAGS= -DCURRENT_DEBUG=1000 -ggdb3
|
||||
|
||||
ifeq ($(LOCATION),debian7)
|
||||
ifeq ($(LOCATION),DEBIAN_7)
|
||||
#XALAN_LIB_DIR = /usr/lib/x86_64-linux-gnu/
|
||||
XALAN_LIB_DIR = /usr/local/lib
|
||||
XALAN_LIB = xalan-c
|
||||
|
@ -32,7 +39,8 @@ XALAN_INC_DIR = /usr/local/include/xalanc
|
|||
XERCES_LIB_DIR = /usr/local/lib/
|
||||
XERCES_LIB = xerces-c
|
||||
XERCES_INC_DIR = /usr/local/include/xercesc/
|
||||
else
|
||||
endif
|
||||
ifeq ($(LOCATION),DEBIAN_6)
|
||||
XALAN_LIB_DIR = /usr/lib/
|
||||
XALAN_LIB = xalan-c
|
||||
XALAN_INC_DIR = /usr/include/xalanc/
|
||||
|
@ -40,6 +48,14 @@ XERCES_LIB_DIR = /usr/lib/
|
|||
XERCES_LIB = xerces-c
|
||||
XERCES_INC_DIR = /usr/include/xercesc/
|
||||
endif
|
||||
ifeq ($(LOCATION),OSX_10_8)
|
||||
XALAN_LIB_DIR = /opt/local/lib/
|
||||
XALAN_LIB = xalan-c
|
||||
XALAN_INC_DIR = /opt/local/include/xalanc/
|
||||
XERCES_LIB_DIR = /opt/local/lib/
|
||||
XERCES_LIB = xerces-c
|
||||
XERCES_INC_DIR = /opt/local/include/xercesc/
|
||||
endif
|
||||
|
||||
#
|
||||
# ---------- Should not need to change below
|
||||
|
|
Loading…
Reference in New Issue