SkPreConfig.h revision 363a4c22af71b8afedc00050ee5cc97fe4bd6f76
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    #define SK_CAN_USE_FLOAT
92#endif
93
94//////////////////////////////////////////////////////////////////////
95
96#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN)
97    #if defined (__ppc__) || defined(__ppc64__)
98        #define SK_CPU_BENDIAN
99    #else
100        #define SK_CPU_LENDIAN
101    #endif
102#endif
103
104//////////////////////////////////////////////////////////////////////
105
106#if (defined(__arm__) && !defined(__thumb__)) || defined(SK_BUILD_FOR_WINCE) || (defined(SK_BUILD_FOR_SYMBIAN) && !defined(__MARM_THUMB__))
107    /* e.g. the ARM instructions have conditional execution, making tiny branches cheap */
108    #define SK_CPU_HAS_CONDITIONAL_INSTR
109#endif
110
111//////////////////////////////////////////////////////////////////////
112
113#if !defined(SKIA_IMPLEMENTATION)
114    #define SKIA_IMPLEMENTATION 0
115#endif
116
117#if defined(SKIA_DLL)
118    #if defined(WIN32)
119        #if SKIA_IMPLEMENTATION
120            #define SK_API __declspec(dllexport)
121        #else
122            #define SK_API __declspec(dllimport)
123        #endif
124    #else
125        #define SK_API __attribute__((visibility("default")))
126    #endif
127#else
128    #define SK_API
129#endif
130
131#endif
132
133