Relax the usage of KeySystems::UpdateIfNeeded().
[chromium-blink-merge.git] / skia / skia_library_opts.gyp
blob37f5eb44addf19bb387eb61118642ac4367e92a5
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
8   'targets': [
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.
18     #
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
26     # separately as well.
27     {
28       'target_name': 'skia_opts',
29       'type': 'static_library',
30       'includes': [
31         'skia_common.gypi',
32       ],
33       'include_dirs': [
34         '../third_party/skia/include/core',
35         '../third_party/skia/include/effects',
36         '../third_party/skia/src/core',
37         '../third_party/skia/src/opts',
38         '../third_party/skia/src/utils',
39       ],
40       'conditions': [
41         [ 'os_posix == 1 and OS != "mac" and OS != "android" and \
42            target_arch != "arm" and target_arch != "arm64" and \
43            target_arch != "mipsel"', {
44           'cflags': [
45             '-msse2',
46           ],
47         }],
48         [ 'target_arch != "arm" and target_arch != "mipsel" and \
49            target_arch != "arm64"', {
50           'sources': [
51             '../third_party/skia/src/opts/SkBitmapFilter_opts_SSE2.cpp',
52             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp',
53             '../third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp',
54             '../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp',
55             '../third_party/skia/src/opts/SkBlurImage_opts_SSE2.cpp',
56             '../third_party/skia/src/opts/SkMorphology_opts_SSE2.cpp',
57             '../third_party/skia/src/opts/SkTextureCompression_opts_none.cpp',
58             '../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp',
59             '../third_party/skia/src/opts/SkXfermode_opts_SSE2.cpp',
60           ],
61           'dependencies': [
62             'skia_opts_ssse3',
63             'skia_opts_sse4',
64           ],
65         }],
66         [ 'target_arch == "arm"', {
67           'conditions': [
68             [ 'arm_version >= 7 and arm_neon == 1', {
69               'defines': [
70                 '__ARM_HAVE_NEON',
71               ],
72             }],
73             [ 'arm_version >= 7 and arm_neon_optional == 1', {
74               'defines': [
75                 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
76               ],
77             }],
78             [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
79               'cflags': [
80                 # The neon assembly contains conditional instructions which
81                 # aren't enclosed in an IT block. The assembler complains
82                 # without this option.
83                 # See #86592.
84                 '-Wa,-mimplicit-it=always',
85               ],
86               'dependencies': [
87                 'skia_opts_neon',
88               ]
89            }],
90           ],
91           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
92           # ARM), the compiler doesn't like that. Explicitly remove the
93           # -fno-omit-frame-pointer flag for Android, as that gets added to all
94           # targets via common.gypi.
95           'cflags!': [
96             '-fno-omit-frame-pointer',
97             '-marm',
98             '-mapcs-frame',
99           ],
100           'cflags': [
101             '-fomit-frame-pointer',
102           ],
103           'sources': [
104             '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
105           ],
106         }],
107         [ 'target_arch == "arm" and (arm_version < 7 or arm_neon == 0)', {
108           'sources': [
109             '../third_party/skia/src/opts/memset.arm.S',
110           ],
111         }],
112         [ 'target_arch == "arm" and arm_version < 6', {
113           'sources': [
114             '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
115             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
116             '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
117             '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
118             '../third_party/skia/src/opts/SkTextureCompression_opts_none.cpp',
119             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
120             '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
121           ],
122         }],
123         [ 'target_arch == "arm" and arm_version >= 6', {
124           'sources': [
125             '../third_party/skia/src/opts/SkBlitMask_opts_arm.cpp',
126             '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
127             '../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
128             '../third_party/skia/src/opts/SkBlurImage_opts_arm.cpp',
129             '../third_party/skia/src/opts/SkMorphology_opts_arm.cpp',
130             '../third_party/skia/src/opts/SkTextureCompression_opts_arm.cpp',
131             '../third_party/skia/src/opts/SkUtils_opts_arm.cpp',
132             '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
133           ],
134         }],
135         [ 'target_arch == "mipsel"',{
136           'cflags': [
137             '-fomit-frame-pointer',
138           ],
139           'sources': [
140             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
141             '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
142             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
143             '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
144             '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
145             '../third_party/skia/src/opts/SkTextureCompression_opts_none.cpp',
146             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
147             '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
148           ],
149         }],
150         [ 'target_arch == "arm64"', {
151           'sources': [
152             '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
153             '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
154             '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
155             '../third_party/skia/src/opts/SkBlitMask_opts_arm.cpp',
156             '../third_party/skia/src/opts/SkBlitMask_opts_arm_neon.cpp',
157             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
158             '../third_party/skia/src/opts/SkBlurImage_opts_arm.cpp',
159             '../third_party/skia/src/opts/SkBlurImage_opts_neon.cpp',
160             '../third_party/skia/src/opts/SkMorphology_opts_arm.cpp',
161             '../third_party/skia/src/opts/SkMorphology_opts_neon.cpp',
162             '../third_party/skia/src/opts/SkTextureCompression_opts_arm.cpp',
163             '../third_party/skia/src/opts/SkTextureCompression_opts_neon.cpp',
164             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
165             '../third_party/skia/src/opts/SkXfermode_opts_arm.cpp',
166             '../third_party/skia/src/opts/SkXfermode_opts_arm_neon.cpp',
167           ],
168         }],
169       ],
170     },
171     # For the same lame reasons as what is done for skia_opts, we have to
172     # create another target specifically for SSSE3 code as we would not want
173     # to compile the SSE2 code with -mssse3 which would potentially allow
174     # gcc to generate SSSE3 code.
175     {
176       'target_name': 'skia_opts_ssse3',
177       'type': 'static_library',
178       'includes': [
179         'skia_common.gypi',
180       ],
181       'include_dirs': [
182         '../third_party/skia/include/core',
183         '../third_party/skia/include/effects',
184         '../third_party/skia/src/core',
185       ],
186       'conditions': [
187         [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
188           'cflags': [
189             '-mssse3',
190           ],
191         }],
192         [ 'OS == "mac"', {
193           'xcode_settings': {
194             'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
195           },
196         }],
197         [ 'OS == "win"', {
198           'include_dirs': [
199             'config/win',
200           ],
201           'direct_dependent_settings': {
202             'include_dirs': [
203               'config/win',
204             ],
205           },
206           'defines' : [
207             'SK_CPU_SSE_LEVEL=31'
208           ],
209         }],
210         [ 'target_arch != "arm" and target_arch != "arm64" and \
211            target_arch != "mipsel"', {
212           'sources': [
213             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp',
214           ],
215         }],
216       ],
217     },
218     # For the same lame reasons as what is done for skia_opts, we also have to
219     # create another target specifically for SSE4 code as we would not want
220     # to compile the SSE2 code with -msse4 which would potentially allow
221     # gcc to generate SSE4 code.
222     {
223       'target_name': 'skia_opts_sse4',
224       'type': 'static_library',
225       'includes': [
226         'skia_common.gypi',
227       ],
228       'include_dirs': [
229         '../third_party/skia/include/core',
230         '../third_party/skia/src/core',
231       ],
232       'sources': [
233         '../third_party/skia/src/opts/SkBlurImage_opts_SSE4.cpp',
234       ],
235       'conditions': [
236         [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
237           'cflags': [
238             '-msse4.1',
239           ],
240         }],
241         [ 'OS == "mac"', {
242           'xcode_settings': {
243             'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
244           },
245         }],
246         [ 'OS == "win"', {
247           'defines' : [
248             'SK_CPU_SSE_LEVEL=41'
249           ],
250         }],
251         [ 'target_arch == "x64"', {
252           'sources': [
253             '../third_party/skia/src/opts/SkBlitRow_opts_SSE4_x64_asm.S',
254           ],
255         }],
256         [ 'target_arch == "ia32"', {
257           'sources': [
258             '../third_party/skia/src/opts/SkBlitRow_opts_SSE4_asm.S',
259           ],
260        }],
261       ],
262     },
263     {
264       'target_name': 'skia_opts_none',
265       'type': 'static_library',
266       'includes': [
267         'skia_common.gypi',
268       ],
269       'include_dirs': [
270         '../third_party/skia/include/core',
271         '../third_party/skia/include/effects',
272         '../third_party/skia/src/core',
273         '../third_party/skia/src/utils',
274       ],
275       'sources': [
276         '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
277         '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
278         '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
279         '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
280         '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
281         '../third_party/skia/src/opts/SkTextureCompression_opts_none.cpp',
282         '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
283         '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
284       ],
285     },
286   ],
287   'conditions': [
288     # NEON code must be compiled with -mfpu=neon which also affects scalar
289     # code. To support dynamic NEON code paths, we need to build all
290     # NEON-specific sources in a separate static library. The situation
291     # is very similar to the SSSE3 one.
292     ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
293       'targets': [
294         {
295           'target_name': 'skia_opts_neon',
296           'type': 'static_library',
297           'includes': [
298             'skia_common.gypi',
299           ],
300           'include_dirs': [
301             '../third_party/skia/include/core',
302             '../third_party/skia/include/effects',
303             '../third_party/skia/src/core',
304             '../third_party/skia/src/opts',
305             '../third_party/skia/src/utils',
306           ],
307           'cflags!': [
308             '-fno-omit-frame-pointer',
309             '-mfpu=vfp',  # remove them all, just in case.
310             '-mfpu=vfpv3',
311             '-mfpu=vfpv3-d16',
312           ],
313           'cflags': [
314             '-mfpu=neon',
315             '-fomit-frame-pointer',
316           ],
317           'ldflags': [
318             '-march=armv7-a',
319             '-Wl,--fix-cortex-a8',
320           ],
321           'sources': [
322             '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
323             '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
324             '../third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h',
325             '../third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h',
326             '../third_party/skia/src/opts/SkBlitMask_opts_arm_neon.cpp',
327             '../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
328             '../third_party/skia/src/opts/SkBlurImage_opts_neon.cpp',
329             '../third_party/skia/src/opts/SkMorphology_opts_neon.cpp',
330             '../third_party/skia/src/opts/SkTextureCompression_opts_neon.cpp',
331             '../third_party/skia/src/opts/SkXfermode_opts_arm_neon.cpp',
332             '../third_party/skia/src/opts/memset16_neon.S',
333             '../third_party/skia/src/opts/memset32_neon.S',
334           ],
335           'conditions': [
336             ['arm_neon == 1', {
337               'defines': [
338                 '__ARM_HAVE_NEON',
339               ],
340             }],
341             ['arm_neon_optional == 1', {
342               'defines': [
343                 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
344               ],
345             }],
346           ],
347         },
348       ],
349     }],
350   ],