SkPreConfig.h revision 7886ad3de1aa523d5c71f1fa9f355dfcb2412d1d
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(ANDROID_NDK)
34        #define SK_BUILD_FOR_ANDROID_NDK
35    #elif defined(ANDROID)
36        #define SK_BUILD_FOR_ANDROID
37    #elif defined(linux) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
38          defined(__sun) || defined(__NetBSD__) || defined(__DragonFly__)
39        #define SK_BUILD_FOR_UNIX
40    #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
41        #define SK_BUILD_FOR_IOS
42    #else
43        #define SK_BUILD_FOR_MAC
44    #endif
45
46#endif
47
48/* Even if the user only defined the NDK variant we still need to build
49 * the default Android code. Therefore, when attempting to include/exclude
50 * something from the NDK variant check first that we are building for
51 * Android then check the status of the NDK define.
52 */
53#if defined(SK_BUILD_FOR_ANDROID_NDK) && !defined(SK_BUILD_FOR_ANDROID)
54    #define SK_BUILD_FOR_ANDROID
55#endif
56
57//////////////////////////////////////////////////////////////////////
58
59#if !defined(SK_DEBUG) && !defined(SK_RELEASE)
60    #ifdef NDEBUG
61        #define SK_RELEASE
62    #else
63        #define SK_DEBUG
64    #endif
65#endif
66
67#ifdef SK_BUILD_FOR_WIN32
68    #if !defined(SK_RESTRICT)
69        #define SK_RESTRICT __restrict
70    #endif
71    #if !defined(SK_WARN_UNUSED_RESULT)
72        #define SK_WARN_UNUSED_RESULT
73    #endif
74    #include "sk_stdint.h"
75#endif
76
77//////////////////////////////////////////////////////////////////////
78
79#if !defined(SK_RESTRICT)
80    #define SK_RESTRICT __restrict__
81#endif
82
83#if !defined(SK_WARN_UNUSED_RESULT)
84    #define SK_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
85#endif
86
87//////////////////////////////////////////////////////////////////////
88
89#if !defined(SK_SCALAR_IS_FLOAT) && !defined(SK_SCALAR_IS_FIXED)
90    #define SK_SCALAR_IS_FLOAT
91#endif
92
93//////////////////////////////////////////////////////////////////////
94
95#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
96    #if defined (__ppc__) || defined(__ppc64__)
97        #define SK_CPU_BENDIAN
98    #else
99        #define SK_CPU_LENDIAN
100    #endif
101#endif
102
103//////////////////////////////////////////////////////////////////////
104
105#if (defined(__arm__) && !defined(__thumb__)) || defined(SK_BUILD_FOR_WINCE) || (defined(SK_BUILD_FOR_SYMBIAN) && !defined(__MARM_THUMB__))
106    /* e.g. the ARM instructions have conditional execution, making tiny branches cheap */
107    #define SK_CPU_HAS_CONDITIONAL_INSTR
108#endif
109
110//////////////////////////////////////////////////////////////////////
111
112#if !defined(SKIA_IMPLEMENTATION)
113    #define SKIA_IMPLEMENTATION 0
114#endif
115
116#if defined(SKIA_DLL)
117    #if defined(WIN32)
118        #if SKIA_IMPLEMENTATION
119            #define SK_API __declspec(dllexport)
120        #else
121            #define SK_API __declspec(dllimport)
122        #endif
123    #else
124        #define SK_API __attribute__((visibility("default")))
125    #endif
126#else
127    #define SK_API
128#endif
129
130#endif
131
132