Skip to content
This repository

Add support for compiling KTG on Mac OS X. #3

Merged
merged 1 commit into from about 2 years ago

2 participants

Frederik De Bleser Fabian 'ryg' Giesen
Frederik De Bleser
fdb commented

I've added a Makefile so KTG compiles on Mac OS X.

I had to write replacements for the Windows timing functions. I now use gettimeofday to get the most accurate time representation on the target platform.

Typing "make" in the ktg directory creates a "demo" executable that also works on Mac.

Fabian 'ryg' Giesen rygorous merged commit fc6a441 into from
Fabian 'ryg' Giesen rygorous closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 16, 2012
Frederik De Bleser fdb Add support for compiling KTG on Mac OS X. 5d4f081
This page is out of date. Refresh to see the latest.

Showing 2 changed files with 22 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 0  ktg/Makefile
  2. +20 2 ktg/demo.cpp
2  ktg/Makefile
... ... @@ -0,0 +1,2 @@
  1 +demo: gentexture.cpp demo.cpp
  2 + g++ gentexture.cpp demo.cpp -o demo
22 ktg/demo.cpp
@@ -8,8 +8,26 @@
8 8 #include <stdio.h>
9 9 #include "gentexture.hpp"
10 10
11   -#pragma comment(lib,"winmm.lib")
12   -#include <windows.h>
  11 +#ifdef _WIN32
  12 + #pragma comment(lib,"winmm.lib")
  13 + #include <windows.h>
  14 +#else
  15 + #include <sys/time.h>
  16 + static long timeGetTime()
  17 + {
  18 + timeval tim;
  19 + gettimeofday(&tim, NULL);
  20 + return tim.tv_sec * 1000000 + tim.tv_usec / 10;
  21 + }
  22 + static int timeBeginPeriod(unsigned int period)
  23 + {
  24 + return 0;
  25 + }
  26 + static int timeEndPeriod(unsigned int period)
  27 + {
  28 + return 0;
  29 + }
  30 +#endif
13 31
14 32 // 4x4 matrix multiply
15 33 static void MatMult(Matrix44 &dest,const Matrix44 &a,const Matrix44 &b)

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.