(svn r11540) -Fix: [OSX] Don't try to compile the quartz video driver on OSX 10.3. It will fail
authorbjarni
Fri, 30 Nov 2007 13:26:24 +0000
changeset 8480 0ca368be883d
parent 8479 a1ab2afafb84
child 8481 cf854106761d
(svn r11540) -Fix: [OSX] Don't try to compile the quartz video driver on OSX 10.3. It will fail
src/os/macosx/macos.mm
src/video/cocoa/cocoa_v.h
src/video/cocoa/cocoa_v.mm
src/video/cocoa/wnd_quartz.mm
--- a/src/os/macosx/macos.mm	Thu Nov 29 18:27:39 2007 +0000
+++ b/src/os/macosx/macos.mm	Fri Nov 30 13:26:24 2007 +0000
@@ -171,9 +171,18 @@
 	NSArray* languages = [defs objectForKey:@"AppleLanguages"];
 	NSString* preferredLang = [languages objectAtIndex:0];
 	/* preferredLang is either 2 or 5 characters long ("xx" or "xx_YY"). */
+
+	/* MacOS 10.3.9 can't handle encoding:NSASCIIStringEncoding
+	 * we will completely disable compiling it for such old targets to avoid a warning */
+#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_3)
+	/* Note: MAC_OS_X_VERSION_MAX_ALLOWED is the current OSX version/SDK by default */
 	if (MacOSVersionIsAtLeast(10, 4, 0)) {
 		[ preferredLang getCString:retbuf maxLength:32 encoding:NSASCIIStringEncoding ];
 	} else {
+#else
+	/* 10.3.9 needs to start the { too */
+	{
+#endif
 		[ preferredLang getCString:retbuf maxLength:32 ];
 	}
 	return retbuf;
--- a/src/video/cocoa/cocoa_v.h	Thu Nov 29 18:27:39 2007 +0000
+++ b/src/video/cocoa/cocoa_v.h	Fri Nov 30 13:26:24 2007 +0000
@@ -3,6 +3,8 @@
 #ifndef VIDEO_COCOA_H
 #define VIDEO_COCOA_H
 
+#include <AvailabilityMacros.h>
+
 #include "../video_driver.hpp"
 
 class VideoDriver_Cocoa: public VideoDriver {
@@ -59,8 +61,11 @@
 extern CocoaSubdriver* _cocoa_subdriver;
 
 CocoaSubdriver *QZ_CreateFullscreenSubdriver(int width, int height, int bpp);
+CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp);
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
 CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp);
-CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp);
+#endif
 
 void QZ_GameSizeChanged();
 
--- a/src/video/cocoa/cocoa_v.mm	Thu Nov 29 18:27:39 2007 +0000
+++ b/src/video/cocoa/cocoa_v.mm	Fri Nov 30 13:26:24 2007 +0000
@@ -232,10 +232,12 @@
 {
 	CocoaSubdriver *ret;
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
 	if (MacOSVersionIsAtLeast(10, 4, 0)) {
 		ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
 		if (ret != NULL) return ret;
 	}
+#endif
 
 	ret = QZ_CreateWindowQuickdrawSubdriver(width, height, bpp);
 	if (ret != NULL) return ret;
--- a/src/video/cocoa/wnd_quartz.mm	Thu Nov 29 18:27:39 2007 +0000
+++ b/src/video/cocoa/wnd_quartz.mm	Fri Nov 30 13:26:24 2007 +0000
@@ -8,9 +8,10 @@
 
 #ifdef WITH_COCOA
 
-#define MAC_OS_X_VERSION_MIN_REQUIRED    MAC_OS_X_VERSION_10_4
 #include <AvailabilityMacros.h>
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+
 #import <Cocoa/Cocoa.h>
 #import <sys/time.h> /* gettimeofday */
 #import <sys/param.h> /* for MAXPATHLEN */
@@ -801,4 +802,5 @@
 	return ret;
 }
 
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 */
 #endif /* WITH_COCOA */