1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
6 # This gyp file contains the platform-specific optimizations for Skia
9 # Due to an unfortunate intersection of lameness between gcc and gyp,
10 # we have to build the *_SSE2.cpp files in a separate target. The
11 # gcc lameness is that, in order to compile SSE2 intrinsics code, it
12 # must be passed the -msse2 flag. However, with this flag, it may
13 # emit SSE2 instructions even for scalar code, such as the CPUID
14 # test used to test for the presence of SSE2. So that, and all other
15 # code must be compiled *without* -msse2. The gyp lameness is that it
16 # does not allow file-specific CFLAGS, so we must create this extra
17 # target for those files to be compiled with -msse2.
19 # This is actually only a problem on 32-bit Linux (all Intel Macs have
20 # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
21 # SSE2 from instrinsics, which generating plain ol' 386 for everything
22 # else). However, to keep the .gyp file simple and avoid platform-specific
23 # build breakage, we do this on all platforms.
25 # For about the same reason, we need to compile the ARM opts files
28 'target_name': 'skia_opts',
29 'type': 'static_library',
32 '../build/android/increase_size_for_speed.gypi',
33 # Disable LTO due to compiler error
34 # in mems_in_disjoint_alias_sets_p, at alias.c:393
36 '../build/android/disable_lto.gypi',
39 '../third_party/skia/include/core',
40 '../third_party/skia/include/effects',
41 '../third_party/skia/src/core',
42 '../third_party/skia/src/opts',
43 '../third_party/skia/src/utils',
46 [ 'os_posix == 1 and OS != "mac" and OS != "android" and \
47 target_arch != "arm" and target_arch != "arm64" and \
48 target_arch != "mipsel" and target_arch != "mips64el"', {
53 [ 'target_arch != "arm" and target_arch != "mipsel" and \
54 target_arch != "arm64" and target_arch != "mips64el"', {
56 '../third_party/skia/src/opts/SkBitmapFilter_opts_SSE2.cpp',
57 '../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp',
58 '../third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp',
59 '../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp',
60 '../third_party/skia/src/opts/SkBlurImage_opts_SSE2.cpp',
61 '../third_party/skia/src/opts/SkMorphology_opts_SSE2.cpp',
62 '../third_party/skia/src/opts/SkTextureCompression_opts_none.cpp',
63 '../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp',
64 '../third_party/skia/src/opts/SkXfermode_opts_SSE2.cpp',
71 [ 'target_arch == "arm"', {
73 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
79 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
80 # ARM), the compiler doesn't like that. Explicitly remove the
81 # -fno-omit-frame-pointer flag for Android, as that gets added to all
82 # targets via common.gypi.
84 '-fno-omit-frame-pointer',
89 '-fomit-frame-pointer',
92 '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
95 [ 'target_arch == "arm" and (arm_version < 7 or arm_neon == 0)', {
97 '../third_party/skia/src/opts/memset.arm.S',
100 [ 'target_arch == "arm" and arm_version < 6', {
102 '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
103 '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
104 '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
105 '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
106 '../third_party/skia/src/opts/SkTextureCompression_opts_none.cpp',
107 '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
108 '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
111 [ 'target_arch == "arm" and arm_version >= 6', {
113 '../third_party/skia/src/opts/SkBlitMask_opts_arm.cpp',
114 '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
115 '../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
116 '../third_party/skia/src/opts/SkBlurImage_opts_arm.cpp',
117 '../third_party/skia/src/opts/SkMorphology_opts_arm.cpp',
118 '../third_party/skia/src/opts/SkTextureCompression_opts_arm.cpp',
119 '../third_party/skia/src/opts/SkUtils_opts_arm.cpp',
120 '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
123 [ 'target_arch == "mipsel" or target_arch == "mips64el"',{
125 '-fomit-frame-pointer',
128 '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
129 '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
130 '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
131 '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
132 '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
133 '../third_party/skia/src/opts/SkTextureCompression_opts_none.cpp',
134 '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
135 '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
138 [ 'target_arch == "arm64"', {
140 '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
141 '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
142 '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
143 '../third_party/skia/src/opts/SkBlitMask_opts_arm.cpp',
144 '../third_party/skia/src/opts/SkBlitMask_opts_arm_neon.cpp',
145 '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
146 '../third_party/skia/src/opts/SkBlurImage_opts_arm.cpp',
147 '../third_party/skia/src/opts/SkBlurImage_opts_neon.cpp',
148 '../third_party/skia/src/opts/SkMorphology_opts_arm.cpp',
149 '../third_party/skia/src/opts/SkMorphology_opts_neon.cpp',
150 '../third_party/skia/src/opts/SkTextureCompression_opts_arm.cpp',
151 '../third_party/skia/src/opts/SkTextureCompression_opts_neon.cpp',
152 '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
153 '../third_party/skia/src/opts/SkXfermode_opts_arm.cpp',
154 '../third_party/skia/src/opts/SkXfermode_opts_arm_neon.cpp',
159 # For the same lame reasons as what is done for skia_opts, we have to
160 # create another target specifically for SSSE3 code as we would not want
161 # to compile the SSE2 code with -mssse3 which would potentially allow
162 # gcc to generate SSSE3 code.
164 'target_name': 'skia_opts_ssse3',
165 'type': 'static_library',
168 '../build/android/increase_size_for_speed.gypi',
171 '../third_party/skia/include/core',
172 '../third_party/skia/include/effects',
173 '../third_party/skia/src/core',
176 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
183 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
186 [ 'OS == "win" and clang == 1', {
187 # cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe
188 # doesn't need it for intrinsics. clang-cl does need it, though.
190 'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] },
197 'direct_dependent_settings': {
203 'SK_CPU_SSE_LEVEL=31'
206 [ 'target_arch != "arm" and target_arch != "arm64" and \
207 target_arch != "mipsel" and target_arch != "mips64el"', {
209 '../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp',
214 # For the same lame reasons as what is done for skia_opts, we also have to
215 # create another target specifically for SSE4 code as we would not want
216 # to compile the SSE2 code with -msse4 which would potentially allow
217 # gcc to generate SSE4 code.
219 'target_name': 'skia_opts_sse4',
220 'type': 'static_library',
223 '../build/android/increase_size_for_speed.gypi',
226 '../third_party/skia/include/core',
227 '../third_party/skia/src/core',
230 '../third_party/skia/src/opts/SkBlurImage_opts_SSE4.cpp',
233 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
240 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
243 [ 'OS == "win" and clang == 1', {
244 # cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe
245 # doesn't need it for intrinsics. clang-cl does need it, though.
247 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
252 'SK_CPU_SSE_LEVEL=41'
255 [ 'target_arch == "x64"', {
257 '../third_party/skia/src/opts/SkBlitRow_opts_SSE4_x64_asm.S',
260 [ 'target_arch == "ia32"', {
262 '../third_party/skia/src/opts/SkBlitRow_opts_SSE4_asm.S',
268 'target_name': 'skia_opts_none',
269 'type': 'static_library',
272 '../build/android/increase_size_for_speed.gypi',
275 '../third_party/skia/include/core',
276 '../third_party/skia/include/effects',
277 '../third_party/skia/src/core',
278 '../third_party/skia/src/utils',
281 '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
282 '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
283 '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
284 '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
285 '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
286 '../third_party/skia/src/opts/SkTextureCompression_opts_none.cpp',
287 '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
288 '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
293 # NEON code must be compiled with -mfpu=neon which also affects scalar
294 # code. To support dynamic NEON code paths, we need to build all
295 # NEON-specific sources in a separate static library. The situation
296 # is very similar to the SSSE3 one.
297 ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
300 'target_name': 'skia_opts_neon',
301 'type': 'static_library',
304 '../build/android/increase_size_for_speed.gypi',
305 # Disable LTO due to Neon issues
307 '../build/android/disable_lto.gypi',
310 '../third_party/skia/include/core',
311 '../third_party/skia/include/effects',
312 '../third_party/skia/src/core',
313 '../third_party/skia/src/opts',
314 '../third_party/skia/src/utils',
317 '-fno-omit-frame-pointer',
318 '-mfpu=vfp', # remove them all, just in case.
324 '-fomit-frame-pointer',
328 '-Wl,--fix-cortex-a8',
331 '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
332 '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
333 '../third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h',
334 '../third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h',
335 '../third_party/skia/src/opts/SkBlitMask_opts_arm_neon.cpp',
336 '../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
337 '../third_party/skia/src/opts/SkBlurImage_opts_neon.cpp',
338 '../third_party/skia/src/opts/SkMorphology_opts_neon.cpp',
339 '../third_party/skia/src/opts/SkTextureCompression_opts_neon.cpp',
340 '../third_party/skia/src/opts/SkXfermode_opts_arm_neon.cpp',
341 '../third_party/skia/src/opts/memset16_neon.S',
342 '../third_party/skia/src/opts/memset32_neon.S',