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 
      6 # This gypi file contains the Skia library.
      7 # In component mode (shared_lib) it is folded into a single shared library with
      8 # the Chrome-specific enhancements but in all other cases it is a separate lib.
      9 {
     10   'dependencies': [
     11     'skia_library_opts.gyp:skia_opts',
     12     '../third_party/zlib/zlib.gyp:zlib',
     13   ],
     14 
     15   'variables': {
     16     'variables': {
     17       'conditions': [
     18         ['OS== "ios"', {
     19           'skia_support_gpu': 0,
     20         }, {
     21           'skia_support_gpu': 1,
     22         }],
     23         ['OS=="ios" or enable_printing == 0', {
     24           'skia_support_pdf': 0,
     25         }, {
     26           'skia_support_pdf': 1,
     27         }],
     28       ],
     29     },
     30     'skia_support_gpu': '<(skia_support_gpu)',
     31     'skia_support_pdf': '<(skia_support_pdf)',
     32 
     33     # These two set the paths so we can include skia/gyp/core.gypi
     34     'skia_src_path': '../third_party/skia/src',
     35     'skia_include_path': '../third_party/skia/include',
     36 
     37     # This list will contain all defines that also need to be exported to
     38     # dependent components.
     39     'skia_export_defines': [
     40       'SK_ENABLE_INST_COUNT=0',
     41       'SK_SUPPORT_GPU=<(skia_support_gpu)',
     42       'GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"',
     43       'SK_ENABLE_LEGACY_API_ALIASING=1',
     44       'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
     45       'SK_SUPPORT_LEGACY_COLORTYPE=1',
     46       'GR_GL_IGNORE_ES3_MSAA=0',
     47       'SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR=1'
     48     ],
     49 
     50     'default_font_cache_limit%': '(20*1024*1024)',
     51 
     52     'conditions': [
     53       ['OS== "android"', {
     54         # Android devices are typically more memory constrained, so
     55         # default to a smaller glyph cache (it may be overriden at runtime
     56         # when the renderer starts up, depending on the actual device memory).
     57         'default_font_cache_limit': '(1*1024*1024)',
     58         'skia_export_defines': [
     59           'SK_BUILD_FOR_ANDROID',
     60         ],
     61       }],
     62     ],
     63   },
     64 
     65   'includes': [
     66     '../third_party/skia/gyp/core.gypi',
     67     '../third_party/skia/gyp/effects.gypi',
     68     '../third_party/skia/gyp/pdf.gypi',
     69   ],
     70 
     71   'sources': [
     72     # this should likely be moved into src/utils in skia
     73     '../third_party/skia/src/core/SkFlate.cpp',
     74     '../third_party/skia/src/core/SkPaintOptionsAndroid.cpp',
     75 
     76     '../third_party/skia/src/ports/SkImageDecoder_empty.cpp',
     77     '../third_party/skia/src/images/SkScaledBitmapSampler.cpp',
     78     '../third_party/skia/src/images/SkScaledBitmapSampler.h',
     79 
     80     '../third_party/skia/src/opts/opts_check_SSE2.cpp',
     81 
     82     '../third_party/skia/src/ports/SkPurgeableMemoryBlock_none.cpp',
     83 
     84     '../third_party/skia/src/ports/SkFontConfigInterface_android.cpp',
     85     '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp',
     86 
     87     '../third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp',
     88     '../third_party/skia/src/ports/SkFontHost_fontconfig.cpp',
     89 
     90     '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
     91     '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
     92     '../third_party/skia/src/ports/SkFontHost_FreeType_common.h',
     93     '../third_party/skia/src/ports/SkFontConfigParser_android.cpp',
     94     '../third_party/skia/src/ports/SkFontHost_mac.cpp',
     95     '../third_party/skia/src/ports/SkFontHost_win.cpp',
     96     '../third_party/skia/src/ports/SkFontHost_win_dw.cpp',
     97     '../third_party/skia/src/ports/SkFontMgr_default_gdi.cpp',
     98     '../third_party/skia/src/ports/SkGlobalInitialization_chromium.cpp',
     99     '../third_party/skia/src/ports/SkOSFile_posix.cpp',
    100     '../third_party/skia/src/ports/SkOSFile_stdio.cpp',
    101     '../third_party/skia/src/ports/SkOSFile_win.cpp',
    102     '../third_party/skia/src/ports/SkThread_pthread.cpp',
    103     '../third_party/skia/src/ports/SkThread_win.cpp',
    104     '../third_party/skia/src/ports/SkTime_Unix.cpp',
    105     '../third_party/skia/src/ports/SkTLS_pthread.cpp',
    106     '../third_party/skia/src/ports/SkTLS_win.cpp',
    107 
    108     '../third_party/skia/src/sfnt/SkOTTable_name.cpp',
    109     '../third_party/skia/src/sfnt/SkOTTable_name.h',
    110     '../third_party/skia/src/sfnt/SkOTUtils.cpp',
    111     '../third_party/skia/src/sfnt/SkOTUtils.h',
    112 
    113     '../third_party/skia/include/utils/mac/SkCGUtils.h',
    114     '../third_party/skia/include/utils/SkDeferredCanvas.h',
    115     '../third_party/skia/include/utils/SkMatrix44.h',
    116     '../third_party/skia/src/utils/debugger/SkDebugCanvas.cpp',
    117     '../third_party/skia/src/utils/debugger/SkDebugCanvas.h',
    118     '../third_party/skia/src/utils/debugger/SkDrawCommand.cpp',
    119     '../third_party/skia/src/utils/debugger/SkDrawCommand.h',
    120     '../third_party/skia/src/utils/debugger/SkObjectParser.cpp',
    121     '../third_party/skia/src/utils/debugger/SkObjectParser.h',
    122     '../third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp',
    123     '../third_party/skia/src/utils/SkBase64.cpp',
    124     '../third_party/skia/src/utils/SkBase64.h',
    125     '../third_party/skia/src/utils/SkBitSet.cpp',
    126     '../third_party/skia/src/utils/SkBitSet.h',
    127     '../third_party/skia/src/utils/SkCanvasStack.cpp',
    128     '../third_party/skia/src/utils/SkCanvasStateUtils.cpp',
    129     '../third_party/skia/src/utils/SkDeferredCanvas.cpp',
    130     '../third_party/skia/src/utils/SkMatrix44.cpp',
    131     '../third_party/skia/src/utils/SkNullCanvas.cpp',
    132     '../third_party/skia/include/utils/SkNWayCanvas.h',
    133     '../third_party/skia/src/utils/SkNWayCanvas.cpp',
    134     '../third_party/skia/src/utils/SkPictureUtils.cpp',
    135     '../third_party/skia/src/utils/SkProxyCanvas.cpp',
    136     '../third_party/skia/src/utils/SkRTConf.cpp',
    137     '../third_party/skia/include/utils/SkRTConf.h',
    138     '../third_party/skia/src/utils/win/SkDWriteFontFileStream.cpp',
    139     '../third_party/skia/src/utils/win/SkDWriteFontFileStream.h',
    140     '../third_party/skia/src/utils/win/SkDWriteGeometrySink.cpp',
    141     '../third_party/skia/src/utils/win/SkDWriteGeometrySink.h',
    142     '../third_party/skia/src/utils/win/SkHRESULT.cpp',
    143 
    144     '../third_party/skia/include/ports/SkTypeface_win.h',
    145 
    146     '../third_party/skia/include/images/SkImageRef.h',
    147     '../third_party/skia/include/images/SkImageRef_GlobalPool.h',
    148     '../third_party/skia/include/images/SkMovie.h',
    149     '../third_party/skia/include/images/SkPageFlipper.h',
    150 
    151     '../third_party/skia/include/utils/SkNullCanvas.h',
    152     '../third_party/skia/include/utils/SkPictureUtils.h',
    153     '../third_party/skia/include/utils/SkProxyCanvas.h',
    154   ],
    155   'include_dirs': [
    156     '../third_party/skia/include/core',
    157     '../third_party/skia/include/effects',
    158     '../third_party/skia/include/images',
    159     '../third_party/skia/include/lazy',
    160     '../third_party/skia/include/pathops',
    161     '../third_party/skia/include/pdf',
    162     '../third_party/skia/include/pipe',
    163     '../third_party/skia/include/ports',
    164     '../third_party/skia/include/utils',
    165     '../third_party/skia/src/core',
    166     '../third_party/skia/src/opts',
    167     '../third_party/skia/src/image',
    168     '../third_party/skia/src/ports',
    169     '../third_party/skia/src/sfnt',
    170     '../third_party/skia/src/utils',
    171     '../third_party/skia/src/lazy',
    172   ],
    173   'conditions': [
    174     ['skia_support_gpu != 0', {
    175       'includes': [
    176         '../third_party/skia/gyp/gpu.gypi',
    177       ],
    178       'sources': [
    179         '<@(skgpu_sources)',
    180       ],
    181       'include_dirs': [
    182         '../third_party/skia/include/gpu',
    183         '../third_party/skia/src/gpu',
    184       ],
    185     }],
    186     ['skia_support_pdf == 0', {
    187       'sources/': [
    188         ['exclude', '../third_party/skia/src/pdf/']
    189       ],
    190     }],
    191     ['skia_support_pdf == 1', {
    192       'dependencies': [
    193         '../third_party/sfntly/sfntly.gyp:sfntly',
    194       ],
    195     }],
    196 
    197     #Settings for text blitting, chosen to approximate the system browser.
    198     [ 'OS == "linux"', {
    199       'defines': [
    200         'SK_GAMMA_EXPONENT=1.2',
    201         'SK_GAMMA_CONTRAST=0.2',
    202       ],
    203     }],
    204     ['OS == "android"', {
    205       'defines': [
    206         'SK_GAMMA_APPLY_TO_A8',
    207         'SK_GAMMA_EXPONENT=1.4',
    208         'SK_GAMMA_CONTRAST=0.0',
    209       ],
    210     }],
    211     ['OS == "win"', {
    212       'defines': [
    213         'SK_GAMMA_SRGB',
    214         'SK_GAMMA_CONTRAST=0.5',
    215       ],
    216     }],
    217     ['OS == "mac"', {
    218       'defines': [
    219         'SK_GAMMA_SRGB',
    220         'SK_GAMMA_CONTRAST=0.0',
    221       ],
    222     }],
    223 
    224     # For POSIX platforms, prefer the Mutex implementation provided by Skia
    225     # since it does not generate static initializers.
    226     [ 'os_posix == 1', {
    227       'defines+': [
    228         'SK_USE_POSIX_THREADS',
    229       ],
    230       'direct_dependent_settings': {
    231         'defines': [
    232           'SK_USE_POSIX_THREADS',
    233         ],
    234       },
    235     }],
    236 
    237     [ 'OS != "ios"', {
    238       'dependencies': [
    239         '../third_party/WebKit/public/blink_skia_config.gyp:blink_skia_config',
    240       ],
    241       'export_dependent_settings': [
    242         '../third_party/WebKit/public/blink_skia_config.gyp:blink_skia_config',
    243       ],
    244     }],
    245     [ 'OS != "mac"', {
    246       'sources/': [
    247         ['exclude', '/mac/']
    248       ],
    249     }],
    250     [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 1', {
    251       'defines': [
    252         '__ARM_HAVE_NEON',
    253       ],
    254     }],
    255     [ 'target_arch == "arm" and arm_version >= 7 and arm_neon_optional == 1', {
    256       'defines': [
    257         '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
    258       ],
    259     }],
    260     [ 'OS == "android" and target_arch == "arm"', {
    261       'sources': [
    262         '../third_party/skia/src/core/SkUtilsArm.cpp',
    263       ],
    264       'includes': [
    265         '../build/android/cpufeatures.gypi',
    266       ],
    267     }],
    268     [ 'target_arch == "arm" or target_arch == "mipsel"', {
    269       'sources!': [
    270         '../third_party/skia/src/opts/opts_check_SSE2.cpp'
    271       ],
    272     }],
    273     [ 'desktop_linux == 1 or chromeos == 1', {
    274       'dependencies': [
    275         '../build/linux/system.gyp:fontconfig',
    276         '../build/linux/system.gyp:freetype2',
    277         '../third_party/icu/icu.gyp:icuuc',
    278       ],
    279       'cflags': [
    280         '-Wno-unused',
    281         '-Wno-unused-function',
    282       ],
    283     }],
    284     [ 'use_cairo == 1', {
    285       'dependencies': [
    286         '../build/linux/system.gyp:pangocairo',
    287       ],
    288     }],
    289     [ 'OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', {
    290       'sources!': [
    291         '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp',
    292         '../third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp',
    293       ],
    294     }],
    295     [ 'OS=="win" or OS=="mac" or OS=="ios"', {
    296       'sources!': [
    297         '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
    298         '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
    299         '../third_party/skia/src/ports/SkFontHost_fontconfig.cpp',
    300 
    301       ],
    302     }],
    303     [ 'OS == "android"', {
    304       'dependencies': [
    305         '../third_party/expat/expat.gyp:expat',
    306         '../third_party/freetype/freetype.gyp:ft2',
    307       ],
    308       # This exports a hard dependency because it needs to run its
    309       # symlink action in order to expose the skia header files.
    310       'hard_dependency': 1,
    311       'include_dirs': [
    312         '../third_party/expat/files/lib',
    313       ],
    314     }],
    315     [ 'OS == "ios"', {
    316       'defines': [
    317         'SK_BUILD_FOR_IOS',
    318       ],
    319       'include_dirs': [
    320         '../third_party/skia/include/utils/ios',
    321         '../third_party/skia/include/utils/mac',
    322       ],
    323       'link_settings': {
    324         'libraries': [
    325           '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework',
    326         ],
    327       },
    328       'sources': [
    329         # This file is used on both iOS and Mac, so it should be removed
    330         #  from the ios and mac conditions and moved into the main sources
    331         #  list.
    332         '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
    333       ],
    334       'sources/': [
    335         ['exclude', 'opts_check_SSE2\\.cpp$'],
    336       ],
    337 
    338       # The main skia_opts target does not currently work on iOS because the
    339       # target architecture on iOS is determined at compile time rather than
    340       # gyp time (simulator builds are x86, device builds are arm).  As a
    341       # temporary measure, this is a separate opts target for iOS-only, using
    342       # the _none.cpp files to avoid architecture-dependent implementations.
    343       'dependencies': [
    344         'skia_library_opts.gyp:skia_opts_none',
    345       ],
    346       'dependencies!': [
    347         'skia_library_opts.gyp:skia_opts',
    348       ],
    349     }],
    350     [ 'OS == "mac"', {
    351       'defines': [
    352         'SK_BUILD_FOR_MAC',
    353       ],
    354       'direct_dependent_settings': {
    355         'include_dirs': [
    356           '../third_party/skia/include/utils/mac',
    357         ],
    358       },
    359       'include_dirs': [
    360         '../third_party/skia/include/utils/mac',
    361       ],
    362       'link_settings': {
    363         'libraries': [
    364           '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
    365         ],
    366       },
    367       'sources': [
    368         '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
    369       ],
    370     }],
    371     [ 'OS == "win"', {
    372       'sources!': [
    373         '../third_party/skia/src/ports/SkOSFile_posix.cpp',
    374         '../third_party/skia/src/ports/SkThread_pthread.cpp',
    375         '../third_party/skia/src/ports/SkTime_Unix.cpp',
    376         '../third_party/skia/src/ports/SkTLS_pthread.cpp',
    377       ],
    378       'include_dirs': [
    379         '../third_party/skia/include/utils/win',
    380         '../third_party/skia/src/utils/win',
    381       ],
    382     },{ # not 'OS == "win"'
    383       'sources!': [
    384         '../third_party/skia/src/ports/SkFontHost_win_dw.cpp',
    385         '../third_party/skia/src/ports/SkFontMgr_default_gdi.cpp',
    386 
    387         '../third_party/skia/src/utils/win/SkDWriteFontFileStream.cpp',
    388         '../third_party/skia/src/utils/win/SkDWriteFontFileStream.h',
    389         '../third_party/skia/src/utils/win/SkDWriteGeometrySink.cpp',
    390         '../third_party/skia/src/utils/win/SkDWriteGeometrySink.h',
    391         '../third_party/skia/src/utils/win/SkHRESULT.cpp',
    392       ],
    393     }],
    394     # TODO(scottmg): http://crbug.com/177306
    395     ['clang==1', {
    396       'xcode_settings': {
    397         'WARNING_CFLAGS!': [
    398           # Don't warn about string->bool used in asserts.
    399           '-Wstring-conversion',
    400         ],
    401       },
    402       'cflags!': [
    403         '-Wstring-conversion',
    404       ],
    405     }],
    406     # On windows, GDI handles are a scarse system-wide resource so we have to keep
    407     # the glyph cache, which holds up to 4 GDI handles per entry, to a fairly small
    408     # size.
    409     # http://crbug.com/314387
    410     [ 'OS == "win"', {
    411       'defines': [
    412         'SK_DEFAULT_FONT_CACHE_COUNT_LIMIT=256',
    413       ],
    414     }],
    415   ],
    416   'target_conditions': [
    417     # Pull in specific Mac files for iOS (which have been filtered out
    418     # by file name rules).
    419     [ 'OS == "ios"', {
    420       'sources/': [
    421         ['include', 'SkFontHost_mac\\.cpp$',],
    422         ['include', 'SkStream_mac\\.cpp$',],
    423         ['include', 'SkCreateCGImageRef\\.cpp$',],
    424       ],
    425     }],
    426   ],
    427 
    428   'defines': [
    429     '<@(skia_export_defines)',
    430 
    431     # skia uses static initializers to initialize the serialization logic
    432     # of its "pictures" library. This is currently not used in chrome; if
    433     # it ever gets used the processes that use it need to call
    434     # SkGraphics::Init().
    435     'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0',
    436 
    437     # Forcing the unoptimized path for the offset image filter in skia until
    438     # all filters used in Blink support the optimized path properly
    439     'SK_DISABLE_OFFSETIMAGEFILTER_OPTIMIZATION',
    440 
    441     # Disable this check because it is too strict for some Chromium-specific
    442     # subclasses of SkPixelRef. See bug: crbug.com/171776.
    443     'SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK',
    444 
    445     'IGNORE_ROT_AA_RECT_OPT',
    446 
    447     'SK_IGNORE_BLURRED_RRECT_OPT',
    448 
    449     'SK_IGNORE_QUAD_RR_CORNERS_OPT',
    450 
    451     # this flag forces Skia not to use typographic metrics with GDI.
    452     'SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS',
    453 
    454     'SK_DEFAULT_FONT_CACHE_LIMIT=<(default_font_cache_limit)',
    455   ],
    456 
    457   'direct_dependent_settings': {
    458     'include_dirs': [
    459       #temporary until we can hide SkFontHost
    460       '../third_party/skia/src/core',
    461 
    462       '../third_party/skia/include/core',
    463       '../third_party/skia/include/effects',
    464       '../third_party/skia/include/pdf',
    465       '../third_party/skia/include/gpu',
    466       '../third_party/skia/include/lazy',
    467       '../third_party/skia/include/pathops',
    468       '../third_party/skia/include/pipe',
    469       '../third_party/skia/include/ports',
    470       '../third_party/skia/include/utils',
    471     ],
    472     'defines': [
    473       '<@(skia_export_defines)',
    474     ],
    475   },
    476 }
    477