Made compiles on MacOS X a bit smoother, activated MacOS-specific code for CMake...
authorChristoph Sommer <mail@christoph-sommer.de>
Sun, 16 Dec 2007 00:30:02 +0000 (00:30 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Sun, 16 Dec 2007 00:30:02 +0000 (00:30 +0000)
SVN-Revision: 5192

CMakeLists.txt
src/audio/openal_sound_source.hpp
src/audio/sound_manager.hpp
src/main.cpp
src/tinygettext/findlocale.cpp
src/video/glutil.hpp
tools/miniswig/CMakeLists.txt

index 725b3f9..c15419b 100644 (file)
@@ -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
 
index 88f6454..4b03ed6 100644 (file)
 #ifndef __OPENAL_SOUND_SOURCE_H__
 #define __OPENAL_SOUND_SOURCE_H__
 
-#include <al.h>
+#ifndef MACOSX
+#include <AL/al.h>
+#else
+#include <OpenAL/al.h>
+#endif
+
 #include "math/vector.hpp"
 #include "sound_source.hpp"
 
index 921b859..12f1944 100644 (file)
 #include <vector>
 #include <map>
 
-#include <alc.h>
-#include <al.h>
+#ifndef MACOSX
+#include <AL/alc.h>
+#include <AL/al.h>
+#else
+#include <OpenAL/alc.h>
+#include <OpenAL/al.h>
+#endif
+
 #include "math/vector.hpp"
 
 class SoundFile;
index 2148861..8144ecd 100644 (file)
@@ -35,7 +35,9 @@
 #include <SDL_image.h>
 
 #ifdef MACOSX
-# include <CoreFoundation/CoreFoundation.h>
+namespace supertux_apple {
+#include <CoreFoundation/CoreFoundation.h>
+}
 #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
index 42398db..f559011 100644 (file)
@@ -38,7 +38,7 @@ from the Author.
 #endif
 
 #ifdef MACOSX
-#include <Carbon/Carbon.h>
+#include <CoreFoundation/CoreFoundation.h>
 #endif
 
 #include "findlocale.hpp"
index b19ce8b..85200bd 100644 (file)
 
 #include <sstream>
 #include <stdexcept>
+
+#ifndef MACOSX
 #include <GL/gl.h>
 #include <GL/glext.h>
+#else
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#endif
 
 static inline void check_gl_error(const char* message)
 {
index 6f1cbe7..93607a0 100644 (file)
@@ -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")