From 585d934137e2e28dce5bf976ae15189f941a9f55 Mon Sep 17 00:00:00 2001 From: Jean-Francois Richard Date: Sat, 3 Mar 2012 22:12:34 -0500 Subject: [PATCH] Make it so that the project compile on the Mac platform. --- CMakeLists.txt | 8 ++++++-- src/core/Core.cpp | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9915952bf5..c7aea67048 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,8 +111,12 @@ endif() find_package(Doxygen) find_package(PythonInterp) if(USE_SDL) - set(SDL_BUILDING_LIBRARY 1) # Required to avoid linking with SDLmain... - find_package(SDL 1.2 EXACT) + if(!APPLE) + # Required to avoid linking with SDLmain except for OS X where it is necessary + # due to the need to have NSApplication correctly setup by SDLmain. + set(SDL_BUILDING_LIBRARY 1) + endif() + find_package(SDL 1.2 EXACT) endif() if(MSVC) diff --git a/src/core/Core.cpp b/src/core/Core.cpp index a96c23396a..9f7d4cbe29 100644 --- a/src/core/Core.cpp +++ b/src/core/Core.cpp @@ -147,6 +147,13 @@ ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. #include "window/RenderWindow.h" +// Under OS X we want SDLmain to replace the entry point with its own. +// TODO: I don't think this is wanted and we'll need to add the NSApplication setup +// on the Arx Libertatis side instead of SDLmain's. +#if defined(__APPLE__) && defined(__MACH__) + #include +#endif + class TextManager; using std::min;