Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added fixes for compiling under Mac OS X(tested under Snow Leopard)

  • Loading branch information...
commit cbc0854bf492d6d96affe7b440430bd700a32daf 1 parent 2b7ff6d
@rgngl rgngl authored
Showing with 23 additions and 0 deletions.
  1. +10 −0 build/CMakeLists.txt
  2. +5 −0 include/gl/glut.h
  3. +8 −0 src/timing.cpp
View
10 build/CMakeLists.txt
@@ -6,6 +6,16 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ../lib)
set(SRC ../src)
find_package(GLUT REQUIRED)
+IF(APPLE)
+ INCLUDE_DIRECTORIES ( /System/Library/Frameworks )
+ FIND_LIBRARY(COCOA_LIBRARY Cocoa)
+ FIND_LIBRARY(GLUT_LIBRARY GLUT )
+ FIND_LIBRARY(OPENGL_LIBRARY OPENGL )
+ MARK_AS_ADVANCED (COCOA_LIBRARY
+ GLUT_LIBRARY
+ OPENGL_LIBRARY)
+ SET(EXTRA_LIBS ${COCOA_LIBRARY} ${GLUT_LIBRARY} ${OPENGL_LIBRARY})
+ENDIF (APPLE)
include_directories(../include ${GLUT_INCLUDE_DIR} ${GL_INCLUDE_DIR})
View
5 include/gl/glut.h
@@ -11,8 +11,13 @@
#include <windows.h>
#pragma warning (disable:4244) /* disable bogus conversion warnings */
#endif
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
#include <GL/gl.h>
#include <GL/glu.h>
+#endif
/* define APIENTRY and CALLBACK to null string if we aren't on Win32 */
#if !defined(WIN32)
View
8 src/timing.cpp
@@ -16,6 +16,8 @@
// Import the high performance timer (c. 4ms).
#include <windows.h>
#include <mmsystem.h>
+#elif __MACH__
+#include <mach/mach_time.h>
#else
#include <time.h>
#include <stdint.h>
@@ -44,6 +46,12 @@ namespace aicore
{
return unsigned(timeGetTime());
}
+#elif __MACH__
+ uint64_t t = mach_absolute_time();
+ mach_timebase_info_data_t info = {0,0};
+ mach_timebase_info(&info);
+ uint64_t timenano = t * (info.numer / info.denom);
+ return timenano/1000000;
#else
struct timespec cur;
clock_gettime(CLOCK_REALTIME, &cur);
Please sign in to comment.
Something went wrong with that request. Please try again.