From 66a0ae94f1a2d4220f374bb5b0ab87685bd486bd Mon Sep 17 00:00:00 2001 From: Kyungdahm Yun Date: Tue, 8 Sep 2015 17:33:35 -0700 Subject: [PATCH] Support Mac OS X build --- SConstruct | 6 +++++- src/SConscript | 7 ++++++- src/engine/lsmp3.c | 2 +- src/engine/pce.h | 2 +- src/engine/romdb.c | 2 +- src/includes/osd_sdl_gfx.h | 4 ++++ src/osd_sdl_gfx.c | 2 ++ 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index 9634589..fe28319 100644 --- a/SConstruct +++ b/SConstruct @@ -30,7 +30,11 @@ if not conf.CheckPKG('sdl2'): env = conf.Finish() env.Append(CPPPATH = ['#src/includes/', '#src/engine/']) -env.Append(LIBS = ['-lSDL2_mixer', '-lvorbisfile', '-lGL', '-lGLU']) +env.Append(LIBS = ['-lSDL2_mixer', '-lvorbisfile']) +if env['PLATFORM'] == 'darwin': + env.Append(FRAMEWORKS = ['OpenGL']) +else: + env.Append(LIBS = ['-lGL', '-GLu']) env.Append(CFLAGS = ['-g']) env.Append(LINKFLAGS = ['-g']) env.Append(CPPDEFINES={'VERSION_MAJOR' : '3'}) diff --git a/src/SConscript b/src/SConscript index cb55425..0715d64 100644 --- a/src/SConscript +++ b/src/SConscript @@ -49,11 +49,16 @@ engine_sources = [ 'engine/trans_fx.c' ] -if env['PLATFORM'] in ('posix', 'linux', 'freebsd', 'darwin'): +if env['PLATFORM'] in ('posix', 'linux', 'freebsd'): main_sources += [ 'osd_linux_cd.c', 'osd_keyboard.c', ] +elif env['PLATFORM'] in ('darwin'): + main_sources += [ + 'osd_dummy_cd.c', + 'osd_keyboard.c', + ] elif env['PLATFORM'] in ('haiku'): main_sources += [ 'osd_haiku_cd.c', diff --git a/src/engine/lsmp3.c b/src/engine/lsmp3.c index 8747446..7de03b6 100644 --- a/src/engine/lsmp3.c +++ b/src/engine/lsmp3.c @@ -40,7 +40,7 @@ #include #include #include -#if defined(__linux__) +#if defined(__linux__) || defined(__APPLE__) #include #endif #include diff --git a/src/engine/pce.h b/src/engine/pce.h index d20c673..7bfd5c0 100644 --- a/src/engine/pce.h +++ b/src/engine/pce.h @@ -4,7 +4,7 @@ #include "config.h" -#if defined(__linux__) +#if defined(__linux__) || defined(__APPLE__) #include #endif diff --git a/src/engine/romdb.c b/src/engine/romdb.c index 07b40ff..9dbc9d5 100644 --- a/src/engine/romdb.c +++ b/src/engine/romdb.c @@ -9,7 +9,7 @@ #include "romdb.h" -#if defined(__linux__) +#if defined(__linux__) || defined(__APPLE__) #include #endif #include diff --git a/src/includes/osd_sdl_gfx.h b/src/includes/osd_sdl_gfx.h index c1d5f3f..3cdc867 100644 --- a/src/includes/osd_sdl_gfx.h +++ b/src/includes/osd_sdl_gfx.h @@ -6,7 +6,11 @@ #include #include +#if defined(__APPLE__) +#include +#else #include +#endif extern uchar *OSD_MESSAGE_SPR; diff --git a/src/osd_sdl_gfx.c b/src/osd_sdl_gfx.c index 704b012..adead5b 100644 --- a/src/osd_sdl_gfx.c +++ b/src/osd_sdl_gfx.c @@ -371,7 +371,9 @@ osd_gfx_glinit(struct generic_rect* viewport) glDisable(GL_ALPHA_TEST); glDisable(GL_BLEND); glDisable(GL_LIGHTING); +#if !defined(__APPLE__) glDisable(GL_TEXTURE_3D_EXT); +#endif glMatrixMode(GL_PROJECTION); glLoadIdentity();