OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // hack to ensure we know what sort of Apple platform we're on | 26 // hack to ensure we know what sort of Apple platform we're on |
27 #if defined(__APPLE_CPP__) || defined(__APPLE_CC__) | 27 #if defined(__APPLE_CPP__) || defined(__APPLE_CC__) |
28 #include <TargetConditionals.h> | 28 #include <TargetConditionals.h> |
29 #endif | 29 #endif |
30 | 30 |
31 /** | 31 /** |
32 * Gr defines are set to 0 or 1, rather than being undefined or defined | 32 * Gr defines are set to 0 or 1, rather than being undefined or defined |
33 */ | 33 */ |
34 | 34 |
35 #if !defined(GR_ANDROID_BUILD) | |
36 #define GR_ANDROID_BUILD 0 | |
37 #endif | |
38 #if !defined(GR_IOS_BUILD) | |
39 #define GR_IOS_BUILD 0 | |
40 #endif | |
41 #if !defined(GR_LINUX_BUILD) | |
42 #define GR_LINUX_BUILD 0 | |
43 #endif | |
44 #if !defined(GR_MAC_BUILD) | |
45 #define GR_MAC_BUILD 0 | |
46 #endif | |
47 #if !defined(GR_WIN32_BUILD) | |
48 #define GR_WIN32_BUILD 0 | |
49 #endif | |
50 #if !defined(GR_QNX_BUILD) | |
51 #define GR_QNX_BUILD 0 | |
52 #endif | |
53 #if !defined(GR_CACHE_STATS) | 35 #if !defined(GR_CACHE_STATS) |
54 #define GR_CACHE_STATS 0 | 36 #define GR_CACHE_STATS 0 |
55 #endif | 37 #endif |
56 | 38 |
57 /** | |
58 * If no build target has been defined, attempt to infer. | |
59 */ | |
60 #if !GR_ANDROID_BUILD && !GR_IOS_BUILD && !GR_LINUX_BUILD && !GR_MAC_BUILD && !G
R_WIN32_BUILD && !GR_QNX_BUILD | |
61 #if defined(_WIN32) | |
62 #undef GR_WIN32_BUILD | |
63 #define GR_WIN32_BUILD 1 | |
64 // #error "WIN" | |
65 #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR | |
66 #undef GR_IOS_BUILD | |
67 #define GR_IOS_BUILD 1 | |
68 // #error "IOS" | |
69 #elif defined(SK_BUILD_FOR_ANDROID) | |
70 #undef GR_ANDROID_BUILD | |
71 #define GR_ANDROID_BUILD 1 | |
72 // #error "ANDROID" | |
73 #elif TARGET_OS_MAC | |
74 #undef GR_MAC_BUILD | |
75 #define GR_MAC_BUILD 1 | |
76 // #error "MAC" | |
77 #elif TARGET_OS_QNX || defined(__QNXNTO__) | |
78 #undef GR_QNX_BUILD | |
79 #define GR_QNX_BUILD 1 | |
80 // #error "QNX" | |
81 #else | |
82 #undef GR_LINUX_BUILD | |
83 #define GR_LINUX_BUILD 1 | |
84 // #error "LINUX" | |
85 #endif | |
86 #endif | |
87 | |
88 /////////////////////////////////////////////////////////////////////////////// | 39 /////////////////////////////////////////////////////////////////////////////// |
89 /////////////////////////////////////////////////////////////////////////////// | 40 /////////////////////////////////////////////////////////////////////////////// |
90 | 41 |
91 #if GR_WIN32_BUILD | 42 #if defined(SK_BUILD_FOR_WIN32) |
92 // VC8 doesn't support stdint.h, so we define those types here. | 43 // VC8 doesn't support stdint.h, so we define those types here. |
93 typedef signed char int8_t; | 44 typedef signed char int8_t; |
94 typedef unsigned char uint8_t; | 45 typedef unsigned char uint8_t; |
95 typedef short int16_t; | 46 typedef short int16_t; |
96 typedef unsigned short uint16_t; | 47 typedef unsigned short uint16_t; |
97 typedef int int32_t; | 48 typedef int int32_t; |
98 typedef unsigned uint32_t; | 49 typedef unsigned uint32_t; |
99 typedef __int64 int64_t; | 50 typedef __int64 int64_t; |
100 typedef unsigned __int64 uint64_t; | 51 typedef unsigned __int64 uint64_t; |
101 #else | 52 #else |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 #if defined(_MSC_VER) && _MSC_VER | 120 #if defined(_MSC_VER) && _MSC_VER |
170 #define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG) | 121 #define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG) |
171 #else//__GNUC__ - may need other defines for different compilers | 122 #else//__GNUC__ - may need other defines for different compilers |
172 #define GR_WARN(MSG) ("WARNING: " MSG) | 123 #define GR_WARN(MSG) ("WARNING: " MSG) |
173 #endif | 124 #endif |
174 | 125 |
175 /** | 126 /** |
176 * GR_ALWAYSBREAK is an unconditional break in all builds. | 127 * GR_ALWAYSBREAK is an unconditional break in all builds. |
177 */ | 128 */ |
178 #if !defined(GR_ALWAYSBREAK) | 129 #if !defined(GR_ALWAYSBREAK) |
179 #if GR_WIN32_BUILD | 130 #if defined(SK_BUILD_FOR_WIN32) |
180 #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); __debugbreak() | 131 #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); __debugbreak() |
181 #else | 132 #else |
182 // TODO: do other platforms really not have continuable breakpoints? | 133 // TODO: do other platforms really not have continuable breakpoints? |
183 // sign extend for 64bit architectures to be sure this is | 134 // sign extend for 64bit architectures to be sure this is |
184 // in the high address range | 135 // in the high address range |
185 #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xb
eefcafe) = 0; | 136 #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xb
eefcafe) = 0; |
186 #endif | 137 #endif |
187 #endif | 138 #endif |
188 | 139 |
189 /** | 140 /** |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 #endif | 225 #endif |
275 | 226 |
276 /** | 227 /** |
277 * GR_STROKE_PATH_RENDERING controls whether or not the GrStrokePathRenderer can
be selected | 228 * GR_STROKE_PATH_RENDERING controls whether or not the GrStrokePathRenderer can
be selected |
278 * as a path renderer. GrStrokePathRenderer is currently an experimental path re
nderer. | 229 * as a path renderer. GrStrokePathRenderer is currently an experimental path re
nderer. |
279 */ | 230 */ |
280 #if !defined(GR_STROKE_PATH_RENDERING) | 231 #if !defined(GR_STROKE_PATH_RENDERING) |
281 #define GR_STROKE_PATH_RENDERING 0 | 232 #define GR_STROKE_PATH_RENDERING 0 |
282 #endif | 233 #endif |
283 | 234 |
284 /////////////////////////////////////////////////////////////////////////////// | |
285 // tail section: | |
286 // | |
287 // Now we just assert if we are missing some required define, or if we detect | |
288 // and inconsistent combination of defines | |
289 // | |
290 | |
291 | |
292 /** | |
293 * Only one build target macro should be 1 and the rest should be 0. | |
294 */ | |
295 #define GR_BUILD_SUM (GR_WIN32_BUILD + GR_MAC_BUILD + GR_IOS_BUILD + GR_ANDRO
ID_BUILD + GR_LINUX_BUILD + GR_QNX_BUILD) | |
296 #if 0 == GR_BUILD_SUM | |
297 #error "Missing a GR_BUILD define" | |
298 #elif 1 != GR_BUILD_SUM | |
299 #error "More than one GR_BUILD defined" | |
300 #endif | 235 #endif |
301 | |
302 #if 0 | |
303 #if GR_WIN32_BUILD | |
304 // #pragma message GR_WARN("GR_WIN32_BUILD") | |
305 #endif | |
306 #if GR_MAC_BUILD | |
307 // #pragma message GR_WARN("GR_MAC_BUILD") | |
308 #endif | |
309 #if GR_IOS_BUILD | |
310 // #pragma message GR_WARN("GR_IOS_BUILD") | |
311 #endif | |
312 #if GR_ANDROID_BUILD | |
313 // #pragma message GR_WARN("GR_ANDROID_BUILD") | |
314 #endif | |
315 #if GR_LINUX_BUILD | |
316 // #pragma message GR_WARN("GR_LINUX_BUILD") | |
317 #endif | |
318 #if GR_QNX_BUILD | |
319 // #pragma message GR_WARN("GR_QNX_BUILD") | |
320 #endif | |
321 #endif | |
322 | |
323 #endif | |
OLD | NEW |