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

OpenTTD Source 14.0-beta1

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