From 0e379977346004a52fb8648f16062ad2a894d4a8 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Wed, 30 Mar 2011 19:52:36 +0200 Subject: [PATCH 1/3] CMake : add support for ppc arch and 10.5 SDK --- CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f06b473a..6a16a35b 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) + # 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) From 816cc6f6372145bbe35e81dbe240d356a80ca563 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Wed, 30 Mar 2011 20:31:09 +0200 Subject: [PATCH 2/3] Fix compilation issues with 10.5 --- src/SFML/Window/OSX/SFWindowController.mm | 1 + src/SFML/Window/OSX/cg_sf_conversion.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) 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); } From d53750fa3551debcf2f1876bae79ecf5197d21c8 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Thu, 31 Mar 2011 16:31:40 +0200 Subject: [PATCH 3/3] CMake : deactivate ppc support. --- CMakeLists.txt | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a16a35b..88a77bde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,8 +32,8 @@ set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to # Mac OS X specific options if (MACOSX) - # 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") + # (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") @@ -68,26 +68,26 @@ 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() +# # 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)