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