Home | History | Annotate | Download | only in gyp
      1 {
      2   'targets': [
      3     # Due to an unfortunate intersection of lameness between gcc and gyp,
      4     # we have to build the *_SSE2.cpp files in a separate target.  The
      5     # gcc lameness is that, in order to compile SSE2 intrinsics code, it
      6     # must be passed the -msse2 flag.  However, with this flag, it may
      7     # emit SSE2 instructions even for scalar code, such as the CPUID
      8     # test used to test for the presence of SSE2.  So that, and all other
      9     # code must be compiled *without* -msse2.  The gyp lameness is that it
     10     # does not allow file-specific CFLAGS, so we must create this extra
     11     # target for those files to be compiled with -msse2.
     12     #
     13     # This is actually only a problem on 32-bit Linux (all Intel Macs have
     14     # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
     15     # SSE2 from instrinsics, while generating plain ol' 386 for everything
     16     # else).  However, to keep the .gyp file simple and avoid platform-specific
     17     # build breakage, we do this on all platforms.
     18 
     19     # For about the same reason, we need to compile the ARM opts files
     20     # separately as well.
     21     {
     22       'target_name': 'opts',
     23       'product_name': 'skia_opts',
     24       'type': 'static_library',
     25       'standalone_static_library': 1,
     26       'include_dirs': [
     27         '../include/config',
     28         '../include/core',
     29         '../src/core',
     30         '../src/opts',
     31       ],
     32       'conditions': [
     33         [ 'skia_arch_type == "x86" and skia_os != "ios"', {
     34           'conditions': [
     35             [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', {
     36               'cflags': [
     37                 '-msse2',
     38               ],
     39             }],
     40             [ 'skia_os != "android"', {
     41               'dependencies': [
     42                 'opts_ssse3',
     43               ],
     44             }],
     45           ],
     46           'sources': [
     47             '../src/opts/opts_check_SSE2.cpp',
     48             '../src/opts/SkBitmapProcState_opts_SSE2.cpp',
     49             '../src/opts/SkBlitRow_opts_SSE2.cpp',
     50             '../src/opts/SkBlitRect_opts_SSE2.cpp',
     51             '../src/opts/SkUtils_opts_SSE2.cpp',
     52           ],
     53         }],
     54         [ 'skia_arch_type == "arm" and armv7 == 1', {
     55           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
     56           # ARM), the compiler doesn't like that.
     57           'cflags!': [
     58             '-fno-omit-frame-pointer',
     59             '-mapcs-frame',
     60             '-mapcs',
     61           ],
     62           'cflags': [
     63             '-fomit-frame-pointer',
     64             '-mno-apcs-frame',
     65           ],
     66           'variables': {
     67             'arm_neon_optional%': '<(arm_neon_optional>',
     68           },
     69           'sources': [
     70             '../src/opts/opts_check_arm.cpp',
     71             '../src/opts/memset.arm.S',
     72             '../src/opts/SkBitmapProcState_opts_arm.cpp',
     73             '../src/opts/SkBlitRow_opts_arm.cpp',
     74             '../src/opts/SkBlitRow_opts_arm.h',
     75           ],
     76           'conditions': [
     77             [ 'arm_neon == 1 or arm_neon_optional == 1', {
     78               'dependencies': [
     79                 'opts_neon',
     80               ]
     81             }],
     82             [ 'skia_os == "ios"', {
     83               'sources!': [
     84                 # these fail to compile under xcode for ios
     85                 '../src/opts/memset.arm.S',
     86                 '../src/opts/SkBitmapProcState_opts_arm.cpp',
     87                 '../src/opts/SkBlitRow_opts_arm.cpp',
     88               ],
     89             }],
     90           ],
     91         }],
     92         [ '(skia_arch_type == "arm" and armv7 == 0) or (skia_os == "ios")', {
     93           'sources': [
     94             '../src/opts/SkBitmapProcState_opts_none.cpp',
     95             '../src/opts/SkBlitRow_opts_none.cpp',
     96             '../src/opts/SkUtils_opts_none.cpp',
     97           ],
     98         }],
     99       ],
    100     },
    101     # For the same lame reasons as what is done for skia_opts, we have to
    102     # create another target specifically for SSSE3 code as we would not want
    103     # to compile the SSE2 code with -mssse3 which would potentially allow
    104     # gcc to generate SSSE3 code.
    105     {
    106       'target_name': 'opts_ssse3',
    107       'product_name': 'skia_opts_ssse3',
    108       'type': 'static_library',
    109       'standalone_static_library': 1,
    110       'include_dirs': [
    111         '../include/config',
    112         '../include/core',
    113         '../src/core',
    114       ],
    115       'conditions': [
    116         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', {
    117           'cflags': [
    118             '-mssse3',
    119           ],
    120         }],
    121         # TODO(epoger): the following will enable SSSE3 on Macs, but it will
    122         # break once we set OTHER_CFLAGS anywhere else (the first setting will
    123         # be replaced, not added to)
    124         [ 'skia_os in ["mac"]', {
    125           'xcode_settings': {
    126             'OTHER_CFLAGS': ['-mssse3',],
    127           },
    128         }],
    129         [ 'skia_arch_type == "x86"', {
    130           'sources': [
    131             '../src/opts/SkBitmapProcState_opts_SSSE3.cpp',
    132           ],
    133         }],
    134       ],
    135     },
    136     # NEON code must be compiled with -mfpu=neon which also affects scalar
    137     # code. To support dynamic NEON code paths, we need to build all
    138     # NEON-specific sources in a separate static library. The situation
    139     # is very similar to the SSSE3 one.
    140     {
    141       'target_name': 'opts_neon',
    142       'product_name': 'skia_opts_neon',
    143       'type': 'static_library',
    144       'standalone_static_library': 1,
    145       'include_dirs': [
    146         '../include/config',
    147         '../include/core',
    148         '../src/core',
    149         '../src/opts',
    150       ],
    151       'cflags!': [
    152         '-fno-omit-frame-pointer',
    153         '-mfpu=vfp',  # remove them all, just in case.
    154         '-mfpu=vfpv3',
    155         '-mfpu=vfpv3-d16',
    156       ],
    157       'cflags': [
    158         '-mfpu=neon',
    159         '-fomit-frame-pointer',
    160       ],
    161       'ldflags': [
    162         '-march=armv7-a',
    163         '-Wl,--fix-cortex-a8',
    164       ],
    165       'sources': [
    166         '../src/opts/memset16_neon.S',
    167         '../src/opts/memset32_neon.S',
    168         '../src/opts/SkBitmapProcState_arm_neon.cpp',
    169         '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
    170         '../src/opts/SkBitmapProcState_matrix_clamp_neon.h',
    171         '../src/opts/SkBitmapProcState_matrix_repeat_neon.h',
    172         '../src/opts/SkBlitRow_opts_arm_neon.cpp',
    173       ],
    174     },
    175   ],
    176 }
    177 
    178 # Local Variables:
    179 # tab-width:2
    180 # indent-tabs-mode:nil
    181 # End:
    182 # vim: set expandtab tabstop=2 shiftwidth=2:
    183