Home | History | Annotate | Download | only in gyp
      1 # Copyright 2015 Google Inc.
      2 #
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 # Gyp file for building opts target.
      6 {
      7   # Source lists live in opts.gypi.  This makes it easier to maintain our Chrome GYP/GN setup.
      8   # (To be honest, I'm not sure why we need to include common.gypi.  I thought it was automatic.)
      9   'variables': {
     10     'includes': [ 'common.gypi', 'opts.gypi' ],
     11   },
     12 
     13   # Generally we shove things into one 'opts' target conditioned on platform.
     14   # If a particular platform needs some files built with different flags,
     15   # those become separate targets: opts_ssse3, opts_sse41, opts_neon.
     16 
     17   'targets': [
     18     {
     19       'target_name': 'opts',
     20       'product_name': 'skia_opts',
     21       'type': 'static_library',
     22       'standalone_static_library': 1,
     23       'dependencies': [
     24         'core.gyp:*',
     25         'effects.gyp:*'
     26       ],
     27       'include_dirs': [
     28         '../include/private',
     29         '../src/core',
     30         '../src/opts',
     31         '../src/utils',
     32         '../include/utils',
     33       ],
     34       'conditions': [
     35         [ '"x86" in skia_arch_type and skia_os != "ios"', {
     36           'cflags': [ '-msse2' ],
     37           'dependencies': [ 'opts_ssse3', 'opts_sse41', 'opts_sse42', 'opts_avx', 'opts_avx2' ],
     38           'sources': [ '<@(sse2_sources)' ],
     39         }],
     40 
     41         [ 'skia_arch_type == "mips"', {
     42           'conditions': [
     43             [ '(mips_arch_variant == "mips32r2") and (mips_dsp == 1 or mips_dsp == 2)', {
     44                 'sources': [ '<@(mips_dsp_sources)' ],
     45             },{
     46                 'sources': [ '<@(none_sources)' ],
     47             }],
     48           ]
     49         }],
     50 
     51         [ '(skia_arch_type == "arm" and arm_version < 7) \
     52             or (skia_os == "ios") \
     53             or (skia_os == "android" \
     54                 and skia_arch_type not in ["x86", "x86_64", "arm", "mips", \
     55                                            "arm64"])', {
     56           'sources': [ '<@(none_sources)' ],
     57         }],
     58 
     59         [ 'skia_arch_type == "arm" and arm_version >= 7', {
     60           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
     61           # ARM), the compiler doesn't like that.
     62           'cflags!': [ '-fno-omit-frame-pointer', '-mapcs-frame', '-mapcs' ],
     63           'cflags':  [ '-fomit-frame-pointer' ],
     64           'variables': { 'arm_neon_optional%': '<(arm_neon_optional>' },
     65           'sources': [ '<@(armv7_sources)' ],
     66           'conditions': [
     67             [ 'arm_neon == 1 or arm_neon_optional == 1', {
     68               'dependencies': [ 'opts_neon' ]
     69             }],
     70           ],
     71         }],
     72 
     73         [ 'skia_arch_type == "arm64"', {
     74           'sources': [ '<@(arm64_sources)' ],
     75         }],
     76 
     77         [ 'skia_android_framework', {
     78           'cflags!': [
     79             '-msse2',
     80             '-mfpu=neon',
     81             '-fomit-frame-pointer',
     82           ]
     83         }],
     84       ],
     85     },
     86     {
     87       'target_name': 'opts_ssse3',
     88       'product_name': 'skia_opts_ssse3',
     89       'type': 'static_library',
     90       'standalone_static_library': 1,
     91       'dependencies': [ 'core.gyp:*' ],
     92       'include_dirs': [
     93           '../include/private',
     94           '../src/core',
     95           '../src/utils',
     96       ],
     97       'sources': [ '<@(ssse3_sources)' ],
     98       'conditions': [
     99         [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ] }],
    100         [ 'not skia_android_framework', { 'cflags': [ '-mssse3' ] }],
    101       ],
    102     },
    103     {
    104       'target_name': 'opts_sse41',
    105       'product_name': 'skia_opts_sse41',
    106       'type': 'static_library',
    107       'standalone_static_library': 1,
    108       'dependencies': [ 'core.gyp:*' ],
    109       'include_dirs': [
    110           '../include/private',
    111           '../src/core',
    112           '../src/utils',
    113       ],
    114       'sources': [ '<@(sse41_sources)' ],
    115       'xcode_settings': { 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES' },
    116       'conditions': [
    117         [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ] }],
    118         [ 'not skia_android_framework', { 'cflags': [ '-msse4.1' ] }],
    119       ],
    120     },
    121     {
    122       'target_name': 'opts_sse42',
    123       'product_name': 'skia_opts_sse42',
    124       'type': 'static_library',
    125       'standalone_static_library': 1,
    126       'dependencies': [ 'core.gyp:*' ],
    127       'include_dirs': [
    128           '../include/private',
    129           '../src/core',
    130           '../src/utils',
    131       ],
    132       'sources': [ '<@(sse42_sources)' ],
    133       'xcode_settings': { 'GCC_ENABLE_SSE42_EXTENSIONS': 'YES' },
    134       'conditions': [
    135         [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=42' ] }],
    136         [ 'not skia_android_framework', { 'cflags': [ '-msse4.2' ] }],
    137       ],
    138     },
    139     {
    140       'target_name': 'opts_avx',
    141       'product_name': 'skia_opts_avx',
    142       'type': 'static_library',
    143       'standalone_static_library': 1,
    144       'dependencies': [ 'core.gyp:*' ],
    145       'include_dirs': [
    146           '../include/private',
    147           '../src/core',
    148           '../src/utils',
    149       ],
    150       'sources': [ '<@(avx_sources)' ],
    151       'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '3' } },
    152       'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '-mavx' ] },
    153       'conditions': [
    154         [ 'not skia_android_framework', { 'cflags': [ '-mavx' ] }],
    155       ],
    156     },
    157     {
    158       'target_name': 'opts_avx2',
    159       'product_name': 'skia_opts_avx2',
    160       'type': 'static_library',
    161       'standalone_static_library': 1,
    162       'dependencies': [ 'core.gyp:*' ],
    163       'include_dirs': [
    164           '../include/private',
    165           '../src/core',
    166           '../src/utils',
    167       ],
    168       'sources': [ '<@(avx2_sources)' ],
    169       'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '5' } },
    170       'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '-mavx2' ] },
    171       'conditions': [
    172         [ 'not skia_android_framework', { 'cflags': [ '-mavx2' ] }],
    173       ],
    174     },
    175     {
    176       'target_name': 'opts_neon',
    177       'product_name': 'skia_opts_neon',
    178       'type': 'static_library',
    179       'standalone_static_library': 1,
    180       'dependencies': [
    181         'core.gyp:*',
    182         'effects.gyp:*'
    183       ],
    184       'include_dirs': [
    185         '../include/private',
    186         '../src/core',
    187         '../src/opts',
    188         '../src/utils',
    189       ],
    190       'sources': [ '<@(neon_sources)' ],
    191       'cflags!': [
    192         '-fno-omit-frame-pointer',
    193         '-mfpu=vfp',  # remove them all, just in case.
    194         '-mfpu=vfpv3',
    195         '-mfpu=vfpv3-d16',
    196       ],
    197       'conditions': [
    198         [ 'not skia_android_framework', {
    199           'cflags': [
    200             '-mfpu=neon',
    201             '-fomit-frame-pointer',
    202           ],
    203         }],
    204       ],
    205       'ldflags': [
    206         '-march=armv7-a',
    207         '-Wl,--fix-cortex-a8',
    208       ],
    209     },
    210   ],
    211 }
    212