OpenTTD Source: src/os/macosx/osx_stdafx.h Source File

OpenTTD Source 1.11.0-RC1

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