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