From: Christoph Sommer Date: Sun, 16 Dec 2007 00:30:02 +0000 (+0000) Subject: Made compiles on MacOS X a bit smoother, activated MacOS-specific code for CMake... X-Git-Url: https://git.octo.it/?p=supertux.git;a=commitdiff_plain;h=979050bfb71550421272b98a608b64beba388271 Made compiles on MacOS X a bit smoother, activated MacOS-specific code for CMake, marked some more CMake vars as advanced SVN-Revision: 5192 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 725b3f993..c15419bcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,8 @@ MARK_AS_ADVANCED( CMAKE_INSTALL_PREFIX EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH + CMAKE_OSX_ARCHITECTURES + CMAKE_OSX_SYSROOT ) ## For autopackage @@ -266,6 +268,10 @@ IF(CMAKE_COMPILER_IS_GNUCC) ADD_DEFINITIONS(-fno-strict-aliasing) ENDIF(CMAKE_COMPILER_IS_GNUCC) +IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + ADD_DEFINITIONS(-DMACOSX) +ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + ## On Windows, add an icon diff --git a/src/audio/openal_sound_source.hpp b/src/audio/openal_sound_source.hpp index 88f645438..4b03ed6d7 100644 --- a/src/audio/openal_sound_source.hpp +++ b/src/audio/openal_sound_source.hpp @@ -19,7 +19,12 @@ #ifndef __OPENAL_SOUND_SOURCE_H__ #define __OPENAL_SOUND_SOURCE_H__ -#include +#ifndef MACOSX +#include +#else +#include +#endif + #include "math/vector.hpp" #include "sound_source.hpp" diff --git a/src/audio/sound_manager.hpp b/src/audio/sound_manager.hpp index 921b859ef..12f19447c 100644 --- a/src/audio/sound_manager.hpp +++ b/src/audio/sound_manager.hpp @@ -23,8 +23,14 @@ #include #include -#include -#include +#ifndef MACOSX +#include +#include +#else +#include +#include +#endif + #include "math/vector.hpp" class SoundFile; diff --git a/src/main.cpp b/src/main.cpp index 2148861eb..8144ecde9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,7 +35,9 @@ #include #ifdef MACOSX -# include +namespace supertux_apple { +#include +} #endif #include "gameconfig.hpp" @@ -168,13 +170,16 @@ static void init_physfs(const char* argv0) } #ifdef MACOSX +{ + using namespace supertux_apple; + // when started from Application file on Mac OS X... char path[PATH_MAX]; CFBundleRef mainBundle = CFBundleGetMainBundle(); assert(mainBundle != 0); CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); assert(mainBundleURL != 0); - CFStringRef pathStr = CFUrlCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); + CFStringRef pathStr = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); assert(pathStr != 0); CFStringGetCString(pathStr, path, PATH_MAX, kCFStringEncodingUTF8); CFRelease(mainBundleURL); @@ -192,6 +197,7 @@ static void init_physfs(const char* argv0) sourcedir = true; } } +} #endif #ifdef _WIN32 diff --git a/src/tinygettext/findlocale.cpp b/src/tinygettext/findlocale.cpp index 42398db37..f559011c0 100644 --- a/src/tinygettext/findlocale.cpp +++ b/src/tinygettext/findlocale.cpp @@ -38,7 +38,7 @@ from the Author. #endif #ifdef MACOSX -#include +#include #endif #include "findlocale.hpp" diff --git a/src/video/glutil.hpp b/src/video/glutil.hpp index b19ce8b10..85200bdd6 100644 --- a/src/video/glutil.hpp +++ b/src/video/glutil.hpp @@ -25,8 +25,14 @@ #include #include + +#ifndef MACOSX #include #include +#else +#include +#include +#endif static inline void check_gl_error(const char* message) { diff --git a/tools/miniswig/CMakeLists.txt b/tools/miniswig/CMakeLists.txt index 6f1cbe7d3..93607a07c 100644 --- a/tools/miniswig/CMakeLists.txt +++ b/tools/miniswig/CMakeLists.txt @@ -36,6 +36,7 @@ FILE(GLOB MINISWIG_SOURCES RELATIVE ${MINISWIG_SOURCE_DIR} create_docu.cpp creat ## Add target for bison parser generation +MARK_AS_ADVANCED(BISON_EXECUTABLE) FIND_PROGRAM(BISON_EXECUTABLE bison) IF (NOT BISON_EXECUTABLE) MESSAGE(FATAL_ERROR "bison not found - aborting") @@ -49,6 +50,7 @@ ADD_CUSTOM_COMMAND( ## Add target for flex lexical analyzer generation +MARK_AS_ADVANCED(FLEX_EXECUTABLE) FIND_PROGRAM(FLEX_EXECUTABLE flex) IF (NOT FLEX_EXECUTABLE) MESSAGE(FATAL_ERROR "flex not found - aborting")