1# Gyp file for opts projects 2{ 3 'targets': [ 4 # Due to an unfortunate intersection of lameness between gcc and gyp, 5 # we have to build the *_SSE2.cpp files in a separate target. The 6 # gcc lameness is that, in order to compile SSE2 intrinsics code, it 7 # must be passed the -msse2 flag. However, with this flag, it may 8 # emit SSE2 instructions even for scalar code, such as the CPUID 9 # test used to test for the presence of SSE2. So that, and all other 10 # code must be compiled *without* -msse2. The gyp lameness is that it 11 # does not allow file-specific CFLAGS, so we must create this extra 12 # target for those files to be compiled with -msse2. 13 # 14 # This is actually only a problem on 32-bit Linux (all Intel Macs have 15 # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit 16 # SSE2 from instrinsics, while generating plain ol' 386 for everything 17 # else). However, to keep the .gyp file simple and avoid platform-specific 18 # build breakage, we do this on all platforms. 19 20 # For about the same reason, we need to compile the ARM opts files 21 # separately as well. 22 { 23 'target_name': 'opts', 24 'product_name': 'skia_opts', 25 'type': 'static_library', 26 'standalone_static_library': 1, 27 'dependencies': [ 28 'core.gyp:*', 29 'effects.gyp:*' 30 ], 31 'include_dirs': [ 32 '../src/core', 33 '../src/opts', 34 ], 35 'conditions': [ 36 [ 'skia_arch_type == "x86" and skia_os != "ios"', { 37 'conditions': [ 38 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]', { 39 'cflags': [ 40 '-msse2', 41 ], 42 }], 43 ], 44 'include_dirs': [ 45 '../include/utils', 46 ], 47 'dependencies': [ 48 'opts_ssse3', 49 ], 50 'sources': [ 51 '../src/opts/opts_check_x86.cpp', 52 '../src/opts/SkBitmapProcState_opts_SSE2.cpp', 53 '../src/opts/SkBitmapFilter_opts_SSE2.cpp', 54 '../src/opts/SkBlitRow_opts_SSE2.cpp', 55 '../src/opts/SkBlitRect_opts_SSE2.cpp', 56 '../src/opts/SkBlurImage_opts_SSE2.cpp', 57 '../src/opts/SkMorphology_opts_SSE2.cpp', 58 '../src/opts/SkUtils_opts_SSE2.cpp', 59 '../src/opts/SkXfermode_opts_SSE2.cpp', 60 ], 61 }], 62 [ 'skia_arch_type == "arm" and arm_version >= 7', { 63 # The assembly uses the frame pointer register (r7 in Thumb/r11 in 64 # ARM), the compiler doesn't like that. 65 'cflags!': [ 66 '-fno-omit-frame-pointer', 67 '-mapcs-frame', 68 '-mapcs', 69 ], 70 'cflags': [ 71 '-fomit-frame-pointer', 72 '-mno-apcs-frame', 73 ], 74 'variables': { 75 'arm_neon_optional%': '<(arm_neon_optional>', 76 }, 77 'sources': [ 78 '../src/opts/memset.arm.S', 79 '../src/opts/SkBitmapProcState_opts_arm.cpp', 80 '../src/opts/SkBlitMask_opts_arm.cpp', 81 '../src/opts/SkBlitRow_opts_arm.cpp', 82 '../src/opts/SkBlurImage_opts_arm.cpp', 83 '../src/opts/SkMorphology_opts_arm.cpp', 84 '../src/opts/SkUtils_opts_arm.cpp', 85 '../src/opts/SkXfermode_opts_arm.cpp', 86 ], 87 'conditions': [ 88 [ 'arm_neon == 1 or arm_neon_optional == 1', { 89 'dependencies': [ 90 'opts_neon', 91 ] 92 }], 93 [ 'skia_os == "ios"', { 94 'sources!': [ 95 # these fail to compile under xcode for ios 96 '../src/opts/memset.arm.S', 97 '../src/opts/SkBitmapProcState_opts_arm.cpp', 98 '../src/opts/SkBlitRow_opts_arm.cpp', 99 ], 100 }], 101 ], 102 }], 103 [ 'skia_arch_type == "mips"', { 104 'sources': [ 105 '../src/opts/SkBitmapProcState_opts_none.cpp', 106 '../src/opts/SkBlitMask_opts_none.cpp', 107 '../src/opts/SkBlurImage_opts_none.cpp', 108 '../src/opts/SkMorphology_opts_none.cpp', 109 '../src/opts/SkUtils_opts_none.cpp', 110 '../src/opts/SkXfermode_opts_none.cpp', 111 ], 112 'conditions': [ 113 [ '(mips_arch_variant == "mips32r2") \ 114 and (mips_dsp == 1 or mips_dsp == 2)', { 115 'sources': [ 116 '../src/opts/SkBlitRow_opts_mips_dsp.cpp', 117 ], 118 }, { 119 'sources': [ 120 '../src/opts/SkBlitRow_opts_none.cpp', 121 ], 122 }], 123 ], 124 }], 125 [ '(skia_arch_type == "arm" and arm_version < 7) \ 126 or (skia_os == "ios") \ 127 or (skia_os == "android" and skia_arch_type not in ["x86", "arm", "mips", "arm64"])', { 128 'sources': [ 129 '../src/opts/SkBitmapProcState_opts_none.cpp', 130 '../src/opts/SkBlitMask_opts_none.cpp', 131 '../src/opts/SkBlitRow_opts_none.cpp', 132 '../src/opts/SkBlurImage_opts_none.cpp', 133 '../src/opts/SkMorphology_opts_none.cpp', 134 '../src/opts/SkUtils_opts_none.cpp', 135 '../src/opts/SkXfermode_opts_none.cpp', 136 ], 137 }], 138 [ 'skia_android_framework', { 139 'cflags!': [ 140 '-msse2', 141 '-mfpu=neon', 142 '-fomit-frame-pointer', 143 '-mno-apcs-frame', 144 ] 145 }], 146 [ 'skia_arch_type == "arm64"', { 147 'sources': [ 148 '../src/opts/SkBitmapProcState_arm_neon.cpp', 149 '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp', 150 '../src/opts/SkBitmapProcState_opts_arm.cpp', 151 '../src/opts/SkBlitMask_opts_arm.cpp', 152 '../src/opts/SkBlitMask_opts_arm_neon.cpp', 153 '../src/opts/SkBlitRow_opts_arm.cpp', 154 '../src/opts/SkBlitRow_opts_arm_neon.cpp', 155 '../src/opts/SkBlurImage_opts_arm.cpp', 156 '../src/opts/SkBlurImage_opts_neon.cpp', 157 '../src/opts/SkMorphology_opts_arm.cpp', 158 '../src/opts/SkMorphology_opts_neon.cpp', 159 '../src/opts/SkUtils_opts_none.cpp', 160 '../src/opts/SkXfermode_opts_arm.cpp', 161 '../src/opts/SkXfermode_opts_arm_neon.cpp', 162 ], 163 }], 164 ], 165 }, 166 # For the same lame reasons as what is done for skia_opts, we have to 167 # create another target specifically for SSSE3 code as we would not want 168 # to compile the SSE2 code with -mssse3 which would potentially allow 169 # gcc to generate SSSE3 code. 170 { 171 'target_name': 'opts_ssse3', 172 'product_name': 'skia_opts_ssse3', 173 'type': 'static_library', 174 'standalone_static_library': 1, 175 'dependencies': [ 176 'core.gyp:*', 177 'effects.gyp:*' 178 ], 179 'include_dirs': [ 180 '../src/core', 181 ], 182 'conditions': [ 183 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"] \ 184 and not skia_android_framework', { 185 'cflags': [ 186 '-mssse3', 187 ], 188 }], 189 # (Mac has -mssse3 globally.) 190 [ 'skia_arch_type == "x86"', { 191 'sources': [ 192 '../src/opts/SkBitmapProcState_opts_SSSE3.cpp', 193 ], 194 }], 195 ], 196 }, 197 # NEON code must be compiled with -mfpu=neon which also affects scalar 198 # code. To support dynamic NEON code paths, we need to build all 199 # NEON-specific sources in a separate static library. The situation 200 # is very similar to the SSSE3 one. 201 { 202 'target_name': 'opts_neon', 203 'product_name': 'skia_opts_neon', 204 'type': 'static_library', 205 'standalone_static_library': 1, 206 'dependencies': [ 207 'core.gyp:*', 208 'effects.gyp:*' 209 ], 210 'include_dirs': [ 211 '../src/core', 212 '../src/opts', 213 ], 214 'cflags!': [ 215 '-fno-omit-frame-pointer', 216 '-mfpu=vfp', # remove them all, just in case. 217 '-mfpu=vfpv3', 218 '-mfpu=vfpv3-d16', 219 ], 220 'conditions': [ 221 [ 'not skia_android_framework', { 222 'cflags': [ 223 '-mfpu=neon', 224 '-fomit-frame-pointer', 225 ], 226 }], 227 ], 228 'ldflags': [ 229 '-march=armv7-a', 230 '-Wl,--fix-cortex-a8', 231 ], 232 'sources': [ 233 '../src/opts/memset16_neon.S', 234 '../src/opts/memset32_neon.S', 235 '../src/opts/SkBitmapProcState_arm_neon.cpp', 236 '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp', 237 '../src/opts/SkBitmapProcState_matrix_neon.h', 238 '../src/opts/SkBlitMask_opts_arm_neon.cpp', 239 '../src/opts/SkBlitRow_opts_arm_neon.cpp', 240 '../src/opts/SkBlurImage_opts_neon.cpp', 241 '../src/opts/SkMorphology_opts_neon.cpp', 242 '../src/opts/SkXfermode_opts_arm_neon.cpp', 243 ], 244 }, 245 ], 246} 247