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