| OLD | NEW |
| 1 # Gyp file for opts projects | |
| 2 { | 1 { |
| 2 # Source lists live in opts.gypi. This makes it easier to maintain our Chrome
GYP/GN setup. |
| 3 # (To be honest, I'm not sure why we need to include common.gypi. I thought i
t was automatic.) |
| 4 'variables': { |
| 5 'includes': [ 'common.gypi', 'opts.gypi' ], |
| 6 }, |
| 7 |
| 8 # Generally we shove things into one 'opts' target conditioned on platform. |
| 9 # If a particular platform needs some files built with different flags, |
| 10 # those become separate targets: opts_ssse3, opts_sse41, opts_neon. |
| 11 |
| 3 'targets': [ | 12 '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 { | 13 { |
| 23 'target_name': 'opts', | 14 'target_name': 'opts', |
| 24 'product_name': 'skia_opts', | 15 'product_name': 'skia_opts', |
| 25 'type': 'static_library', | 16 'type': 'static_library', |
| 26 'standalone_static_library': 1, | 17 'standalone_static_library': 1, |
| 27 'dependencies': [ | 18 'dependencies': [ |
| 28 'core.gyp:*', | 19 'core.gyp:*', |
| 29 'effects.gyp:*' | 20 'effects.gyp:*' |
| 30 ], | 21 ], |
| 31 'include_dirs': [ | 22 'include_dirs': [ |
| 32 '../src/core', | 23 '../src/core', |
| 33 '../src/opts', | 24 '../src/opts', |
| 34 '../src/utils', | 25 '../src/utils', |
| 26 '../include/utils', |
| 35 ], | 27 ], |
| 36 'conditions': [ | 28 'conditions': [ |
| 37 [ 'skia_arch_type == "x86" and skia_os != "ios"', { | 29 [ 'skia_arch_type == "x86" and skia_os != "ios"', { |
| 30 'cflags': [ '-msse2' ], |
| 31 'dependencies': [ 'opts_ssse3', 'opts_sse41' ], |
| 32 'sources': [ '<@(sse2_sources)' ], |
| 33 }], |
| 34 |
| 35 [ 'skia_arch_type == "mips"', { |
| 38 'conditions': [ | 36 'conditions': [ |
| 39 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "ch
romeos", "android"]', { | 37 [ '(mips_arch_variant == "mips32r2") and (mips_dsp == 1 or mips_dsp
== 2)', { |
| 40 'cflags': [ | 38 'sources': [ '<@(mips_dsp_sources)' ], |
| 41 '-msse2', | 39 },{ |
| 42 ], | 40 'sources': [ '<@(none_sources)' ], |
| 43 }], | 41 }], |
| 44 ], | 42 ] |
| 45 'include_dirs': [ | |
| 46 '../include/utils', | |
| 47 ], | |
| 48 'dependencies': [ | |
| 49 'opts_ssse3', | |
| 50 'opts_sse4', | |
| 51 ], | |
| 52 'sources': [ | |
| 53 '../src/opts/opts_check_x86.cpp', | |
| 54 '../src/opts/SkBitmapProcState_opts_SSE2.cpp', | |
| 55 '../src/opts/SkBitmapFilter_opts_SSE2.cpp', | |
| 56 '../src/opts/SkBlitRow_opts_SSE2.cpp', | |
| 57 '../src/opts/SkBlitRect_opts_SSE2.cpp', | |
| 58 '../src/opts/SkBlurImage_opts_SSE2.cpp', | |
| 59 '../src/opts/SkMorphology_opts_SSE2.cpp', | |
| 60 '../src/opts/SkTextureCompression_opts_none.cpp', | |
| 61 '../src/opts/SkUtils_opts_SSE2.cpp', | |
| 62 '../src/opts/SkXfermode_opts_SSE2.cpp', | |
| 63 ], | |
| 64 }], | 43 }], |
| 44 |
| 45 [ '(skia_arch_type == "arm" and arm_version < 7) \ |
| 46 or (skia_os == "ios") \ |
| 47 or (skia_os == "android" and skia_arch_type not in ["x86", "arm", "m
ips", "arm64"])', { |
| 48 'sources': [ '<@(none_sources)' ], |
| 49 }], |
| 50 |
| 65 [ 'skia_arch_type == "arm" and arm_version >= 7', { | 51 [ 'skia_arch_type == "arm" and arm_version >= 7', { |
| 66 # The assembly uses the frame pointer register (r7 in Thumb/r11 in | 52 # The assembly uses the frame pointer register (r7 in Thumb/r11 in |
| 67 # ARM), the compiler doesn't like that. | 53 # ARM), the compiler doesn't like that. |
| 68 'cflags!': [ | 54 'cflags!': [ '-fno-omit-frame-pointer', '-mapcs-frame', '-mapcs' ], |
| 69 '-fno-omit-frame-pointer', | 55 'cflags': [ '-fomit-frame-pointer' ], |
| 70 '-mapcs-frame', | 56 'variables': { 'arm_neon_optional%': '<(arm_neon_optional>' }, |
| 71 '-mapcs', | 57 'sources': [ '<@(armv7_sources)' ], |
| 72 ], | |
| 73 'cflags': [ | |
| 74 '-fomit-frame-pointer', | |
| 75 ], | |
| 76 'variables': { | |
| 77 'arm_neon_optional%': '<(arm_neon_optional>', | |
| 78 }, | |
| 79 'sources': [ | |
| 80 '../src/opts/memset.arm.S', | |
| 81 '../src/opts/SkBitmapProcState_opts_arm.cpp', | |
| 82 '../src/opts/SkBlitMask_opts_arm.cpp', | |
| 83 '../src/opts/SkBlitRow_opts_arm.cpp', | |
| 84 '../src/opts/SkBlurImage_opts_arm.cpp', | |
| 85 '../src/opts/SkMorphology_opts_arm.cpp', | |
| 86 '../src/opts/SkTextureCompression_opts_arm.cpp', | |
| 87 '../src/opts/SkUtils_opts_arm.cpp', | |
| 88 '../src/opts/SkXfermode_opts_arm.cpp', | |
| 89 ], | |
| 90 'conditions': [ | 58 'conditions': [ |
| 91 [ 'arm_neon == 1 or arm_neon_optional == 1', { | 59 [ 'arm_neon == 1 or arm_neon_optional == 1', { |
| 92 'dependencies': [ | 60 'dependencies': [ 'opts_neon' ] |
| 93 'opts_neon', | |
| 94 ] | |
| 95 }], | 61 }], |
| 96 [ 'skia_os == "ios"', { | 62 [ 'skia_os == "ios"', { |
| 97 'sources!': [ | 63 'sources!': [ |
| 98 # these fail to compile under xcode for ios | 64 # these fail to compile under xcode for ios |
| 99 '../src/opts/memset.arm.S', | 65 '../src/opts/memset.arm.S', |
| 100 '../src/opts/SkBitmapProcState_opts_arm.cpp', | 66 '../src/opts/SkBitmapProcState_opts_arm.cpp', |
| 101 '../src/opts/SkBlitRow_opts_arm.cpp', | 67 '../src/opts/SkBlitRow_opts_arm.cpp', |
| 102 ], | 68 ], |
| 103 }], | 69 }], |
| 104 ], | 70 ], |
| 105 }], | 71 }], |
| 106 [ 'skia_arch_type == "mips"', { | 72 |
| 107 'sources': [ | 73 [ 'skia_arch_type == "arm64"', { |
| 108 '../src/opts/SkBlitMask_opts_none.cpp', | 74 'sources': [ '<@(arm64_sources)' ], |
| 109 '../src/opts/SkBlurImage_opts_none.cpp', | |
| 110 '../src/opts/SkMorphology_opts_none.cpp', | |
| 111 '../src/opts/SkUtils_opts_none.cpp', | |
| 112 '../src/opts/SkTextureCompression_opts_none.cpp', | |
| 113 '../src/opts/SkXfermode_opts_none.cpp', | |
| 114 ], | |
| 115 'conditions': [ | |
| 116 [ '(mips_arch_variant == "mips32r2") \ | |
| 117 and (mips_dsp == 1 or mips_dsp == 2)', { | |
| 118 'sources': [ | |
| 119 '../src/opts/SkBitmapProcState_opts_mips_dsp.cpp', | |
| 120 '../src/opts/SkBlitRow_opts_mips_dsp.cpp', | |
| 121 ], | |
| 122 }, { | |
| 123 'sources': [ | |
| 124 '../src/opts/SkBitmapProcState_opts_none.cpp', | |
| 125 '../src/opts/SkBlitRow_opts_none.cpp', | |
| 126 ], | |
| 127 }], | |
| 128 ], | |
| 129 }], | 75 }], |
| 130 [ '(skia_arch_type == "arm" and arm_version < 7) \ | 76 |
| 131 or (skia_os == "ios") \ | |
| 132 or (skia_os == "android" and skia_arch_type not in ["x86", "arm", "m
ips", "arm64"])', { | |
| 133 'sources': [ | |
| 134 '../src/opts/SkBitmapProcState_opts_none.cpp', | |
| 135 '../src/opts/SkBlitMask_opts_none.cpp', | |
| 136 '../src/opts/SkBlitRow_opts_none.cpp', | |
| 137 '../src/opts/SkBlurImage_opts_none.cpp', | |
| 138 '../src/opts/SkMorphology_opts_none.cpp', | |
| 139 '../src/opts/SkUtils_opts_none.cpp', | |
| 140 '../src/opts/SkTextureCompression_opts_none.cpp', | |
| 141 '../src/opts/SkXfermode_opts_none.cpp', | |
| 142 ], | |
| 143 }], | |
| 144 [ 'skia_android_framework', { | 77 [ 'skia_android_framework', { |
| 145 'cflags!': [ | 78 'cflags!': [ |
| 146 '-msse2', | 79 '-msse2', |
| 147 '-mfpu=neon', | 80 '-mfpu=neon', |
| 148 '-fomit-frame-pointer', | 81 '-fomit-frame-pointer', |
| 149 ] | 82 ] |
| 150 }], | 83 }], |
| 151 [ 'skia_arch_type == "arm64"', { | |
| 152 'sources': [ | |
| 153 '../src/opts/SkBitmapProcState_arm_neon.cpp', | |
| 154 '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp', | |
| 155 '../src/opts/SkBitmapProcState_opts_arm.cpp', | |
| 156 '../src/opts/SkBlitMask_opts_arm.cpp', | |
| 157 '../src/opts/SkBlitMask_opts_arm_neon.cpp', | |
| 158 '../src/opts/SkBlitRow_opts_arm.cpp', | |
| 159 '../src/opts/SkBlitRow_opts_arm_neon.cpp', | |
| 160 '../src/opts/SkBlurImage_opts_arm.cpp', | |
| 161 '../src/opts/SkBlurImage_opts_neon.cpp', | |
| 162 '../src/opts/SkMorphology_opts_arm.cpp', | |
| 163 '../src/opts/SkMorphology_opts_neon.cpp', | |
| 164 '../src/opts/SkTextureCompression_opts_none.cpp', | |
| 165 '../src/opts/SkUtils_opts_none.cpp', | |
| 166 '../src/opts/SkXfermode_opts_arm.cpp', | |
| 167 '../src/opts/SkXfermode_opts_arm_neon.cpp', | |
| 168 ], | |
| 169 }], | |
| 170 ], | 84 ], |
| 171 }, | 85 }, |
| 172 # For the same lame reasons as what is done for skia_opts, we have to | |
| 173 # create another target specifically for SSSE3 code as we would not want | |
| 174 # to compile the SSE2 code with -mssse3 which would potentially allow | |
| 175 # gcc to generate SSSE3 code. | |
| 176 { | 86 { |
| 177 'target_name': 'opts_ssse3', | 87 'target_name': 'opts_ssse3', |
| 178 'product_name': 'skia_opts_ssse3', | 88 'product_name': 'skia_opts_ssse3', |
| 179 'type': 'static_library', | 89 'type': 'static_library', |
| 180 'standalone_static_library': 1, | 90 'standalone_static_library': 1, |
| 181 'dependencies': [ | 91 'dependencies': [ 'core.gyp:*' ], |
| 182 'core.gyp:*', | 92 'include_dirs': [ '../src/core' ], |
| 183 'effects.gyp:*' | 93 'sources': [ '<@(ssse3_sources)' ], |
| 184 ], | |
| 185 'include_dirs': [ | |
| 186 '../src/core', | |
| 187 '../src/utils', | |
| 188 ], | |
| 189 'sources': [ | |
| 190 '../src/opts/SkBitmapProcState_opts_SSSE3.cpp', | |
| 191 ], | |
| 192 'conditions': [ | 94 'conditions': [ |
| 193 [ 'skia_os == "win"', { | 95 [ 'skia_os == "win"', { |
| 194 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ], | 96 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ], |
| 195 }], | 97 }], |
| 196 # (Mac has -mssse3 globally.) | 98 [ 'not skia_android_framework', { |
| 197 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chrome
os", "android"] \ | 99 'cflags': [ '-mssse3' ], |
| 198 and not skia_android_framework', { | |
| 199 'cflags': [ | |
| 200 '-mssse3', | |
| 201 ], | |
| 202 }], | 100 }], |
| 203 ], | 101 ], |
| 204 }, | 102 }, |
| 205 # For the same lame reasons as what is done for skia_opts, we also have to | |
| 206 # create another target specifically for SSE4 code as we would not want | |
| 207 # to compile the SSE2 code with -msse4 which would potentially allow | |
| 208 # gcc to generate SSE4 code. | |
| 209 { | 103 { |
| 210 'target_name': 'opts_sse4', | 104 'target_name': 'opts_sse41', |
| 211 'product_name': 'skia_opts_sse4', | 105 'product_name': 'skia_opts_sse41', |
| 212 'type': 'static_library', | 106 'type': 'static_library', |
| 213 'standalone_static_library': 1, | 107 'standalone_static_library': 1, |
| 214 'dependencies': [ | 108 'dependencies': [ 'core.gyp:*' ], |
| 215 'core.gyp:*', | 109 'sources': [ '<@(sse41_sources)' ], |
| 216 'effects.gyp:*' | |
| 217 ], | |
| 218 'include_dirs': [ | |
| 219 '../src/core', | |
| 220 '../src/utils', | |
| 221 ], | |
| 222 'sources': [ | |
| 223 '../src/opts/SkBlurImage_opts_SSE4.cpp', | |
| 224 ], | |
| 225 'conditions': [ | 110 'conditions': [ |
| 226 [ 'skia_arch_width == 64', { | |
| 227 'sources': [ | |
| 228 '../src/opts/SkBlitRow_opts_SSE4_x64_asm.S', | |
| 229 ], | |
| 230 }], | |
| 231 [ 'skia_arch_width == 32', { | |
| 232 'sources': [ | |
| 233 '../src/opts/SkBlitRow_opts_SSE4_asm.S', | |
| 234 ], | |
| 235 }], | |
| 236 [ 'skia_os == "win"', { | 111 [ 'skia_os == "win"', { |
| 237 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], | 112 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], |
| 238 }], | 113 }], |
| 239 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chrome
os", "android"] \ | 114 [ 'not skia_android_framework', { |
| 240 and not skia_android_framework', { | 115 'cflags': [ '-msse4.1' ], |
| 241 'cflags': [ | |
| 242 '-msse4.1', | |
| 243 ], | |
| 244 }], | 116 }], |
| 245 [ 'skia_os == "mac"', { | 117 [ 'skia_os == "mac"', { |
| 246 'xcode_settings': { | 118 'xcode_settings': { 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES' }, |
| 247 'OTHER_CPLUSPLUSFLAGS!': [ | |
| 248 '-mssse3', | |
| 249 ], | |
| 250 'OTHER_CPLUSPLUSFLAGS': [ | |
| 251 '-msse4.1', | |
| 252 ], | |
| 253 }, | |
| 254 }], | 119 }], |
| 255 ], | 120 ], |
| 256 }, | 121 }, |
| 257 # NEON code must be compiled with -mfpu=neon which also affects scalar | |
| 258 # code. To support dynamic NEON code paths, we need to build all | |
| 259 # NEON-specific sources in a separate static library. The situation | |
| 260 # is very similar to the SSSE3 and SSE4 one. | |
| 261 { | 122 { |
| 262 'target_name': 'opts_neon', | 123 'target_name': 'opts_neon', |
| 263 'product_name': 'skia_opts_neon', | 124 'product_name': 'skia_opts_neon', |
| 264 'type': 'static_library', | 125 'type': 'static_library', |
| 265 'standalone_static_library': 1, | 126 'standalone_static_library': 1, |
| 266 'dependencies': [ | 127 'dependencies': [ |
| 267 'core.gyp:*', | 128 'core.gyp:*', |
| 268 'effects.gyp:*' | 129 'effects.gyp:*' |
| 269 ], | 130 ], |
| 270 'include_dirs': [ | 131 'include_dirs': [ |
| 271 '../src/core', | 132 '../src/core', |
| 272 '../src/opts', | 133 '../src/opts', |
| 273 '../src/utils', | 134 '../src/utils', |
| 274 ], | 135 ], |
| 136 'sources': [ '<@(neon_sources)' ], |
| 275 'cflags!': [ | 137 'cflags!': [ |
| 276 '-fno-omit-frame-pointer', | 138 '-fno-omit-frame-pointer', |
| 277 '-mfpu=vfp', # remove them all, just in case. | 139 '-mfpu=vfp', # remove them all, just in case. |
| 278 '-mfpu=vfpv3', | 140 '-mfpu=vfpv3', |
| 279 '-mfpu=vfpv3-d16', | 141 '-mfpu=vfpv3-d16', |
| 280 ], | 142 ], |
| 281 'conditions': [ | 143 'conditions': [ |
| 282 [ 'not skia_android_framework', { | 144 [ 'not skia_android_framework', { |
| 283 'cflags': [ | 145 'cflags': [ |
| 284 '-mfpu=neon', | 146 '-mfpu=neon', |
| 285 '-fomit-frame-pointer', | 147 '-fomit-frame-pointer', |
| 286 ], | 148 ], |
| 287 }], | 149 }], |
| 288 ], | 150 ], |
| 289 'ldflags': [ | 151 'ldflags': [ |
| 290 '-march=armv7-a', | 152 '-march=armv7-a', |
| 291 '-Wl,--fix-cortex-a8', | 153 '-Wl,--fix-cortex-a8', |
| 292 ], | 154 ], |
| 293 'sources': [ | |
| 294 '../src/opts/memset16_neon.S', | |
| 295 '../src/opts/memset32_neon.S', | |
| 296 '../src/opts/SkBitmapProcState_arm_neon.cpp', | |
| 297 '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp', | |
| 298 '../src/opts/SkBitmapProcState_matrix_neon.h', | |
| 299 '../src/opts/SkBlitMask_opts_arm_neon.cpp', | |
| 300 '../src/opts/SkBlitRow_opts_arm_neon.cpp', | |
| 301 '../src/opts/SkBlurImage_opts_neon.cpp', | |
| 302 '../src/opts/SkMorphology_opts_neon.cpp', | |
| 303 '../src/opts/SkTextureCompression_opts_neon.cpp', | |
| 304 '../src/opts/SkXfermode_opts_arm_neon.cpp', | |
| 305 ], | |
| 306 }, | 155 }, |
| 307 ], | 156 ], |
| 308 } | 157 } |
| OLD | NEW |