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     ],
     44 
     45     'default_font_cache_limit': '(20*1024*1024)',
     46 
     47     'conditions': [
     48       ['OS== "android"', {
     49         # Android devices are typically more memory constrained, so
     50         # use a smaller glyph cache.
     51         'default_font_cache_limit': '(8*1024*1024)',
     52         'skia_export_defines': [
     53           'SK_BUILD_FOR_ANDROID',
     54           'USE_CHROMIUM_SKIA',
     55         ],
     56       }],
     57     ],
     58   },
     59 
     60   'includes': [
     61     '../third_party/skia/gyp/core.gypi',
     62     '../third_party/skia/gyp/effects.gypi',
     63   ],
     64 
     65   'sources': [
     66     # this should likely be moved into src/utils in skia
     67     '../third_party/skia/src/core/SkFlate.cpp',
     68     # We don't want to add this to Skia's core.gypi since it is
     69     # Android only. Include it here and remove it for everyone
     70     # but Android later.
     71     '../third_party/skia/src/core/SkPaintOptionsAndroid.cpp',
     72 
     73     '../third_party/skia/src/ports/SkImageDecoder_empty.cpp',
     74     '../third_party/skia/src/images/SkScaledBitmapSampler.cpp',
     75     '../third_party/skia/src/images/SkScaledBitmapSampler.h',
     76 
     77     '../third_party/skia/src/opts/opts_check_SSE2.cpp',
     78 
     79     '../third_party/skia/src/pdf/SkPDFCatalog.cpp',
     80     '../third_party/skia/src/pdf/SkPDFCatalog.h',
     81     '../third_party/skia/src/pdf/SkPDFDevice.cpp',
     82     '../third_party/skia/src/pdf/SkPDFDocument.cpp',
     83     '../third_party/skia/src/pdf/SkPDFFont.cpp',
     84     '../third_party/skia/src/pdf/SkPDFFont.h',
     85     '../third_party/skia/src/pdf/SkPDFFormXObject.cpp',
     86     '../third_party/skia/src/pdf/SkPDFFormXObject.h',
     87     '../third_party/skia/src/pdf/SkPDFGraphicState.cpp',
     88     '../third_party/skia/src/pdf/SkPDFGraphicState.h',
     89     '../third_party/skia/src/pdf/SkPDFImage.cpp',
     90     '../third_party/skia/src/pdf/SkPDFImage.h',
     91     '../third_party/skia/src/pdf/SkPDFImageStream.cpp',
     92     '../third_party/skia/src/pdf/SkPDFImageStream.h',
     93     '../third_party/skia/src/pdf/SkPDFPage.cpp',
     94     '../third_party/skia/src/pdf/SkPDFPage.h',
     95     '../third_party/skia/src/pdf/SkPDFResourceDict.cpp',
     96     '../third_party/skia/src/pdf/SkPDFResourceDict.h',
     97     '../third_party/skia/src/pdf/SkPDFShader.cpp',
     98     '../third_party/skia/src/pdf/SkPDFShader.h',
     99     '../third_party/skia/src/pdf/SkPDFStream.cpp',
    100     '../third_party/skia/src/pdf/SkPDFStream.h',
    101     '../third_party/skia/src/pdf/SkPDFTypes.cpp',
    102     '../third_party/skia/src/pdf/SkPDFTypes.h',
    103     '../third_party/skia/src/pdf/SkPDFUtils.cpp',
    104     '../third_party/skia/src/pdf/SkPDFUtils.h',
    105 
    106     '../third_party/skia/src/ports/SkPurgeableMemoryBlock_none.cpp',
    107 
    108     '../third_party/skia/src/ports/SkFontConfigInterface_android.cpp',
    109     '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp',
    110 
    111     '../third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp',
    112     '../third_party/skia/src/ports/SkFontHost_fontconfig.cpp',
    113 
    114     '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
    115     '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
    116     '../third_party/skia/src/ports/SkFontHost_FreeType_common.h',
    117     '../third_party/skia/src/ports/SkFontConfigParser_android.cpp',
    118     '../third_party/skia/src/ports/SkFontHost_mac.cpp',
    119     '../third_party/skia/src/ports/SkFontHost_win.cpp',
    120     '../third_party/skia/src/ports/SkGlobalInitialization_chromium.cpp',
    121     '../third_party/skia/src/ports/SkOSFile_posix.cpp',
    122     '../third_party/skia/src/ports/SkOSFile_stdio.cpp',
    123     '../third_party/skia/src/ports/SkOSFile_win.cpp',
    124     '../third_party/skia/src/ports/SkThread_pthread.cpp',
    125     '../third_party/skia/src/ports/SkThread_win.cpp',
    126     '../third_party/skia/src/ports/SkTime_Unix.cpp',
    127     '../third_party/skia/src/ports/SkTLS_pthread.cpp',
    128     '../third_party/skia/src/ports/SkTLS_win.cpp',
    129 
    130     '../third_party/skia/src/sfnt/SkOTTable_name.cpp',
    131     '../third_party/skia/src/sfnt/SkOTTable_name.h',
    132     '../third_party/skia/src/sfnt/SkOTUtils.cpp',
    133     '../third_party/skia/src/sfnt/SkOTUtils.h',
    134 
    135     '../third_party/skia/include/utils/mac/SkCGUtils.h',
    136     '../third_party/skia/include/utils/SkDeferredCanvas.h',
    137     '../third_party/skia/include/utils/SkMatrix44.h',
    138     '../third_party/skia/src/utils/debugger/SkDebugCanvas.cpp',
    139     '../third_party/skia/src/utils/debugger/SkDebugCanvas.h',
    140     '../third_party/skia/src/utils/debugger/SkDrawCommand.cpp',
    141     '../third_party/skia/src/utils/debugger/SkDrawCommand.h',
    142     '../third_party/skia/src/utils/debugger/SkObjectParser.cpp',
    143     '../third_party/skia/src/utils/debugger/SkObjectParser.h',
    144     '../third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp',
    145     '../third_party/skia/src/utils/SkBase64.cpp',
    146     '../third_party/skia/src/utils/SkBase64.h',
    147     '../third_party/skia/src/utils/SkBitSet.cpp',
    148     '../third_party/skia/src/utils/SkBitSet.h',
    149     '../third_party/skia/src/utils/SkCanvasStack.cpp',
    150     '../third_party/skia/src/utils/SkCanvasStateUtils.cpp',
    151     '../third_party/skia/src/utils/SkDeferredCanvas.cpp',
    152     '../third_party/skia/src/utils/SkMatrix44.cpp',
    153     '../third_party/skia/src/utils/SkNullCanvas.cpp',
    154     '../third_party/skia/include/utils/SkNWayCanvas.h',
    155     '../third_party/skia/src/utils/SkNWayCanvas.cpp',
    156     '../third_party/skia/src/utils/SkPictureUtils.cpp',
    157     '../third_party/skia/src/utils/SkProxyCanvas.cpp',
    158     '../third_party/skia/src/utils/SkRTConf.cpp',
    159     '../third_party/skia/include/utils/SkRTConf.h',
    160     '../third_party/skia/include/pdf/SkPDFDevice.h',
    161     '../third_party/skia/include/pdf/SkPDFDocument.h',
    162 
    163     '../third_party/skia/include/ports/SkTypeface_win.h',
    164 
    165     '../third_party/skia/include/images/SkImageRef.h',
    166     '../third_party/skia/include/images/SkImageRef_GlobalPool.h',
    167     '../third_party/skia/include/images/SkMovie.h',
    168     '../third_party/skia/include/images/SkPageFlipper.h',
    169 
    170     '../third_party/skia/include/utils/SkNullCanvas.h',
    171     '../third_party/skia/include/utils/SkPictureUtils.h',
    172     '../third_party/skia/include/utils/SkProxyCanvas.h',
    173   ],
    174   'include_dirs': [
    175     '..',
    176     'config',
    177     '../third_party/skia/include/config',
    178     '../third_party/skia/include/core',
    179     '../third_party/skia/include/effects',
    180     '../third_party/skia/include/images',
    181     '../third_party/skia/include/lazy',
    182     '../third_party/skia/include/pathops',
    183     '../third_party/skia/include/pdf',
    184     '../third_party/skia/include/pipe',
    185     '../third_party/skia/include/ports',
    186     '../third_party/skia/include/utils',
    187     '../third_party/skia/src/core',
    188     '../third_party/skia/src/image',
    189     '../third_party/skia/src/ports',
    190     '../third_party/skia/src/sfnt',
    191     '../third_party/skia/src/utils',
    192     '../third_party/skia/src/lazy',
    193   ],
    194   'conditions': [
    195     ['skia_support_gpu != 0', {
    196       'includes': [
    197         '../third_party/skia/gyp/gpu.gypi',
    198       ],
    199       'sources': [
    200         '<@(skgpu_sources)',
    201       ],
    202       'include_dirs': [
    203         '../third_party/skia/include/gpu',
    204         '../third_party/skia/src/gpu',
    205       ],
    206     }],
    207     ['skia_support_pdf == 0', {
    208       'sources/': [
    209         ['exclude', '../third_party/skia/src/pdf/']
    210       ],
    211     }],
    212     ['skia_support_pdf == 1', {
    213       'dependencies': [
    214         '../third_party/sfntly/sfntly.gyp:sfntly',
    215       ],
    216     }],
    217 
    218     #Settings for text blitting, chosen to approximate the system browser.
    219     [ 'OS == "linux"', {
    220       'defines': [
    221         'SK_GAMMA_EXPONENT=1.2',
    222         'SK_GAMMA_CONTRAST=0.2',
    223       ],
    224     }],
    225     ['OS == "android"', {
    226       'defines': [
    227         'SK_GAMMA_APPLY_TO_A8',
    228         'SK_GAMMA_EXPONENT=1.4',
    229         'SK_GAMMA_CONTRAST=0.0',
    230       ],
    231     }],
    232     ['OS == "win"', {
    233       'defines': [
    234         'SK_GAMMA_SRGB',
    235         'SK_GAMMA_CONTRAST=0.5',
    236       ],
    237     }],
    238     ['OS == "mac"', {
    239       'defines': [
    240         'SK_GAMMA_SRGB',
    241         'SK_GAMMA_CONTRAST=0.0',
    242       ],
    243     }],
    244 
    245     # For POSIX platforms, prefer the Mutex implementation provided by Skia
    246     # since it does not generate static initializers.
    247     [ 'OS == "android" or OS == "linux" or OS == "mac" or OS == "ios"', {
    248       'defines+': [
    249         'SK_USE_POSIX_THREADS',
    250       ],
    251       'direct_dependent_settings': {
    252         'defines': [
    253           'SK_USE_POSIX_THREADS',
    254         ],
    255       },
    256     }],
    257 
    258     [ 'OS != "android"', {
    259       'sources!': [
    260         '../third_party/skia/src/core/SkPaintOptionsAndroid.cpp',
    261       ],
    262     }],
    263     [ 'OS != "ios"', {
    264       'dependencies': [
    265         '../third_party/WebKit/public/blink_skia_config.gyp:blink_skia_config',
    266       ],
    267       'export_dependent_settings': [
    268         '../third_party/WebKit/public/blink_skia_config.gyp:blink_skia_config',
    269       ],
    270     }],
    271     [ 'OS != "mac"', {
    272       'sources/': [
    273         ['exclude', '/mac/']
    274       ],
    275     }],
    276     [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 1', {
    277       'defines': [
    278         '__ARM_HAVE_NEON',
    279       ],
    280     }],
    281     [ 'target_arch == "arm" and arm_version >= 7 and arm_neon_optional == 1', {
    282       'defines': [
    283         '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
    284       ],
    285     }],
    286     [ 'OS == "android" and target_arch == "arm"', {
    287       'sources': [
    288         '../third_party/skia/src/core/SkUtilsArm.cpp',
    289       ],
    290       'includes': [
    291         '../build/android/cpufeatures.gypi',
    292       ],
    293     }],
    294     [ 'target_arch == "arm" or target_arch == "mipsel"', {
    295       'sources!': [
    296         '../third_party/skia/src/opts/opts_check_SSE2.cpp'
    297       ],
    298     }],
    299     [ 'use_glib == 1', {
    300       'dependencies': [
    301         '../build/linux/system.gyp:fontconfig',
    302         '../build/linux/system.gyp:freetype2',
    303         '../build/linux/system.gyp:pangocairo',
    304         '../third_party/icu/icu.gyp:icuuc',
    305       ],
    306       'cflags': [
    307         '-Wno-unused',
    308         '-Wno-unused-function',
    309       ],
    310     }],
    311     [ 'use_glib == 0', {
    312       'sources!': [
    313         '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp',
    314         '../third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp',
    315       ],
    316     }],
    317     [ 'use_glib == 0 and OS != "android"', {
    318       'sources!': [
    319         '../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
    320         '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp',
    321         '../third_party/skia/src/ports/SkFontHost_fontconfig.cpp',
    322 
    323       ],
    324     }],
    325     [ 'OS == "android"', {
    326       'dependencies': [
    327         '../third_party/expat/expat.gyp:expat',
    328         '../third_party/freetype/freetype.gyp:ft2',
    329       ],
    330       # This exports a hard dependency because it needs to run its
    331       # symlink action in order to expose the skia header files.
    332       'hard_dependency': 1,
    333       'include_dirs': [
    334         '../third_party/expat/files/lib',
    335       ],
    336     }],
    337     [ 'OS == "ios"', {
    338       'defines': [
    339         'SK_BUILD_FOR_IOS',
    340         'SK_USE_MAC_CORE_TEXT',
    341       ],
    342       'include_dirs': [
    343         '../third_party/skia/include/utils/ios',
    344         '../third_party/skia/include/utils/mac',
    345       ],
    346       'link_settings': {
    347         'libraries': [
    348           '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework',
    349         ],
    350       },
    351       'sources': [
    352         # This file is used on both iOS and Mac, so it should be removed
    353         #  from the ios and mac conditions and moved into the main sources
    354         #  list.
    355         '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
    356       ],
    357       'sources/': [
    358         ['exclude', 'opts_check_SSE2\\.cpp$'],
    359       ],
    360 
    361       # The main skia_opts target does not currently work on iOS because the
    362       # target architecture on iOS is determined at compile time rather than
    363       # gyp time (simulator builds are x86, device builds are arm).  As a
    364       # temporary measure, this is a separate opts target for iOS-only, using
    365       # the _none.cpp files to avoid architecture-dependent implementations.
    366       'dependencies': [
    367         'skia_library_opts.gyp:skia_opts_none',
    368       ],
    369       'dependencies!': [
    370         'skia_library_opts.gyp:skia_opts',
    371       ],
    372     }],
    373     [ 'OS == "mac"', {
    374       'defines': [
    375         'SK_BUILD_FOR_MAC',
    376         'SK_USE_MAC_CORE_TEXT',
    377       ],
    378       'direct_dependent_settings': {
    379         'include_dirs': [
    380           '../third_party/skia/include/utils/mac',
    381         ],
    382       },
    383       'include_dirs': [
    384         '../third_party/skia/include/utils/mac',
    385       ],
    386       'link_settings': {
    387         'libraries': [
    388           '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
    389         ],
    390       },
    391       'sources': [
    392         '../third_party/skia/src/utils/mac/SkStream_mac.cpp',
    393       ],
    394     }],
    395     [ 'OS == "win"', {
    396       'sources!': [
    397         '../third_party/skia/src/ports/SkOSFile_posix.cpp',
    398         '../third_party/skia/src/ports/SkThread_pthread.cpp',
    399         '../third_party/skia/src/ports/SkTime_Unix.cpp',
    400         '../third_party/skia/src/ports/SkTLS_pthread.cpp',
    401       ],
    402     }],
    403     # TODO(scottmg): http://crbug.com/177306
    404     ['clang==1', {
    405       'xcode_settings': {
    406         'WARNING_CFLAGS!': [
    407           # Don't warn about string->bool used in asserts.
    408           '-Wstring-conversion',
    409         ],
    410       },
    411       'cflags!': [
    412         '-Wstring-conversion',
    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     # this flag can be removed entirely once this has baked for a while
    432     'SK_ALLOW_OVER_32K_BITMAPS',
    433 
    434     # skia uses static initializers to initialize the serialization logic
    435     # of its "pictures" library. This is currently not used in chrome; if
    436     # it ever gets used the processes that use it need to call
    437     # SkGraphics::Init().
    438     'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0',
    439 
    440     # Disable this check because it is too strict for some Chromium-specific
    441     # subclasses of SkPixelRef. See bug: crbug.com/171776.
    442     'SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK',
    443 
    444     'IGNORE_ROT_AA_RECT_OPT',
    445 
    446     'SKIA_IGNORE_GPU_MIPMAPS',
    447 
    448     'SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS',
    449 
    450     'SK_DEFAULT_FONT_CACHE_LIMIT=<(default_font_cache_limit)',
    451   ],
    452 
    453   'direct_dependent_settings': {
    454     'include_dirs': [
    455       #temporary until we can hide SkFontHost
    456       '../third_party/skia/src/core',
    457 
    458       'config',
    459       '../third_party/skia/include/config',
    460       '../third_party/skia/include/core',
    461       '../third_party/skia/include/effects',
    462       '../third_party/skia/include/pdf',
    463       '../third_party/skia/include/gpu',
    464       '../third_party/skia/include/lazy',
    465       '../third_party/skia/include/pathops',
    466       '../third_party/skia/include/pipe',
    467       '../third_party/skia/include/ports',
    468       '../third_party/skia/include/utils',
    469     ],
    470     'defines': [
    471       '<@(skia_export_defines)',
    472     ],
    473   },
    474 }
    475