blob: 407fccaff018ca1d478c4b08b9d79f93fa5a1ec0 [file] [log] [blame]
msarett1c8a5872015-07-07 08:50:01 -07001# Copyright (c) 2012 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 'xcode_settings': {
7 'SYMROOT': '<(DEPTH)/xcodebuild',
8 },
9 'variables': {
10 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/externals/libjpeg-turbo',
11 'conditions': [
12 [ 'skia_os == "win"', {
13 'object_suffix': 'obj',
14 }, {
15 'object_suffix': 'o',
16 }],
17 ],
18 },
19 'targets': [
20 {
msarett718e41d2015-07-10 10:59:47 -070021 'target_name': 'yasm-win',
22 'type': 'executable',
23 'sources': [
24 '../third_party/externals/yasm/binaries/win/yasm.exe',
25 ],
26 'copies' : [{
27 'destination': '<(PRODUCT_DIR)',
28 'files': [ '../third_party/externals/yasm/binaries/win/yasm.exe' ],
29 }],
30 },
31 {
msarett1c8a5872015-07-07 08:50:01 -070032 'target_name': 'libjpeg-turbo',
33 'type': 'static_library',
34 'include_dirs': [
35 '../third_party/externals/libjpeg-turbo/',
36 ],
37 'defines': [
38 'WITH_SIMD',
39 'MOTION_JPEG_SUPPORTED',
40 'NO_GETENV',
41 ],
42 'cflags': [
43 '-w', # supresses warnings
44 ],
45 'msvs_settings': {
46 'VCCLCompilerTool': {
msarett718e41d2015-07-10 10:59:47 -070047 'WarningLevel': '0',
msarett1c8a5872015-07-07 08:50:01 -070048 },
49 },
50 'xcode_settings': {
51 'WARNING_CFLAGS': [
52 '-w',
53 ],
54 },
55 'sources': [
msarett1c8a5872015-07-07 08:50:01 -070056 '../third_party/externals/libjpeg-turbo/jcapimin.c',
57 '../third_party/externals/libjpeg-turbo/jcapistd.c',
msarett1c8a5872015-07-07 08:50:01 -070058 '../third_party/externals/libjpeg-turbo/jccoefct.c',
59 '../third_party/externals/libjpeg-turbo/jccolor.c',
60 '../third_party/externals/libjpeg-turbo/jcdctmgr.c',
61 '../third_party/externals/libjpeg-turbo/jchuff.c',
62 '../third_party/externals/libjpeg-turbo/jchuff.h',
63 '../third_party/externals/libjpeg-turbo/jcinit.c',
64 '../third_party/externals/libjpeg-turbo/jcmainct.c',
65 '../third_party/externals/libjpeg-turbo/jcmarker.c',
66 '../third_party/externals/libjpeg-turbo/jcmaster.c',
67 '../third_party/externals/libjpeg-turbo/jcomapi.c',
68 '../third_party/externals/libjpeg-turbo/jconfig.h',
msarett1c8a5872015-07-07 08:50:01 -070069 '../third_party/externals/libjpeg-turbo/jcparam.c',
70 '../third_party/externals/libjpeg-turbo/jcphuff.c',
71 '../third_party/externals/libjpeg-turbo/jcprepct.c',
72 '../third_party/externals/libjpeg-turbo/jcsample.c',
73 '../third_party/externals/libjpeg-turbo/jdapimin.c',
74 '../third_party/externals/libjpeg-turbo/jdapistd.c',
msarett1c8a5872015-07-07 08:50:01 -070075 '../third_party/externals/libjpeg-turbo/jdcoefct.c',
76 '../third_party/externals/libjpeg-turbo/jdcolor.c',
77 '../third_party/externals/libjpeg-turbo/jdct.h',
78 '../third_party/externals/libjpeg-turbo/jddctmgr.c',
79 '../third_party/externals/libjpeg-turbo/jdhuff.c',
80 '../third_party/externals/libjpeg-turbo/jdhuff.h',
81 '../third_party/externals/libjpeg-turbo/jdinput.c',
82 '../third_party/externals/libjpeg-turbo/jdmainct.c',
83 '../third_party/externals/libjpeg-turbo/jdmarker.c',
84 '../third_party/externals/libjpeg-turbo/jdmaster.c',
85 '../third_party/externals/libjpeg-turbo/jdmerge.c',
86 '../third_party/externals/libjpeg-turbo/jdphuff.c',
87 '../third_party/externals/libjpeg-turbo/jdpostct.c',
88 '../third_party/externals/libjpeg-turbo/jdsample.c',
89 '../third_party/externals/libjpeg-turbo/jerror.c',
90 '../third_party/externals/libjpeg-turbo/jerror.h',
91 '../third_party/externals/libjpeg-turbo/jfdctflt.c',
92 '../third_party/externals/libjpeg-turbo/jfdctfst.c',
93 '../third_party/externals/libjpeg-turbo/jfdctint.c',
94 '../third_party/externals/libjpeg-turbo/jidctflt.c',
95 '../third_party/externals/libjpeg-turbo/jidctfst.c',
96 '../third_party/externals/libjpeg-turbo/jidctint.c',
97 '../third_party/externals/libjpeg-turbo/jidctred.c',
98 '../third_party/externals/libjpeg-turbo/jinclude.h',
99 '../third_party/externals/libjpeg-turbo/jmemmgr.c',
100 '../third_party/externals/libjpeg-turbo/jmemnobs.c',
101 '../third_party/externals/libjpeg-turbo/jmemsys.h',
102 '../third_party/externals/libjpeg-turbo/jmorecfg.h',
103 '../third_party/externals/libjpeg-turbo/jpegint.h',
104 '../third_party/externals/libjpeg-turbo/jpeglib.h',
msarett1c8a5872015-07-07 08:50:01 -0700105 '../third_party/externals/libjpeg-turbo/jquant1.c',
106 '../third_party/externals/libjpeg-turbo/jquant2.c',
107 '../third_party/externals/libjpeg-turbo/jutils.c',
108 '../third_party/externals/libjpeg-turbo/jversion.h',
109 ],
110 'direct_dependent_settings': {
111 'include_dirs': [
112 '../third_party/externals/libjpeg-turbo/',
113 ],
114 },
115 'msvs_disabled_warnings': [4018, 4101],
116 # VS2010 does not correctly incrementally link obj files generated
117 # from asm files. This flag disables UseLibraryDependencyInputs to
118 # avoid this problem.
119 'msvs_2010_disable_uldi_when_referenced': 1,
msarett72394ef2015-07-09 07:55:01 -0700120
msarett1c8a5872015-07-07 08:50:01 -0700121 # Add target-specific source files.
122 'conditions': [
msarettcf2a6a42015-07-21 12:01:48 -0700123 # TODO (msarett): Is it possible to enable cross compiling for Android on other platforms?
124 [ 'skia_os == "android" and host_os != "linux" and "x86" in skia_arch_type', {
125 'sources': [
126 '../third_party/externals/libjpeg-turbo/jsimd_none.c',
127 ],
msarett72394ef2015-07-09 07:55:01 -0700128 }],
msarettcf2a6a42015-07-21 12:01:48 -0700129 [ 'skia_arch_type == "x86" and (skia_os != "android" or host_os == "linux")', {
msarett1c8a5872015-07-07 08:50:01 -0700130 'sources': [
131 '../third_party/externals/libjpeg-turbo/simd/jsimd_i386.c',
msarett266f24a2015-11-23 11:09:14 -0800132 '../third_party/externals/libjpeg-turbo/simd/jccolor-mmx.asm',
133 '../third_party/externals/libjpeg-turbo/simd/jccolor-sse2.asm',
134 '../third_party/externals/libjpeg-turbo/simd/jcgray-mmx.asm',
135 '../third_party/externals/libjpeg-turbo/simd/jcgray-sse2.asm',
136 '../third_party/externals/libjpeg-turbo/simd/jcsample-mmx.asm',
137 '../third_party/externals/libjpeg-turbo/simd/jcsample-sse2.asm',
138 '../third_party/externals/libjpeg-turbo/simd/jdcolor-mmx.asm',
139 '../third_party/externals/libjpeg-turbo/simd/jdcolor-sse2.asm',
140 '../third_party/externals/libjpeg-turbo/simd/jdmerge-mmx.asm',
141 '../third_party/externals/libjpeg-turbo/simd/jdmerge-sse2.asm',
142 '../third_party/externals/libjpeg-turbo/simd/jdsample-mmx.asm',
143 '../third_party/externals/libjpeg-turbo/simd/jdsample-sse2.asm',
144 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-3dn.asm',
145 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-sse.asm',
146 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-mmx.asm',
147 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-sse2.asm',
148 '../third_party/externals/libjpeg-turbo/simd/jfdctint-mmx.asm',
149 '../third_party/externals/libjpeg-turbo/simd/jfdctint-sse2.asm',
150 '../third_party/externals/libjpeg-turbo/simd/jidctflt-3dn.asm',
151 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse2.asm',
152 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse.asm',
153 '../third_party/externals/libjpeg-turbo/simd/jidctfst-mmx.asm',
154 '../third_party/externals/libjpeg-turbo/simd/jidctfst-sse2.asm',
155 '../third_party/externals/libjpeg-turbo/simd/jidctint-mmx.asm',
156 '../third_party/externals/libjpeg-turbo/simd/jidctint-sse2.asm',
157 '../third_party/externals/libjpeg-turbo/simd/jidctred-mmx.asm',
158 '../third_party/externals/libjpeg-turbo/simd/jidctred-sse2.asm',
159 '../third_party/externals/libjpeg-turbo/simd/jquant-3dn.asm',
160 '../third_party/externals/libjpeg-turbo/simd/jquantf-sse2.asm',
161 '../third_party/externals/libjpeg-turbo/simd/jquanti-sse2.asm',
162 '../third_party/externals/libjpeg-turbo/simd/jquant-mmx.asm',
163 '../third_party/externals/libjpeg-turbo/simd/jquant-sse.asm',
msarett1c8a5872015-07-07 08:50:01 -0700164 '../third_party/externals/libjpeg-turbo/simd/jsimdcpu.asm',
165 ],
166 }],
msarettcf2a6a42015-07-21 12:01:48 -0700167 [ 'skia_arch_type == "x86_64" and (skia_os != "android" or host_os == "linux")', {
msarett1c8a5872015-07-07 08:50:01 -0700168 'sources': [
169 '../third_party/externals/libjpeg-turbo/simd/jsimd_x86_64.c',
msarett266f24a2015-11-23 11:09:14 -0800170 '../third_party/externals/libjpeg-turbo/simd/jccolor-sse2-64.asm',
171 '../third_party/externals/libjpeg-turbo/simd/jcgray-sse2-64.asm',
172 '../third_party/externals/libjpeg-turbo/simd/jcsample-sse2-64.asm',
173 '../third_party/externals/libjpeg-turbo/simd/jdcolor-sse2-64.asm',
174 '../third_party/externals/libjpeg-turbo/simd/jdmerge-sse2-64.asm',
175 '../third_party/externals/libjpeg-turbo/simd/jdsample-sse2-64.asm',
176 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-sse-64.asm',
177 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-sse2-64.asm',
178 '../third_party/externals/libjpeg-turbo/simd/jfdctint-sse2-64.asm',
179 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse2-64.asm',
180 '../third_party/externals/libjpeg-turbo/simd/jidctfst-sse2-64.asm',
181 '../third_party/externals/libjpeg-turbo/simd/jidctint-sse2-64.asm',
182 '../third_party/externals/libjpeg-turbo/simd/jidctred-sse2-64.asm',
183 '../third_party/externals/libjpeg-turbo/simd/jquantf-sse2-64.asm',
184 '../third_party/externals/libjpeg-turbo/simd/jquanti-sse2-64.asm',
msarett1c8a5872015-07-07 08:50:01 -0700185 ],
186 }],
187 [ 'skia_arch_type == "arm64"', {
188 'sources': [
189 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm64.c',
190 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm64_neon.S',
191 ],
192 }],
193 [ 'skia_arch_type == "arm"', {
194 'conditions': [
195 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
196 'sources': [
197 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm.c',
198 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm_neon.S',
199 ],
200 }, {
201 'sources': [
202 '../third_party/externals/libjpeg-turbo/jsimd_none.c',
203 ],
204 }],
205 ],
206 }],
msarettfcaaade2015-08-11 13:32:54 -0700207 # mips simd is supported in later versions of libjpeg-turbo. If we
208 # choose to update our copy of libjpeg-turbo we can enable mips simd.
209 [ '"mips" in skia_arch_type', {
Brian Salomon4239fc22015-07-27 09:10:36 -0400210 'sources': [
211 '../third_party/externals/libjpeg-turbo/jsimd_none.c',
msarett1c8a5872015-07-07 08:50:01 -0700212 ],
213 }],
214
215 # Build rules for an asm file.
216 # On Windows, we use the precompiled yasm binary.
msarett718e41d2015-07-10 10:59:47 -0700217 # On Linux, we build our patched yasm and use it.
msarett1c8a5872015-07-07 08:50:01 -0700218 # On Mac, we always build our patched yasm and use it.
219 [ 'skia_os == "win"', {
msarett718e41d2015-07-10 10:59:47 -0700220 'dependencies': [
221 'yasm-win',
222 ],
msarett266f24a2015-11-23 11:09:14 -0800223 'defines': [
224 'TURBO_FOR_WINDOWS',
225 ],
msarett1c8a5872015-07-07 08:50:01 -0700226 'variables': {
msarett718e41d2015-07-10 10:59:47 -0700227 'yasm_path': '<(PRODUCT_DIR)/yasm.exe',
msarett1c8a5872015-07-07 08:50:01 -0700228 'conditions': [
229 [ 'skia_arch_type == "x86"', {
230 'yasm_format': '-fwin32',
231 'yasm_flags': [
232 '-D__x86__',
233 '-DWIN32',
234 '-DMSVC',
msarett1c8a5872015-07-07 08:50:01 -0700235 ],
236 }, {
237 'yasm_format': '-fwin64',
238 'yasm_flags': [
239 '-D__x86_64__',
240 '-DWIN64',
241 '-DMSVC',
msarett1c8a5872015-07-07 08:50:01 -0700242 ],
243 }],
244 ],
245 },
246 }],
msarettcf2a6a42015-07-21 12:01:48 -0700247 [ 'skia_os == "android" and host_os == "linux" and \
248 (skia_arch_type == "x86" or skia_arch_type == "x86_64")', {
249 'dependencies': [
250 'yasm.gyp:yasm#host',
251 ],
msarett1c8a5872015-07-07 08:50:01 -0700252 'variables': {
msarettcf2a6a42015-07-21 12:01:48 -0700253 'yasm_path': '<(PRODUCT_DIR)/yasm',
msarett1c8a5872015-07-07 08:50:01 -0700254 'conditions': [
255 [ 'skia_arch_type == "x86"', {
256 'yasm_format': '-felf',
257 'yasm_flags': [
258 '-D__x86__',
259 '-DELF',
msarett1c8a5872015-07-07 08:50:01 -0700260 ],
261 }, {
262 'yasm_format': '-felf64',
263 'yasm_flags': [
264 '-D__x86_64__',
265 '-DELF',
msarett1c8a5872015-07-07 08:50:01 -0700266 ],
267 }],
268 ],
269 },
270 }],
271 [ '(skia_os == "mac" or skia_os == "ios") and \
272 (skia_arch_type == "x86" or skia_arch_type == "x86_64")', {
273 'dependencies': [
274 'yasm.gyp:yasm#host',
275 ],
276 'variables': {
277 'yasm_path': '<(PRODUCT_DIR)/yasm',
278 'conditions': [
279 [ 'skia_arch_type == "x86"', {
280 'yasm_format': '-fmacho',
281 'yasm_flags': [
282 '-D__x86__',
283 '-DMACHO',
msarett1c8a5872015-07-07 08:50:01 -0700284 ],
285 }, {
286 'yasm_format': '-fmacho64',
287 'yasm_flags': [
288 '-D__x86_64__',
289 '-DMACHO',
msarett1c8a5872015-07-07 08:50:01 -0700290 ],
291 }],
292 ],
293 },
294 }],
295 [ '(skia_os == "linux" or skia_os == "freebsd" or skia_os == "openbsd" or \
296 skia_os == "solaris" or skia_os == "chromeos")', {
297 'dependencies': [
298 'yasm.gyp:yasm#host',
299 ],
300 'variables': {
301 'yasm_path': '<(PRODUCT_DIR)/yasm',
302 'conditions': [
303 [ 'skia_arch_type == "x86"', {
304 'yasm_format': '-felf',
305 'yasm_flags': [
306 '-D__x86__',
307 '-DELF',
msarett1c8a5872015-07-07 08:50:01 -0700308 ],
309 }, {
310 'yasm_format': '-felf64',
311 'yasm_flags': [
312 '-D__x86_64__',
313 '-DELF',
msarett1c8a5872015-07-07 08:50:01 -0700314 ],
315 }],
316 ],
317 },
318 }],
319 ],
320 'rules': [
321 {
322 'rule_name': 'assemble',
323 'extension': 'asm',
324 'conditions': [
msaretta56884c2015-07-23 11:57:13 -0700325 [ '(skia_arch_type == "x86" or skia_arch_type == "x86_64") and \
326 (skia_os != "android" or host_os == "linux")', {
msarett1c8a5872015-07-07 08:50:01 -0700327 'inputs': [],
328 'outputs': [
329 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)',
330 ],
331 'action': [
332 '<(yasm_path)',
333 '<(yasm_format)',
334 '<@(yasm_flags)',
335 '-DRGBX_FILLER_0XFF',
336 '-DSTRICT_MEMORY_ACCESS',
msarett266f24a2015-11-23 11:09:14 -0800337 '-Isimd/',
msarett1c8a5872015-07-07 08:50:01 -0700338 '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)',
339 '<(RULE_INPUT_PATH)',
340 ],
341 'process_outputs_as_sources': 1,
342 'message': 'Building <(RULE_INPUT_ROOT).<(object_suffix)',
343 }],
344 ]
345 },
346 ],
347 },
348 ],
349}