Tiny cleanUp.
[chromium-blink-merge.git] / skia / skia_library_opts.gyp
blobf71907581411d3f59e6caa7fc154349051e25a21
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       ],
39       'conditions': [
40         [ 'os_posix == 1 and OS != "mac" and OS != "android" and \
41            target_arch != "arm" and target_arch != "arm64" and \
42            target_arch != "mipsel"', {
43           'cflags': [
44             '-msse2',
45           ],
46         }],
47         [ 'target_arch != "arm" and target_arch != "mipsel" and \
48            target_arch != "arm64"', {
49           'sources': [
50             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSE2.cpp',
51             '../third_party/skia/src/opts/SkBlitRect_opts_SSE2.cpp',
52             '../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp',
53             '../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp',
54             '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
55             '../third_party/skia/src/opts/SkBitmapFilter_opts_SSE2.cpp',
56             '../third_party/skia/src/opts/SkMorphology_opts_SSE2.cpp',
57             '../third_party/skia/src/opts/SkBlurImage_opts_SSE2.cpp',
58           ],
59           'dependencies': [
60             'skia_opts_ssse3',
61           ],
62         }],
63         # TODO(rmcilroy): Add neon support for arm64 - http://crbug.com/354405
64         [ 'target_arch == "arm"', {
65           'conditions': [
66             [ 'arm_version >= 7 and arm_neon == 1', {
67               'defines': [
68                 '__ARM_HAVE_NEON',
69               ],
70             }],
71             [ 'arm_version >= 7 and arm_neon_optional == 1', {
72               'defines': [
73                 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
74               ],
75             }],
76             [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
77               'cflags': [
78                 # The neon assembly contains conditional instructions which
79                 # aren't enclosed in an IT block. The assembler complains
80                 # without this option.
81                 # See #86592.
82                 '-Wa,-mimplicit-it=always',
83               ],
84               'dependencies': [
85                 'skia_opts_neon',
86               ]
87            }],
88           ],
89           # The assembly uses the frame pointer register (r7 in Thumb/r11 in
90           # ARM), the compiler doesn't like that. Explicitly remove the
91           # -fno-omit-frame-pointer flag for Android, as that gets added to all
92           # targets via common.gypi.
93           'cflags!': [
94             '-fno-omit-frame-pointer',
95             '-marm',
96             '-mapcs-frame',
97           ],
98           'cflags': [
99             '-fomit-frame-pointer',
100           ],
101           'sources': [
102             '../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
103           ],
104         }],
105         [ 'target_arch == "arm" and (arm_version < 7 or (arm_neon == 0 and arm_neon_optional == 1))', {
106           'sources': [
107             '../third_party/skia/src/opts/memset.arm.S',
108           ],
109         }],
110         [ 'target_arch == "arm" and arm_version < 6', {
111           'sources': [
112             '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
113             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
114             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
115             '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
116             '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
117             '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
118           ],
119         }],
120         [ 'target_arch == "arm" and arm_version >= 6', {
121           'sources': [
122             '../third_party/skia/src/opts/SkBlitMask_opts_arm.cpp',
123             '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
124             '../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
125             '../third_party/skia/src/opts/SkBlurImage_opts_arm.cpp',
126             '../third_party/skia/src/opts/SkMorphology_opts_arm.cpp',
127             '../third_party/skia/src/opts/SkUtils_opts_arm.cpp',
128             '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
129           ],
130         }],
131         [ 'target_arch == "mipsel"',{
132           'cflags': [
133             '-fomit-frame-pointer',
134           ],
135           'sources': [
136             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
137             '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
138             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
139             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
140             '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
141             '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
142             '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
143           ],
144         }],
145         [ 'target_arch == "arm64"',{
146           # TODO(rmcilroy): Update this once http://crrev.com/143423004/ lands.
147           'sources': [
148             '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
149             '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
150             '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
151             '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
152             '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
153             '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
154             '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
155           ],
156         }],
157       ],
158     },
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.
163     {
164       'target_name': 'skia_opts_ssse3',
165       'type': 'static_library',
166       'includes': [
167         'skia_common.gypi',
168       ],
169       'include_dirs': [
170         '../third_party/skia/include/core',
171         '../third_party/skia/include/effects',
172         '../third_party/skia/src/core',
173       ],
174       'conditions': [
175         [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
176           'cflags': [
177             '-mssse3',
178           ],
179         }],
180         [ 'OS == "mac"', {
181           'xcode_settings': {
182             'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
183           },
184         }],
185         [ 'OS == "win"', {
186           'include_dirs': [
187             'config/win',
188           ],
189           'direct_dependent_settings': {
190             'include_dirs': [
191               'config/win',
192             ],
193           },
194         }],
195         [ 'target_arch != "arm" and target_arch != "arm64" and \
196            target_arch != "mipsel"', {
197           'sources': [
198             '../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp',
199           ],
200         }],
201       ],
202     },
203     {
204       'target_name': 'skia_opts_none',
205       'type': 'static_library',
206       'includes': [
207         'skia_common.gypi',
208       ],
209       'include_dirs': [
210         '../third_party/skia/include/core',
211         '../third_party/skia/include/effects',
212         '../third_party/skia/src/core',
213       ],
214       'sources': [
215         '../third_party/skia/src/opts/SkBitmapProcState_opts_none.cpp',
216         '../third_party/skia/src/opts/SkBlitMask_opts_none.cpp',
217         '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
218         '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
219         '../third_party/skia/src/opts/SkXfermode_opts_none.cpp',
220         '../third_party/skia/src/opts/SkMorphology_opts_none.cpp',
221         '../third_party/skia/src/opts/SkBlurImage_opts_none.cpp',
222       ],
223     },
224   ],
225   'conditions': [
226     # NEON code must be compiled with -mfpu=neon which also affects scalar
227     # code. To support dynamic NEON code paths, we need to build all
228     # NEON-specific sources in a separate static library. The situation
229     # is very similar to the SSSE3 one.
230     ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', {
231       'targets': [
232         {
233           'target_name': 'skia_opts_neon',
234           'type': 'static_library',
235           'includes': [
236             'skia_common.gypi',
237           ],
238           'include_dirs': [
239             '../third_party/skia/include/core',
240             '../third_party/skia/include/effects',
241             '../third_party/skia/src/core',
242             '../third_party/skia/src/opts',
243           ],
244           'cflags!': [
245             '-fno-omit-frame-pointer',
246             '-mfpu=vfp',  # remove them all, just in case.
247             '-mfpu=vfpv3',
248             '-mfpu=vfpv3-d16',
249           ],
250           'cflags': [
251             '-mfpu=neon',
252             '-fomit-frame-pointer',
253           ],
254           'ldflags': [
255             '-march=armv7-a',
256             '-Wl,--fix-cortex-a8',
257           ],
258           'sources': [
259             '../third_party/skia/src/opts/memset16_neon.S',
260             '../third_party/skia/src/opts/memset32_neon.S',
261             '../third_party/skia/src/opts/SkBitmapProcState_arm_neon.cpp',
262             '../third_party/skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
263             '../third_party/skia/src/opts/SkBitmapProcState_matrix_clamp_neon.h',
264             '../third_party/skia/src/opts/SkBitmapProcState_matrix_repeat_neon.h',
265             '../third_party/skia/src/opts/SkBlitMask_opts_arm_neon.cpp',
266             '../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
267             '../third_party/skia/src/opts/SkXfermode_opts_arm_neon.cpp',
268             '../third_party/skia/src/opts/SkBlurImage_opts_neon.cpp',
269             '../third_party/skia/src/opts/SkMorphology_opts_neon.cpp',
270           ],
271           'conditions': [
272             ['arm_neon == 1', {
273               'defines': [
274                 '__ARM_HAVE_NEON',
275               ],
276             }],
277             ['arm_neon_optional == 1', {
278               'defines': [
279                 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
280               ],
281             }],
282           ],
283         },
284       ],
285     }],
286   ],