Home | History | Annotate | Download | only in skia
      1 # Copyright 2013 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 # This gypi file handles the removal of platform-specific files from the
      6 # Skia build.
      7 {
      8   'includes': [
      9     # skia_for_chromium_defines.gypi defines skia_for_chromium_defines
     10     '../third_party/skia/gyp/skia_for_chromium_defines.gypi',
     11   ],
     12 
     13   'include_dirs': [
     14     '..',
     15     'config',
     16   ],
     17 
     18   'conditions': [
     19     [ 'OS != "android"', {
     20       'sources/': [
     21          ['exclude', '_android\\.(cc|cpp)$'],
     22       ],
     23     }],
     24     [ 'OS == "android"', {
     25       'defines': [
     26         'SK_FONTHOST_DOES_NOT_USE_FONTMGR',
     27       ],
     28     }],
     29     [ 'OS != "ios"', {
     30       'sources/': [
     31          ['exclude', '_ios\\.(cc|cpp|mm?)$'],
     32       ],
     33     }],
     34     [ 'OS == "ios"', {
     35       'defines': [
     36         'SK_BUILD_FOR_IOS',
     37       ],
     38     }],
     39     [ 'OS != "mac"', {
     40       'sources/': [
     41         ['exclude', '_mac\\.(cc|cpp|mm?)$'],
     42       ],
     43     }],
     44     [ 'OS == "mac"', {
     45       'defines': [
     46         'SK_BUILD_FOR_MAC',
     47       ],
     48     }],
     49     [ 'OS != "win"', {
     50       'sources/': [ ['exclude', '_win\\.(cc|cpp)$'] ],
     51     }],
     52     [ 'OS == "win"', {
     53       'defines': [
     54         # On windows, GDI handles are a scarse system-wide resource so we have to keep
     55         # the glyph cache, which holds up to 4 GDI handles per entry, to a fairly small
     56         # size.
     57         # http://crbug.com/314387
     58         'SK_DEFAULT_FONT_CACHE_COUNT_LIMIT=256',
     59       ],
     60     }],
     61     [ 'desktop_linux == 0 and chromeos == 0', {
     62       'sources/': [ ['exclude', '_linux\\.(cc|cpp)$'] ],
     63     }],
     64     [ 'use_cairo == 0', {
     65       'sources/': [ ['exclude', '_cairo\\.(cc|cpp)$'] ],
     66     }],
     67 
     68     #Settings for text blitting, chosen to approximate the system browser.
     69     [ 'OS == "linux"', {
     70       'defines': [
     71         'SK_GAMMA_EXPONENT=1.2',
     72         'SK_GAMMA_CONTRAST=0.2',
     73         'SK_HIGH_QUALITY_IS_LANCZOS',
     74       ],
     75     }],
     76     ['OS == "android"', {
     77       'defines': [
     78         'SK_GAMMA_APPLY_TO_A8',
     79         'SK_GAMMA_EXPONENT=1.4',
     80         'SK_GAMMA_CONTRAST=0.0',
     81       ],
     82       'android_enable_fdo': 1,
     83     }],
     84     ['OS == "win"', {
     85       'defines': [
     86         'SK_GAMMA_SRGB',
     87         'SK_GAMMA_CONTRAST=0.5',
     88         'SK_HIGH_QUALITY_IS_LANCZOS',
     89       ],
     90     }],
     91     ['OS == "mac"', {
     92       'defines': [
     93         'SK_GAMMA_SRGB',
     94         'SK_GAMMA_CONTRAST=0.0',
     95         'SK_HIGH_QUALITY_IS_LANCZOS',
     96       ],
     97     }],
     98 
     99     # For POSIX platforms, prefer the Mutex implementation provided by Skia
    100     # since it does not generate static initializers.
    101     [ 'os_posix == 1', {
    102       'defines+': [
    103         'SK_USE_POSIX_THREADS',
    104       ],
    105       'direct_dependent_settings': {
    106         'defines': [
    107           'SK_USE_POSIX_THREADS',
    108         ],
    109       },
    110     }],
    111 
    112     # Neon support.
    113     [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 1', {
    114       'defines': [
    115         '__ARM_HAVE_NEON',
    116       ],
    117     }],
    118     [ 'target_arch == "arm" and arm_version >= 7 and arm_neon_optional == 1', {
    119       'defines': [
    120         '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
    121       ],
    122     }],
    123   ],
    124 
    125   'variables': {
    126     'variables': {
    127       'conditions': [
    128         ['OS== "ios"', {
    129           'skia_support_gpu': 0,
    130         }, {
    131           'skia_support_gpu': 1,
    132         }],
    133         ['OS=="ios" or enable_printing == 0', {
    134           'skia_support_pdf': 0,
    135         }, {
    136           'skia_support_pdf': 1,
    137         }],
    138       ],
    139     },
    140     'skia_support_gpu': '<(skia_support_gpu)',
    141     'skia_support_pdf': '<(skia_support_pdf)',
    142 
    143     # These two set the paths so we can include skia/gyp/core.gypi
    144     'skia_src_path': '../third_party/skia/src',
    145     'skia_include_path': '../third_party/skia/include',
    146 
    147     # This list will contain all defines that also need to be exported to
    148     # dependent components.
    149     'skia_export_defines': [
    150       'SK_ENABLE_INST_COUNT=0',
    151       'SK_SUPPORT_GPU=<(skia_support_gpu)',
    152       'GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"',
    153       'SK_ENABLE_LEGACY_API_ALIASING=1',
    154       'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
    155       'GR_GL_IGNORE_ES3_MSAA=0',
    156       'SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT',
    157 
    158       # This variable contains additional defines, specified in skia's
    159       # skia_for_chromium_defines.gypi file.
    160       '<@(skia_for_chromium_defines)',
    161       'SK_SUPPORT_LEGACY_GETTOTALCLIP',
    162     ],
    163 
    164     'default_font_cache_limit%': '(20*1024*1024)',
    165 
    166     'conditions': [
    167       ['OS== "android"', {
    168         # Android devices are typically more memory constrained, so
    169         # default to a smaller glyph cache (it may be overriden at runtime
    170         # when the renderer starts up, depending on the actual device memory).
    171         'default_font_cache_limit': '(1*1024*1024)',
    172         'skia_export_defines': [
    173           'SK_BUILD_FOR_ANDROID',
    174         ],
    175       }],
    176     ],
    177   },
    178 
    179   'defines': [
    180     '<@(skia_export_defines)',
    181 
    182     # skia uses static initializers to initialize the serialization logic
    183     # of its "pictures" library. This is currently not used in chrome; if
    184     # it ever gets used the processes that use it need to call
    185     # SkGraphics::Init().
    186     'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0',
    187 
    188     # Forcing the unoptimized path for the offset image filter in skia until
    189     # all filters used in Blink support the optimized path properly
    190     'SK_DISABLE_OFFSETIMAGEFILTER_OPTIMIZATION',
    191 
    192     # Disable this check because it is too strict for some Chromium-specific
    193     # subclasses of SkPixelRef. See bug: crbug.com/171776.
    194     'SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK',
    195 
    196     'IGNORE_ROT_AA_RECT_OPT',
    197 
    198     'SK_IGNORE_BLURRED_RRECT_OPT',
    199 
    200     'SK_IGNORE_QUAD_RR_CORNERS_OPT',
    201 
    202     # this flag forces Skia not to use typographic metrics with GDI.
    203     'SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS',
    204 
    205     'SK_DEFAULT_FONT_CACHE_LIMIT=<(default_font_cache_limit)',
    206 
    207     'SK_USE_DISCARDABLE_SCALEDIMAGECACHE',
    208   ],
    209 
    210   'direct_dependent_settings': {
    211     'defines': [
    212       '<@(skia_export_defines)',
    213     ],
    214   },
    215 
    216   # We would prefer this to be direct_dependent_settings,
    217   # however we currently have no means to enforce that direct dependents
    218   # re-export if they include Skia headers in their public headers.
    219   'all_dependent_settings': {
    220     'include_dirs': [
    221       '..',
    222       'config',
    223     ],
    224   },
    225 
    226   'msvs_disabled_warnings': [4244, 4267, 4341, 4345, 4390, 4554, 4748, 4800],
    227 }
    228