180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2010 Google Inc.
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef GrConfig_DEFINED
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GrConfig_DEFINED
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkTypes.h"
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru///////////////////////////////////////////////////////////////////////////////
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// preconfig section:
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// All the work before including GrUserConfig.h should center around guessing
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// what platform we're on, and defining low-level symbols based on that.
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// A build environment may have already defined symbols, so we first check
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// for that
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// hack to ensure we know what sort of Apple platform we're on
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if defined(__APPLE_CPP__) || defined(__APPLE_CC__)
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #include <TargetConditionals.h>
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  Gr defines are set to 0 or 1, rather than being undefined or defined
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_ANDROID_BUILD)
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_ANDROID_BUILD    0
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_IOS_BUILD)
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_IOS_BUILD        0
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_LINUX_BUILD)
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_LINUX_BUILD      0
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_MAC_BUILD)
4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_MAC_BUILD        0
4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_WIN32_BUILD)
4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_WIN32_BUILD      0
4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_QNX_BUILD)
5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_QNX_BUILD        0
5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_CACHE_STATS)
5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_CACHE_STATS      0
5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  If no build target has been defined, attempt to infer.
5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !GR_ANDROID_BUILD && !GR_IOS_BUILD && !GR_LINUX_BUILD && !GR_MAC_BUILD && !GR_WIN32_BUILD && !GR_QNX_BUILD
6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #if defined(_WIN32)
6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #undef GR_WIN32_BUILD
6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_WIN32_BUILD      1
6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//      #error "WIN"
6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #undef GR_IOS_BUILD
6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_IOS_BUILD        1
6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//      #error "IOS"
6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #elif defined(SK_BUILD_FOR_ANDROID)
7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #undef GR_ANDROID_BUILD
7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_ANDROID_BUILD    1
7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//      #error "ANDROID"
7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #elif TARGET_OS_MAC
7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #undef GR_MAC_BUILD
7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_MAC_BUILD        1
7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//      #error "MAC"
7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #elif TARGET_OS_QNX || defined(__QNXNTO__)
7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #undef GR_QNX_BUILD
7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_QNX_BUILD        1
8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//      #error "QNX"
8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #else
8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #undef GR_LINUX_BUILD
8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_LINUX_BUILD      1
8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//      #error "LINUX"
8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #endif
8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// we need both GR_DEBUG and GR_RELEASE to be defined as 0 or 1
8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//
9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef GR_DEBUG
9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #ifdef GR_RELEASE
9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_DEBUG !GR_RELEASE
9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #else
9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #ifdef NDEBUG
9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            #define GR_DEBUG    0
9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #else
9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            #define GR_DEBUG    1
9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #endif
9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #endif
10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef GR_RELEASE
10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_RELEASE  !GR_DEBUG
10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_DEBUG == GR_RELEASE
10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #error "GR_DEBUG and GR_RELEASE must not be the same"
10880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
10980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
11080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru///////////////////////////////////////////////////////////////////////////////
11180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru///////////////////////////////////////////////////////////////////////////////
11280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
11380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_WIN32_BUILD
11480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// VC8 doesn't support stdint.h, so we define those types here.
11580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef signed char int8_t;
11680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef unsigned char uint8_t;
11780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef short int16_t;
11880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef unsigned short uint16_t;
11980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef int int32_t;
12080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef unsigned uint32_t;
12180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef __int64 int64_t;
12280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef unsigned __int64 uint64_t;
12380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else
12480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
12580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  Include stdint.h with defines that trigger declaration of C99 limit/const
12680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  macros here before anyone else has a chance to include stdint.h without
12780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  these.
12880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
129363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger#ifndef __STDC_LIMIT_MACROS
13080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define __STDC_LIMIT_MACROS
131363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger#endif
132363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger#ifndef __STDC_CONSTANT_MACROS
13380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define __STDC_CONSTANT_MACROS
134363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger#endif
13580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include <stdint.h>
13680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
13780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
13880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
13980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  The "user config" file can be empty, and everything should work. It is
14080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  meant to store a given platform/client's overrides of our guess-work.
14180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
14280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  A alternate user config file can be specified by defining
14380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h
14480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
14580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  e.g. it can specify GR_DEBUG/GR_RELEASE as it please, change the BUILD
146363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger *  target, or supply its own defines for anything else (e.g. GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
14780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
14880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_USER_CONFIG_FILE)
14980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #include "GrUserConfig.h"
15080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else
15180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #include GR_USER_CONFIG_FILE
15280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
15380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
15480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
15580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru///////////////////////////////////////////////////////////////////////////////
15680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru///////////////////////////////////////////////////////////////////////////////
15780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// postconfig section:
15880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//
15980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
16080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// GR_IMPLEMENTATION should be define to 1 when building Gr and 0 when including
16180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// it in another dependent build. The Gr makefile/ide-project should define this
16280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// to 1.
16380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_IMPLEMENTATION)
16480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_IMPLEMENTATION 0
16580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
16680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
16780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// If Gr is built as a shared library then GR_DLL should be defined to 1 (both
16880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// when building Gr and when including its headers in dependent builds). Only
16980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// currently supported minimally for Chrome's Win32 Multi-DLL build (TODO:
17080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// correctly exort all of the public API correctly and support shared lib on
17180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// other platforms).
17280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_DLL)
17380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_DLL 0
17480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
17580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
17680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_DLL
17780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #if GR_WIN32_BUILD
17880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #if GR_IMPLEMENTATION
17980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            #define GR_API __declspec(dllexport)
18080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #else
18180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            #define GR_API __declspec(dllimport)
18280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #endif
18380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #else
18480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_API __attribute__((visibility("default")))
18580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #endif
18680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else
18780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_API
18880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
18980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
19080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// By now we must have a GR_..._BUILD symbol set to 1, and a decision about
19180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// debug -vs- release
19280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//
19380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
19480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GrPrintf SkDebugf
19580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
19680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
19780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_STRING makes a string of X where X is expanded before conversion to a string
19880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  if X itself contains macros.
19980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
20080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GR_STRING(X) GR_STRING_IMPL(X)
20180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GR_STRING_IMPL(X) #X
20280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
20380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
20480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_CONCAT concatenates X and Y  where each is expanded before
20580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  contanenation if either contains macros.
20680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
20780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GR_CONCAT(X,Y) GR_CONCAT_IMPL(X,Y)
20880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GR_CONCAT_IMPL(X,Y) X##Y
20980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
21080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
21180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  Creates a string of the form "<filename>(<linenumber>) : "
21280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
21380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GR_FILE_AND_LINE_STR __FILE__ "(" GR_STRING(__LINE__) ") : "
21480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
21580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
21680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  Compilers have different ways of issuing warnings. This macro
21780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  attempts to abstract them, but may need to be specialized for your
21880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  particular compiler.
21980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  To insert compiler warnings use "#pragma message GR_WARN(<string>)"
22080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
22180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if defined(_MSC_VER) && _MSC_VER
22280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG)
22380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else//__GNUC__ - may need other defines for different compilers
22480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_WARN(MSG) ("WARNING: " MSG)
22580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
22680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
22780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
22880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_ALWAYSBREAK is an unconditional break in all builds.
22980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
23080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_ALWAYSBREAK)
23180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #if     GR_WIN32_BUILD
23280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); __debugbreak()
23380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #else
23480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        // TODO: do other platforms really not have continuable breakpoints?
23580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        // sign extend for 64bit architectures to be sure this is
23680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        // in the high address range
23780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xbeefcafe) = 0;
23880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #endif
23980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
24080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
24180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
24280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_DEBUGBREAK is an unconditional break in debug builds.
24380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
24480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_DEBUGBREAK)
24580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #if GR_DEBUG
24680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_DEBUGBREAK GR_ALWAYSBREAK
24780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #else
24880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_DEBUGBREAK
24980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #endif
25080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
25180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
25280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
25380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_ALWAYSASSERT is an assertion in all builds.
25480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
25580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_ALWAYSASSERT)
25680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_ALWAYSASSERT(COND)                                        \
25780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        do {                                                             \
25880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            if (!(COND)) {                                               \
25980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                GrPrintf("%s %s failed\n", GR_FILE_AND_LINE_STR, #COND); \
26080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                GR_ALWAYSBREAK;                                          \
26180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            }                                                            \
26280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        } while (false)
26380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
26480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
26580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
26680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_DEBUGASSERT is an assertion in debug builds only.
26780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
26880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_DEBUGASSERT)
26980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #if GR_DEBUG
27080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND)
27180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #else
27280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_DEBUGASSERT(COND)
27380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #endif
27480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
27580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
27680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
27780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  Prettier forms of the above macros.
27880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
27980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GrAssert(COND) GR_DEBUGASSERT(COND)
28080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND)
28180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
28280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
28380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Crash from unrecoverable condition, optionally with a message.
28480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
28580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruinline void GrCrash() { GrAlwaysAssert(false); }
28680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruinline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); }
28780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
28880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
28980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_DEBUGCODE compiles the code X in debug builds only
29080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
29180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_DEBUGCODE)
29280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #if GR_DEBUG
29380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_DEBUGCODE(X) X
29480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #else
29580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_DEBUGCODE(X)
29680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #endif
29780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
29880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
29980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
30080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_STATIC_ASSERT is a compile time assertion. Depending on the platform
30180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  it may print the message in the compiler log. Obviously, the condition must
30280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  be evaluatable at compile time.
30380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
30480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// VS 2010 and GCC compiled with c++0x or gnu++0x support the new
30580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// static_assert.
30680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_STATIC_ASSERT)
30780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #if (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)
30880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_STATIC_ASSERT(CONDITION) static_assert(CONDITION, "bug")
30980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #else
31080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        template <bool> class GR_STATIC_ASSERT_FAILURE;
31180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        template <> class GR_STATIC_ASSERT_FAILURE<true> {};
31280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        #define GR_STATIC_ASSERT(CONDITION) \
31380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            enum {GR_CONCAT(X,__LINE__) = \
31480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            sizeof(GR_STATIC_ASSERT_FAILURE<CONDITION>)}
31580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #endif
31680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
31780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
31880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_TEXT_SCALAR_TYPE_IS_USHORT)
31980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_TEXT_SCALAR_TYPE_IS_USHORT  0
32080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
32180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_TEXT_SCALAR_TYPE_IS_FLOAT)
32280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_TEXT_SCALAR_TYPE_IS_FLOAT   0
32380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
32480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_TEXT_SCALAR_TYPE_IS_FIXED)
32580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_TEXT_SCALAR_TYPE_IS_FIXED   0
32680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
32780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
32880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef GR_DUMP_TEXTURE_UPLOAD
32980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_DUMP_TEXTURE_UPLOAD  0
33080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
33180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
33280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
33380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_STATIC_RECT_VB controls whether rects are drawn by issuing a vertex
33480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  for each corner or using a static vb that is positioned by modifying the
33580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  view / texture matrix.
33680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
33780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_STATIC_RECT_VB)
33880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_STATIC_RECT_VB 0
33980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
34080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
34180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
34280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_DISABLE_DRAW_BUFFERING prevents GrContext from queueing draws in a
34380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GrInOrderDrawBuffer.
34480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
34580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_DISABLE_DRAW_BUFFERING)
34680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_DISABLE_DRAW_BUFFERING 0
34780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
34880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
34980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
35080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  GR_AGGRESSIVE_SHADER_OPTS controls how aggressively shaders are optimized
35180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  for special cases. On systems where program changes are expensive this
35280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  may not be advantageous. Consecutive draws may no longer use the same
35380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  program.
35480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
35580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_AGGRESSIVE_SHADER_OPTS)
35680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_AGGRESSIVE_SHADER_OPTS 1
35780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
35880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
35980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
36080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * GR_GEOM_BUFFER_LOCK_THRESHOLD gives a threshold (in bytes) for when Gr should
36180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * lock a GrGeometryBuffer to update its contents. It will use lock() if the
36280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * size of the updated region is greater than the threshold. Otherwise it will
36380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * use updateData().
36480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
36580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(GR_GEOM_BUFFER_LOCK_THRESHOLD)
36680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_GEOM_BUFFER_LOCK_THRESHOLD (1 << 15)
36780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
36880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
369363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger/**
370363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger * GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT gives a threshold (in megabytes) for the
371363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger * maximum size of the texture cache in vram. The value is only a default and
372363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger * can be overridden at runtime.
373363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger */
374363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger#if !defined(GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
375363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger    #define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
376363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger#endif
377363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger
378363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger/**
379363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger * GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE is for compatibility with the new version
380363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger * of the OpenGLES2.0 headers from Khronos.  glShaderSource now takes a const char * const *,
381363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger * instead of a const char **.
382363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger */
383363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger#if !defined(GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE)
384363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger    #define GR_USE_NEW_GL_SHADER_SOURCE_SIGNATURE 0
385363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger#endif
386363e546ed626b6dbbc42f5db87b3594bc0b5944bDerek Sollenberger
387d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger/**
388d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger * GR_STROKE_PATH_RENDERING controls whether or not the GrStrokePathRenderer can be selected
389d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger * as a path renderer. GrStrokePathRenderer is currently an experimental path renderer.
390d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger */
391d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger#if !defined(GR_STROKE_PATH_RENDERING)
392d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger    #define GR_STROKE_PATH_RENDERING                 0
393d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger#endif
394d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger
39580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru///////////////////////////////////////////////////////////////////////////////
39680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// tail section:
39780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//
39880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Now we just assert if we are missing some required define, or if we detect
39980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// and inconsistent combination of defines
40080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//
40180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
40280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
40380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/**
40480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *  Only one build target macro should be 1 and the rest should be 0.
40580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
40680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GR_BUILD_SUM    (GR_WIN32_BUILD + GR_MAC_BUILD + GR_IOS_BUILD + GR_ANDROID_BUILD + GR_LINUX_BUILD + GR_QNX_BUILD)
40780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if 0 == GR_BUILD_SUM
40880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #error "Missing a GR_BUILD define"
40980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#elif 1 != GR_BUILD_SUM
41080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #error "More than one GR_BUILD defined"
41180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
41280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
41380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
41480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !GR_TEXT_SCALAR_IS_FLOAT && \
41580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    !GR_TEXT_SCALAR_IS_FIXED && \
41680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    !GR_TEXT_SCALAR_IS_USHORT
41780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #undef  GR_TEXT_SCALAR_IS_FLOAT
41880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #define GR_TEXT_SCALAR_IS_FLOAT         1
41980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    #pragma message GR_WARN("Text scalar type not defined, defaulting to float")
42080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
42180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
42280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if 0
42380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_WIN32_BUILD
42480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//    #pragma message GR_WARN("GR_WIN32_BUILD")
42580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
42680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_MAC_BUILD
42780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//    #pragma message GR_WARN("GR_MAC_BUILD")
42880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
42980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_IOS_BUILD
43080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//    #pragma message GR_WARN("GR_IOS_BUILD")
43180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
43280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_ANDROID_BUILD
43380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//    #pragma message GR_WARN("GR_ANDROID_BUILD")
43480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
43580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_LINUX_BUILD
43680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//    #pragma message GR_WARN("GR_LINUX_BUILD")
43780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
43880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if GR_QNX_BUILD
43980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//    #pragma message GR_WARN("GR_QNX_BUILD")
44080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
44180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
44280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
44380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
444