OpenTTD Source  12.0-beta2
osx_stdafx.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef MACOS_STDAFX_H
11 #define MACOS_STDAFX_H
12 
13 
14 #include <AvailabilityMacros.h>
15 
16 /* We assume if these macros are defined, the SDK is also at least this version or later. */
17 #ifdef MAC_OS_X_VERSION_10_7
18 #define HAVE_OSX_107_SDK
19 #endif
20 
21 #ifdef MAC_OS_X_VERSION_10_9
22 #define HAVE_OSX_109_SDK
23 #endif
24 
25 #ifdef MAC_OS_X_VERSION_10_11
26 #define HAVE_OSX_1011_SDK
27 #endif
28 
29 #ifdef MAC_OS_X_VERSION_10_12
30 #define HAVE_OSX_1012_SDK
31 #endif
32 
33 /* It would seem that to ensure backward compatibility we have to ensure that we have defined MAC_OS_X_VERSION_10_x everywhere */
34 #ifndef MAC_OS_X_VERSION_10_3
35 #define MAC_OS_X_VERSION_10_3 1030
36 #endif
37 
38 #ifndef MAC_OS_X_VERSION_10_4
39 #define MAC_OS_X_VERSION_10_4 1040
40 #endif
41 
42 #ifndef MAC_OS_X_VERSION_10_5
43 #define MAC_OS_X_VERSION_10_5 1050
44 #endif
45 
46 #ifndef MAC_OS_X_VERSION_10_6
47 #define MAC_OS_X_VERSION_10_6 1060
48 #endif
49 
50 #ifndef MAC_OS_X_VERSION_10_7
51 #define MAC_OS_X_VERSION_10_7 1070
52 #endif
53 
54 #ifndef MAC_OS_X_VERSION_10_8
55 #define MAC_OS_X_VERSION_10_8 1080
56 #endif
57 
58 #ifndef MAC_OS_X_VERSION_10_9
59 #define MAC_OS_X_VERSION_10_9 1090
60 #endif
61 
62 #ifndef MAC_OS_X_VERSION_10_10
63 #define MAC_OS_X_VERSION_10_10 101000
64 #endif
65 
66 #ifndef MAC_OS_X_VERSION_10_11
67 #define MAC_OS_X_VERSION_10_11 101100
68 #endif
69 
70 #define __STDC_LIMIT_MACROS
71 #include <stdint.h>
72 
73 /* Some gcc versions include assert.h via this header. As this would interfere
74  * with our own assert redefinition, include this header first. */
75 #if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
76 # include <debug/debug.h>
77 #endif
78 
79 /* Check for mismatching 'architectures' */
80 #if !defined(STRGEN) && !defined(SETTINGSGEN) && ((defined(__LP64__) && !defined(POINTER_IS_64BIT)) || (!defined(__LP64__) && defined(POINTER_IS_64BIT)))
81 # error "Compiling 64 bits without POINTER_IS_64BIT set! (or vice versa)"
82 #endif
83 
84 /* Name conflict */
85 #define Rect OTTDRect
86 #define Point OTTDPoint
87 #define WindowClass OTTDWindowClass
88 #define ScriptOrder OTTDScriptOrder
89 #define Palette OTTDPalette
90 #define GlyphID OTTDGlyphID
91 
92 #include <CoreServices/CoreServices.h>
93 #include <ApplicationServices/ApplicationServices.h>
94 
95 #undef Rect
96 #undef Point
97 #undef WindowClass
98 #undef ScriptOrder
99 #undef Palette
100 #undef GlyphID
101 
102 /* remove the variables that CoreServices defines, but we define ourselves too */
103 #undef bool
104 #undef false
105 #undef true
106 
107 /* Name conflict */
108 #define GetTime OTTD_GetTime
109 
110 #define SL_ERROR OSX_SL_ERROR
111 
112 /* NSInteger and NSUInteger are part of 10.5 and higher. */
113 #ifndef NSInteger
114 #ifdef __LP64__
115 typedef long NSInteger;
116 typedef unsigned long NSUInteger;
117 #else
118 typedef int NSInteger;
119 typedef unsigned int NSUInteger;
120 #endif /* __LP64__ */
121 #endif /* NSInteger */
122 
123 #ifndef CGFLOAT_DEFINED
124 #ifdef __LP64__
125 typedef double CGFloat;
126 #else
127 typedef float CGFloat;
128 #endif /* __LP64__ */
129 #endif /* CGFLOAT_DEFINED */
130 
131 /* OS X SDK versions >= 10.5 have a non-const iconv. */
132 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
133 # define HAVE_NON_CONST_ICONV
134 #endif
135 
136 #endif /* MACOS_STDAFX_H */