Skip to content
Snippets Groups Projects
Commit c64778e9 authored by Guillem Alenyà's avatar Guillem Alenyà
Browse files

MACOS adaptation

parent fe88a681
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,12 @@ INCLUDE_DIRECTORIES(./exceptions ./mutex ./events ./threads ./logs ./time)
ADD_LIBRARY(iriutils SHARED ${sources})
#edit the following line to add the necessary system libraries (if any)
TARGET_LINK_LIBRARIES(iriutils pthread rt)
IF(APPLE)
MESSAGE("APPLE SYSTEM FOUND")
TARGET_LINK_LIBRARIES(iriutils pthread)
ELSE(APPLE)
TARGET_LINK_LIBRARIES(iriutils pthread rt)
ENDIF(APPLE)
INSTALL(TARGETS iriutils
RUNTIME DESTINATION bin
......
......@@ -32,7 +32,11 @@ TARGET_LINK_LIBRARIES(test_both iriutils pthread)
ADD_EXECUTABLE(test_time test_time.cpp)
# edit the following line to add the necessary libraries
TARGET_LINK_LIBRARIES(test_time iriutils pthread rt)
IF(APPLE)
TARGET_LINK_LIBRARIES(test_time iriutils pthread)
ELSE(APPLE)
TARGET_LINK_LIBRARIES(test_time iriutils pthread rt)
ENDIF(APPLE)
# edit the following line to add the source code for the example and the name of the executable
ADD_EXECUTABLE(test_logs test_logs.cpp)
......
......@@ -104,7 +104,14 @@ void CTime::set(double milliseconds)
if(milliseconds<0.0)
{
clock_gettime(CLOCK_REALTIME, &time_temp );
#if defined __APPLE__
struct timeval tv;
gettimeofday(&tv, NULL);
time_temp.tv_sec = tv.tv_sec;
time_temp.tv_nsec = tv.tv_usec*1000;
#else
clock_gettime(CLOCK_REALTIME, &time_temp );
#endif
}
else
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment