diff --git a/CMakeLists.txt b/CMakeLists.txt index f06b473a..88a77bde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,16 @@ set(BUILD_SHARED_LIBS TRUE CACHE BOOL "TRUE to build SFML as shared libraries, F set(BUILD_EXAMPLES FALSE CACHE BOOL "TRUE to build the SFML examples, FALSE to ignore them") # add an option for building the API documentation -set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it") +set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it") + +# Mac OS X specific options +if (MACOSX) + # (Not supported anymore by extlibs) add an option to compile ppc/ppc64 + #set(BUILD_PPC FALSE CACHE BOOL "TRUE to build SFML for ppc and ppc64, too, FALSE to only compile i386 and x86_64") + + # add an option to build against 10.5 SDK + set(BUILD_LEOPARD FALSE CACHE BOOL "TRUE to build SFML for OS X 10.5, FALSE to compile for default SDK") +endif() # define SFML_STATIC if the build type is not set to 'shared' if(NOT BUILD_SHARED_LIBS) @@ -55,7 +64,40 @@ if(COMPILER_MSVC) endif() # disable the rpath stuff -set(CMAKE_SKIP_BUILD_RPATH TRUE) +set(CMAKE_SKIP_BUILD_RPATH TRUE) + +# Setup Mac OS X multi arch/SDK support. +if (MACOSX) +# # compile for PPC ? +# if (BUILD_PPC) +# if (NOT CMAKE_OSX_ARCHITECTURES) +# # Custom : ppc, ppc64, i386 and x86_64 +# set(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64") +# else() +# # We got some conflict with custom user settings ; let him know his on his own. +# message("You set BUILD_PPC to TRUE but CMAKE_OSX_ARCHITECTURES is not empty.") +# message("You're on your own : I won't change your settings.") +# endif() +# else() +# if (NOT CMAKE_OSX_ARCHITECTURES) +# # Default : i386 and x86_64 +# set(CMAKE_OSX_ARCHITECTURES "i386;x86_64") +# else() +# # We got some conflict with custom user settings ; let him know his on his own. +# message("CMAKE_OSX_ARCHITECTURES is not empty.") +# message("You're on your own : I won't change your settings.") +# endif() +# endif() + + # use 10.5 SDK ? + if (BUILD_LEOPARD) + # Use 10.5 SDK : override default value + set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk") + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5") + else() + # Default SDK, let either the user or CMake decide which one to use. + endif() +endif() # add the subdirectories add_subdirectory(src/SFML) diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm index 4aa87332..f46a9f6a 100644 --- a/src/SFML/Window/OSX/SFWindowController.mm +++ b/src/SFML/Window/OSX/SFWindowController.mm @@ -37,6 +37,7 @@ #import #import #import +#import //////////////////////////////////////////////////////////// /// SFWindowController class : Privates Methods Declaration diff --git a/src/SFML/Window/OSX/cg_sf_conversion.cpp b/src/SFML/Window/OSX/cg_sf_conversion.cpp index d8d5810d..7de2659b 100644 --- a/src/SFML/Window/OSX/cg_sf_conversion.cpp +++ b/src/SFML/Window/OSX/cg_sf_conversion.cpp @@ -96,14 +96,14 @@ VideoMode ConvertCGModeToSFMode(CFDictionaryRef dictionary) { VideoMode sfmode; - CFNumberRef cfnumber = (CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayWidth); - CFNumberGetValue(cfnumber, kCFNumberIntType, &(mode.Width)); + CFNumberRef cfnumber = (CFNumberRef)CFDictionaryGetValue(dictionary, kCGDisplayWidth); + CFNumberGetValue(cfnumber, kCFNumberIntType, &(sfmode.Width)); - cfnumber = (CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayHeight); - CFNumberGetValue(cfnumber, kCFNumberIntType, &(mode.Height)); + cfnumber = (CFNumberRef)CFDictionaryGetValue(dictionary, kCGDisplayHeight); + CFNumberGetValue(cfnumber, kCFNumberIntType, &(sfmode.Height)); - cfnumber = (CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayBitsPerPixel); - CFNumberGetValue(cfnumber, kCFNumberIntType, &(mode.BitsPerPixel)); + cfnumber = (CFNumberRef)CFDictionaryGetValue(dictionary, kCGDisplayBitsPerPixel); + CFNumberGetValue(cfnumber, kCFNumberIntType, &(sfmode.BitsPerPixel)); return sfmode; } @@ -129,7 +129,7 @@ CFDictionaryRef ConvertSFModeToCGMode(VideoMode sfmode) return CGDisplayBestModeForParameters(CGMainDisplayID(), sfmode.BitsPerPixel, sfmode.Width, - sfmode.Height + sfmode.Height, NULL); }