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       'dependencies': [
     27         'core.gyp:*',
     28       ],
     29       'include_dirs': [
     30         '../src/core',
     31         '../src/opts',
     32       ],
     33       'conditions': [
     34         [ 'skia_arch_type == "x86" and skia_os != "ios"', {
     35           'conditions': [
     36             [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]', {
     37               'cflags': [
     38                 '-msse2',
     39               ],
     40             }],
     41           ],
     42           'include_dirs': [
     43             '../include/utils',
     44           ],
     45           'dependencies': [
     46             'opts_ssse3',
     47           ],
     48           'sources': [
     49             '../src/opts/opts_check_SSE2.cpp',
     50             '../src/opts/SkBitmapProcState_opts_SSE2.cpp',
     51             '../src/opts/SkBitmapFilter_opts_SSE2.cpp',
     52             '../src/opts/SkBlitRow_opts_SSE2.cpp',
     53             '../src/opts/SkBlitRect_opts_SSE2.cpp',
     54             '../src/opts/SkUtils_opts_SSE2.cpp',
     55           ],
     56         }],
     57         [ 'skia_arch_type == "arm" and arm_version >= 7', {
     58           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
     59           # ARM), the compiler doesn't like that.
     60           'cflags!': [
     61             '-fno-omit-frame-pointer',
     62             '-mapcs-frame',
     63             '-mapcs',
     64           ],
     65           'cflags': [
     66             '-fomit-frame-pointer',
     67             '-mno-apcs-frame',
     68           ],
     69           'variables': {
     70             'arm_neon_optional%': '<(arm_neon_optional>',
     71           },
     72           'sources': [
     73             '../src/opts/opts_check_arm.cpp',
     74             '../src/opts/memset.arm.S',
     75             '../src/opts/SkBitmapProcState_opts_arm.cpp',
     76             '../src/opts/SkBlitRow_opts_arm.cpp',
     77             '../src/opts/SkBlitRow_opts_arm.h',
     78           ],
     79           'conditions': [
     80             [ 'arm_neon == 1 or arm_neon_optional == 1', {
     81               'dependencies': [
     82                 'opts_neon',
     83               ]
     84             }],
     85             [ 'skia_os == "ios"', {
     86               'sources!': [
     87                 # these fail to compile under xcode for ios
     88                 '../src/opts/memset.arm.S',
     89                 '../src/opts/SkBitmapProcState_opts_arm.cpp',
     90                 '../src/opts/SkBlitRow_opts_arm.cpp',
     91               ],
     92             }],
     93           ],
     94         }],
     95         [ '(skia_arch_type == "arm" and arm_version < 7) or (skia_os == "ios")', {
     96           'sources': [
     97             '../src/opts/SkBitmapProcState_opts_none.cpp',
     98             '../src/opts/SkBlitRow_opts_none.cpp',
     99             '../src/opts/SkUtils_opts_none.cpp',
    100           ],
    101         }],
    102       ],
    103     },
    104     # For the same lame reasons as what is done for skia_opts, we have to
    105     # create another target specifically for SSSE3 code as we would not want
    106     # to compile the SSE2 code with -mssse3 which would potentially allow
    107     # gcc to generate SSSE3 code.
    108     {
    109       'target_name': 'opts_ssse3',
    110       'product_name': 'skia_opts_ssse3',
    111       'type': 'static_library',
    112       'standalone_static_library': 1,
    113       'dependencies': [
    114         'core.gyp:*',
    115       ],
    116       'include_dirs': [
    117         '../src/core',
    118       ],
    119       'conditions': [
    120         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]', {
    121           'cflags': [
    122             '-mssse3',
    123           ],
    124         }],
    125         # (Mac has -mssse3 globally.)
    126         [ 'skia_arch_type == "x86"', {
    127           'sources': [
    128             '../src/opts/SkBitmapProcState_opts_SSSE3.cpp',
    129           ],
    130         }],
    131       ],
    132     },
    133     # NEON code must be compiled with -mfpu=neon which also affects scalar
    134     # code. To support dynamic NEON code paths, we need to build all
    135     # NEON-specific sources in a separate static library. The situation
    136     # is very similar to the SSSE3 one.
    137     {
    138       'target_name': 'opts_neon',
    139       'product_name': 'skia_opts_neon',
    140       'type': 'static_library',
    141       'standalone_static_library': 1,
    142       'dependencies': [
    143         'core.gyp:*',
    144       ],
    145       'include_dirs': [
    146         '../src/core',
    147         '../src/opts',
    148       ],
    149       'cflags!': [
    150         '-fno-omit-frame-pointer',
    151         '-mfpu=vfp',  # remove them all, just in case.
    152         '-mfpu=vfpv3',
    153         '-mfpu=vfpv3-d16',
    154       ],
    155       'cflags': [
    156         '-mfpu=neon',
    157         '-fomit-frame-pointer',
    158       ],
    159       'ldflags': [
    160         '-march=armv7-a',
    161         '-Wl,--fix-cortex-a8',
    162       ],
    163       'sources': [
    164         '../src/opts/memset16_neon.S',
    165         '../src/opts/memset32_neon.S',
    166         '../src/opts/SkBitmapProcState_arm_neon.cpp',
    167         '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
    168         '../src/opts/SkBitmapProcState_matrix_clamp_neon.h',
    169         '../src/opts/SkBitmapProcState_matrix_repeat_neon.h',
    170         '../src/opts/SkBlitRow_opts_arm_neon.cpp',
    171       ],
    172     },
    173   ],
    174 }
    175 
    176 # Local Variables:
    177 # tab-width:2
    178 # indent-tabs-mode:nil
    179 # End:
    180 # vim: set expandtab tabstop=2 shiftwidth=2:
    181