From 23224f1c1da86a8bdcc1128620f01ed624753313 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 1 Apr 2013 08:02:19 -0700 Subject: [PATCH 1/3] OS X: Fix build on Mac OS X 10.6 (from vit9696.) --- Common/ChunkFile.h | 4 ++-- Common/StdMutex.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Common/ChunkFile.h b/Common/ChunkFile.h index 982d854680..1fbf453adf 100644 --- a/Common/ChunkFile.h +++ b/Common/ChunkFile.h @@ -34,7 +34,7 @@ #include #include #ifndef __SYMBIAN32__ -#ifdef IOS +#if defined(IOS) || (defined(__APPLE__) && !defined(__MAC_10_7)) #include #else #include @@ -45,7 +45,7 @@ #include "FileUtil.h" #include "../ext/snappy/snappy-c.h" -#if defined(ANDROID) || defined(IOS) +#if defined(ANDROID) || defined(IOS) || (defined(__APPLE__) && !defined(__MAC_10_7)) namespace std { using tr1::is_pointer; } diff --git a/Common/StdMutex.h b/Common/StdMutex.h index cabebd51ab..2ec9322021 100644 --- a/Common/StdMutex.h +++ b/Common/StdMutex.h @@ -7,7 +7,7 @@ #if (GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ || defined(__APPLE__)) \ /* GCC 4.4 provides , except on these platforms: */ \ - && !defined(ANDROID) && !defined(__SYMBIAN32__) && !defined(IOS) + && !defined(ANDROID) && !defined(__SYMBIAN32__) && !defined(IOS) && !defined(__MAC_10_6) #include #else From 1cfe152225a6c3240ee559e9d4b94b5f2f9c7b58 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 1 Apr 2013 08:08:40 -0700 Subject: [PATCH 2/3] OS X: Look for assets/ in prog dir (from vit9696.) --- UI/NativeApp.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index f87de53dbd..ff9c3111b4 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -57,6 +57,10 @@ #include "../../android/jni/ArmEmitterTest.h" #endif +#if defined(__APPLE__) && !defined(IOS) +#include +#endif + Texture *uiTexture; ScreenManager *screenManager; @@ -185,6 +189,15 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co #elif defined(IOS) VFSRegister("", new DirectoryAssetReader(external_directory)); user_data_path += "/"; +#elif defined(__APPLE__) + char program_path[4090]; + uint32_t program_path_size = sizeof(program_path); + _NSGetExecutablePath(program_path,&program_path_size); + *(strrchr(program_path, '/')+1) = '\0'; + char assets_path[4096]; + sprintf(assets_path,"%sassets/",program_path); + VFSRegister("", new DirectoryAssetReader(assets_path)); + VFSRegister("", new DirectoryAssetReader("assets/")); #else VFSRegister("", new DirectoryAssetReader("assets/")); #endif From a31907dc709e9f286b58bcf84d74fa3a8e8095d1 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 2 Apr 2013 07:10:46 -0700 Subject: [PATCH 3/3] OS X: Workaround weird problem in OS X 10.6 with defines. Apparently !defined(__MAC_10_6) doesn't work? --- Common/StdMutex.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Common/StdMutex.h b/Common/StdMutex.h index 2ec9322021..d3410e70a1 100644 --- a/Common/StdMutex.h +++ b/Common/StdMutex.h @@ -5,9 +5,10 @@ #define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) -#if (GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ || defined(__APPLE__)) \ +// Note: __MAC_10_7 is defined on 10.7+. +#if (GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ || defined(__MAC_10_7)) \ /* GCC 4.4 provides , except on these platforms: */ \ - && !defined(ANDROID) && !defined(__SYMBIAN32__) && !defined(IOS) && !defined(__MAC_10_6) + && !defined(ANDROID) && !defined(__SYMBIAN32__) && !defined(IOS) #include #else