SkPreConfig.h revision 58629291bc145edca8fb303e465c8537bed65314
1
2/*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10#ifndef SkPreConfig_DEFINED
11#define SkPreConfig_DEFINED
12
13#ifdef WEBKIT_VERSION_MIN_REQUIRED
14    #include "config.h"
15#endif
16
17//////////////////////////////////////////////////////////////////////
18
19#if !defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_ANDROID_NDK) && !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_PALM) && !defined(SK_BUILD_FOR_WINCE) && !defined(SK_BUILD_FOR_WIN32) && !defined(SK_BUILD_FOR_SYMBIAN) && !defined(SK_BUILD_FOR_UNIX) && !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_SDL) && !defined(SK_BUILD_FOR_BREW)
20
21    #ifdef __APPLE__
22        #include "TargetConditionals.h"
23    #endif
24
25    #if defined(PALMOS_SDK_VERSION)
26        #define SK_BUILD_FOR_PALM
27    #elif defined(UNDER_CE)
28        #define SK_BUILD_FOR_WINCE
29    #elif defined(WIN32)
30        #define SK_BUILD_FOR_WIN32
31    #elif defined(__SYMBIAN32__)
32        #define SK_BUILD_FOR_WIN32
33    #elif defined(linux) || defined(__OpenBSD_)
34        #define SK_BUILD_FOR_UNIX
35    #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
36        #define SK_BUILD_FOR_IOS
37    #elif defined(ANDROID_NDK)
38        #define SK_BUILD_FOR_ANDROID_NDK
39    #elif defined(ANDROID)
40        #define SK_BUILD_FOR_ANDROID
41    #else
42        #define SK_BUILD_FOR_MAC
43    #endif
44
45#endif
46
47/* Even if the user only defined the NDK variant we still need to build
48 * the default Android code. Therefore, when attempting to include/exclude
49 * something from the NDK variant check first that we are building for
50 * Android then check the status of the NDK define.
51 */
52#if defined(SK_BUILD_FOR_ANDROID_NDK) && !defined(SK_BUILD_FOR_ANDROID)
53    #define SK_BUILD_FOR_ANDROID
54#endif
55
56//////////////////////////////////////////////////////////////////////
57
58#if !defined(SK_DEBUG) && !defined(SK_RELEASE)
59    #ifdef NDEBUG
60        #define SK_RELEASE
61    #else
62        #define SK_DEBUG
63    #endif
64#endif
65
66#ifdef SK_BUILD_FOR_WIN32
67    #if !defined(SK_RESTRICT)
68        #define SK_RESTRICT __restrict
69    #endif
70    #include "sk_stdint.h"
71#endif
72
73//////////////////////////////////////////////////////////////////////
74
75#if !defined(SK_RESTRICT)
76    #define SK_RESTRICT __restrict__
77#endif
78
79//////////////////////////////////////////////////////////////////////
80
81#if !defined(SK_SCALAR_IS_FLOAT) && !defined(SK_SCALAR_IS_FIXED)
82    #define SK_SCALAR_IS_FLOAT
83    #define SK_CAN_USE_FLOAT
84#endif
85
86//////////////////////////////////////////////////////////////////////
87
88#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
89    #if defined (__ppc__) || defined(__ppc64__)
90        #define SK_CPU_BENDIAN
91    #else
92        #define SK_CPU_LENDIAN
93    #endif
94#endif
95
96//////////////////////////////////////////////////////////////////////
97
98#if (defined(__arm__) && !defined(__thumb__)) || defined(SK_BUILD_FOR_WINCE) || (defined(SK_BUILD_FOR_SYMBIAN) && !defined(__MARM_THUMB__))
99    /* e.g. the ARM instructions have conditional execution, making tiny branches cheap */
100    #define SK_CPU_HAS_CONDITIONAL_INSTR
101#endif
102
103//////////////////////////////////////////////////////////////////////
104
105#if !defined(SKIA_IMPLEMENTATION)
106    #define SKIA_IMPLEMENTATION 0
107#endif
108
109#if defined(SKIA_DLL)
110    #if defined(WIN32)
111        #if SKIA_IMPLEMENTATION
112            #define SK_API __declspec(dllexport)
113        #else
114            #define SK_API __declspec(dllimport)
115        #endif
116    #else
117        #define SK_API __attribute__((visibility("default")))
118    #endif
119#else
120    #define SK_API
121#endif
122
123#endif
124
125