OpenTTD
osx_stdafx.h
Go to the documentation of this file.
1 /* $Id$ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef MACOS_STDAFX_H
13 #define MACOS_STDAFX_H
14 
15 
16 #include <AvailabilityMacros.h>
17 
18 /* We assume if these macros are defined, the SDK is also at least this version or later. */
19 #ifdef MAC_OS_X_VERSION_10_7
20 #define HAVE_OSX_107_SDK
21 #endif
22 
23 #ifdef MAC_OS_X_VERSION_10_11
24 #define HAVE_OSX_1011_SDK
25 #endif
26 
27 /* It would seem that to ensure backward compability we have to ensure that we have defined MAC_OS_X_VERSION_10_x everywhere */
28 #ifndef MAC_OS_X_VERSION_10_3
29 #define MAC_OS_X_VERSION_10_3 1030
30 #endif
31 
32 #ifndef MAC_OS_X_VERSION_10_4
33 #define MAC_OS_X_VERSION_10_4 1040
34 #endif
35 
36 #ifndef MAC_OS_X_VERSION_10_5
37 #define MAC_OS_X_VERSION_10_5 1050
38 #endif
39 
40 #ifndef MAC_OS_X_VERSION_10_6
41 #define MAC_OS_X_VERSION_10_6 1060
42 #endif
43 
44 #ifndef MAC_OS_X_VERSION_10_7
45 #define MAC_OS_X_VERSION_10_7 1070
46 #endif
47 
48 #ifndef MAC_OS_X_VERSION_10_8
49 #define MAC_OS_X_VERSION_10_8 1080
50 #endif
51 
52 #ifndef MAC_OS_X_VERSION_10_9
53 #define MAC_OS_X_VERSION_10_9 1090
54 #endif
55 
56 #ifndef MAC_OS_X_VERSION_10_10
57 #define MAC_OS_X_VERSION_10_10 101000
58 #endif
59 
60 #ifndef MAC_OS_X_VERSION_10_11
61 #define MAC_OS_X_VERSION_10_11 101100
62 #endif
63 
64 #define __STDC_LIMIT_MACROS
65 #include <stdint.h>
66 
67 /* Some gcc versions include assert.h via this header. As this would interfere
68  * with our own assert redefinition, include this header first. */
69 #if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
70 # include <debug/debug.h>
71 #endif
72 
73 /* Check for mismatching 'architectures' */
74 #if !defined(STRGEN) && !defined(SETTINGSGEN) && ((defined(__LP64__) && !defined(_SQ64)) || (!defined(__LP64__) && defined(_SQ64)))
75 # error "Compiling 64 bits without _SQ64 set! (or vice versa)"
76 #endif
77 
78 /* Name conflict */
79 #define Rect OTTDRect
80 #define Point OTTDPoint
81 #define WindowClass OTTDWindowClass
82 #define ScriptOrder OTTDScriptOrder
83 #define Palette OTTDPalette
84 #define GlyphID OTTDGlyphID
85 
86 #include <CoreServices/CoreServices.h>
87 #include <ApplicationServices/ApplicationServices.h>
88 
89 #undef Rect
90 #undef Point
91 #undef WindowClass
92 #undef ScriptOrder
93 #undef Palette
94 #undef GlyphID
95 
96 /* remove the variables that CoreServices defines, but we define ourselves too */
97 #undef bool
98 #undef false
99 #undef true
100 
101 /* Name conflict */
102 #define GetTime OTTD_GetTime
103 
104 #define SL_ERROR OSX_SL_ERROR
105 
106 /* NSInteger and NSUInteger are part of 10.5 and higher. */
107 #ifndef NSInteger
108 #ifdef __LP64__
109 typedef long NSInteger;
110 typedef unsigned long NSUInteger;
111 #else
112 typedef int NSInteger;
113 typedef unsigned int NSUInteger;
114 #endif /* __LP64__ */
115 #endif /* NSInteger */
116 
117 #ifndef CGFLOAT_DEFINED
118 #ifdef __LP64__
119 typedef double CGFloat;
120 #else
121 typedef float CGFloat;
122 #endif /* __LP64__ */
123 #endif /* CGFLOAT_DEFINED */
124 
125 /* OS X SDK versions >= 10.5 have a non-const iconv. */
126 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
127 # define HAVE_NON_CONST_ICONV
128 #endif
129 
130 #endif /* MACOS_STDAFX_H */