blob: 4df410cbfc7692ab7a0a969e1bee7df720e7cc10 [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',
mtklein809ccf32016-05-05 10:58:39 -0700132 '../third_party/externals/libjpeg-turbo/simd/jccolor-mmx.asm',
msarett266f24a2015-11-23 11:09:14 -0800133 '../third_party/externals/libjpeg-turbo/simd/jccolor-sse2.asm',
mtklein809ccf32016-05-05 10:58:39 -0700134 '../third_party/externals/libjpeg-turbo/simd/jcgray-mmx.asm',
msarettb917e042016-05-02 10:43:22 -0700135 '../third_party/externals/libjpeg-turbo/simd/jcgray-sse2.asm',
mtklein809ccf32016-05-05 10:58:39 -0700136 '../third_party/externals/libjpeg-turbo/simd/jchuff-sse2.asm',
msarett266f24a2015-11-23 11:09:14 -0800137 '../third_party/externals/libjpeg-turbo/simd/jcsample-mmx.asm',
138 '../third_party/externals/libjpeg-turbo/simd/jcsample-sse2.asm',
mtklein809ccf32016-05-05 10:58:39 -0700139 '../third_party/externals/libjpeg-turbo/simd/jdcolor-mmx.asm',
msarett266f24a2015-11-23 11:09:14 -0800140 '../third_party/externals/libjpeg-turbo/simd/jdcolor-sse2.asm',
mtklein809ccf32016-05-05 10:58:39 -0700141 '../third_party/externals/libjpeg-turbo/simd/jdmerge-mmx.asm',
msarett266f24a2015-11-23 11:09:14 -0800142 '../third_party/externals/libjpeg-turbo/simd/jdmerge-sse2.asm',
143 '../third_party/externals/libjpeg-turbo/simd/jdsample-mmx.asm',
144 '../third_party/externals/libjpeg-turbo/simd/jdsample-sse2.asm',
145 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-3dn.asm',
146 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-sse.asm',
147 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-mmx.asm',
148 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-sse2.asm',
149 '../third_party/externals/libjpeg-turbo/simd/jfdctint-mmx.asm',
150 '../third_party/externals/libjpeg-turbo/simd/jfdctint-sse2.asm',
151 '../third_party/externals/libjpeg-turbo/simd/jidctflt-3dn.asm',
152 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse2.asm',
153 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse.asm',
154 '../third_party/externals/libjpeg-turbo/simd/jidctfst-mmx.asm',
155 '../third_party/externals/libjpeg-turbo/simd/jidctfst-sse2.asm',
156 '../third_party/externals/libjpeg-turbo/simd/jidctint-mmx.asm',
157 '../third_party/externals/libjpeg-turbo/simd/jidctint-sse2.asm',
158 '../third_party/externals/libjpeg-turbo/simd/jidctred-mmx.asm',
159 '../third_party/externals/libjpeg-turbo/simd/jidctred-sse2.asm',
mtklein809ccf32016-05-05 10:58:39 -0700160 '../third_party/externals/libjpeg-turbo/simd/jquant-3dn.asm',
msarett266f24a2015-11-23 11:09:14 -0800161 '../third_party/externals/libjpeg-turbo/simd/jquantf-sse2.asm',
162 '../third_party/externals/libjpeg-turbo/simd/jquanti-sse2.asm',
mtklein809ccf32016-05-05 10:58:39 -0700163 '../third_party/externals/libjpeg-turbo/simd/jquant-mmx.asm',
164 '../third_party/externals/libjpeg-turbo/simd/jquant-sse.asm',
msarett1c8a5872015-07-07 08:50:01 -0700165 '../third_party/externals/libjpeg-turbo/simd/jsimdcpu.asm',
166 ],
167 }],
msarettcf2a6a42015-07-21 12:01:48 -0700168 [ 'skia_arch_type == "x86_64" and (skia_os != "android" or host_os == "linux")', {
msarett1c8a5872015-07-07 08:50:01 -0700169 'sources': [
170 '../third_party/externals/libjpeg-turbo/simd/jsimd_x86_64.c',
msarett266f24a2015-11-23 11:09:14 -0800171 '../third_party/externals/libjpeg-turbo/simd/jccolor-sse2-64.asm',
172 '../third_party/externals/libjpeg-turbo/simd/jcgray-sse2-64.asm',
msarettb917e042016-05-02 10:43:22 -0700173 '../third_party/externals/libjpeg-turbo/simd/jchuff-sse2-64.asm',
msarett266f24a2015-11-23 11:09:14 -0800174 '../third_party/externals/libjpeg-turbo/simd/jcsample-sse2-64.asm',
175 '../third_party/externals/libjpeg-turbo/simd/jdcolor-sse2-64.asm',
176 '../third_party/externals/libjpeg-turbo/simd/jdmerge-sse2-64.asm',
177 '../third_party/externals/libjpeg-turbo/simd/jdsample-sse2-64.asm',
178 '../third_party/externals/libjpeg-turbo/simd/jfdctflt-sse-64.asm',
179 '../third_party/externals/libjpeg-turbo/simd/jfdctfst-sse2-64.asm',
180 '../third_party/externals/libjpeg-turbo/simd/jfdctint-sse2-64.asm',
181 '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse2-64.asm',
182 '../third_party/externals/libjpeg-turbo/simd/jidctfst-sse2-64.asm',
183 '../third_party/externals/libjpeg-turbo/simd/jidctint-sse2-64.asm',
184 '../third_party/externals/libjpeg-turbo/simd/jidctred-sse2-64.asm',
185 '../third_party/externals/libjpeg-turbo/simd/jquantf-sse2-64.asm',
186 '../third_party/externals/libjpeg-turbo/simd/jquanti-sse2-64.asm',
msarett1c8a5872015-07-07 08:50:01 -0700187 ],
188 }],
189 [ 'skia_arch_type == "arm64"', {
190 'sources': [
191 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm64.c',
192 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm64_neon.S',
193 ],
194 }],
195 [ 'skia_arch_type == "arm"', {
196 'conditions': [
mtklein809ccf32016-05-05 10:58:39 -0700197 [ 'arm_version >= 7 and arm_neon == 1', {
msarett1c8a5872015-07-07 08:50:01 -0700198 'sources': [
199 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm.c',
200 '../third_party/externals/libjpeg-turbo/simd/jsimd_arm_neon.S',
201 ],
202 }, {
203 'sources': [
204 '../third_party/externals/libjpeg-turbo/jsimd_none.c',
205 ],
206 }],
207 ],
208 }],
msarettfcaaade2015-08-11 13:32:54 -0700209 # mips simd is supported in later versions of libjpeg-turbo. If we
210 # choose to update our copy of libjpeg-turbo we can enable mips simd.
211 [ '"mips" in skia_arch_type', {
Brian Salomon4239fc22015-07-27 09:10:36 -0400212 'sources': [
213 '../third_party/externals/libjpeg-turbo/jsimd_none.c',
msarett1c8a5872015-07-07 08:50:01 -0700214 ],
215 }],
mtklein809ccf32016-05-05 10:58:39 -0700216
msarett1c8a5872015-07-07 08:50:01 -0700217 # Build rules for an asm file.
218 # On Windows, we use the precompiled yasm binary.
msarett718e41d2015-07-10 10:59:47 -0700219 # On Linux, we build our patched yasm and use it.
msarett1c8a5872015-07-07 08:50:01 -0700220 # On Mac, we always build our patched yasm and use it.
221 [ 'skia_os == "win"', {
msarett718e41d2015-07-10 10:59:47 -0700222 'dependencies': [
223 'yasm-win',
224 ],
msarett266f24a2015-11-23 11:09:14 -0800225 'defines': [
226 'TURBO_FOR_WINDOWS',
227 ],
msarett1c8a5872015-07-07 08:50:01 -0700228 'variables': {
msarett718e41d2015-07-10 10:59:47 -0700229 'yasm_path': '<(PRODUCT_DIR)/yasm.exe',
msarett1c8a5872015-07-07 08:50:01 -0700230 'conditions': [
231 [ 'skia_arch_type == "x86"', {
232 'yasm_format': '-fwin32',
233 'yasm_flags': [
234 '-D__x86__',
235 '-DWIN32',
236 '-DMSVC',
msarett1c8a5872015-07-07 08:50:01 -0700237 ],
238 }, {
239 'yasm_format': '-fwin64',
240 'yasm_flags': [
241 '-D__x86_64__',
242 '-DWIN64',
243 '-DMSVC',
msarett1c8a5872015-07-07 08:50:01 -0700244 ],
245 }],
246 ],
247 },
248 }],
msarettcf2a6a42015-07-21 12:01:48 -0700249 [ 'skia_os == "android" and host_os == "linux" and \
250 (skia_arch_type == "x86" or skia_arch_type == "x86_64")', {
251 'dependencies': [
252 'yasm.gyp:yasm#host',
253 ],
msarett1c8a5872015-07-07 08:50:01 -0700254 'variables': {
msarettcf2a6a42015-07-21 12:01:48 -0700255 'yasm_path': '<(PRODUCT_DIR)/yasm',
msarett1c8a5872015-07-07 08:50:01 -0700256 'conditions': [
257 [ 'skia_arch_type == "x86"', {
258 'yasm_format': '-felf',
259 'yasm_flags': [
260 '-D__x86__',
261 '-DELF',
msarettfd0b33d2016-05-10 14:30:07 -0700262 '-DPIC',
msarett1c8a5872015-07-07 08:50:01 -0700263 ],
264 }, {
265 'yasm_format': '-felf64',
266 'yasm_flags': [
267 '-D__x86_64__',
268 '-DELF',
msarettfd0b33d2016-05-10 14:30:07 -0700269 '-DPIC',
msarett1c8a5872015-07-07 08:50:01 -0700270 ],
271 }],
272 ],
273 },
274 }],
275 [ '(skia_os == "mac" or skia_os == "ios") and \
276 (skia_arch_type == "x86" or skia_arch_type == "x86_64")', {
277 'dependencies': [
278 'yasm.gyp:yasm#host',
279 ],
280 'variables': {
281 'yasm_path': '<(PRODUCT_DIR)/yasm',
282 'conditions': [
283 [ 'skia_arch_type == "x86"', {
284 'yasm_format': '-fmacho',
285 'yasm_flags': [
286 '-D__x86__',
287 '-DMACHO',
msarett1c8a5872015-07-07 08:50:01 -0700288 ],
289 }, {
290 'yasm_format': '-fmacho64',
291 'yasm_flags': [
292 '-D__x86_64__',
293 '-DMACHO',
msarett1c8a5872015-07-07 08:50:01 -0700294 ],
295 }],
296 ],
297 },
298 }],
299 [ '(skia_os == "linux" or skia_os == "freebsd" or skia_os == "openbsd" or \
borenet43bf5112016-04-29 14:01:34 -0700300 skia_os == "solaris")', {
msarett1c8a5872015-07-07 08:50:01 -0700301 'dependencies': [
302 'yasm.gyp:yasm#host',
303 ],
304 'variables': {
305 'yasm_path': '<(PRODUCT_DIR)/yasm',
306 'conditions': [
307 [ 'skia_arch_type == "x86"', {
308 'yasm_format': '-felf',
309 'yasm_flags': [
310 '-D__x86__',
311 '-DELF',
msarett1c8a5872015-07-07 08:50:01 -0700312 ],
313 }, {
314 'yasm_format': '-felf64',
315 'yasm_flags': [
316 '-D__x86_64__',
317 '-DELF',
msarett1c8a5872015-07-07 08:50:01 -0700318 ],
319 }],
320 ],
321 },
322 }],
323 ],
324 'rules': [
325 {
326 'rule_name': 'assemble',
327 'extension': 'asm',
328 'conditions': [
msaretta56884c2015-07-23 11:57:13 -0700329 [ '(skia_arch_type == "x86" or skia_arch_type == "x86_64") and \
330 (skia_os != "android" or host_os == "linux")', {
msarett1c8a5872015-07-07 08:50:01 -0700331 'inputs': [],
332 'outputs': [
333 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)',
334 ],
335 'action': [
336 '<(yasm_path)',
337 '<(yasm_format)',
338 '<@(yasm_flags)',
339 '-DRGBX_FILLER_0XFF',
340 '-DSTRICT_MEMORY_ACCESS',
msarett266f24a2015-11-23 11:09:14 -0800341 '-Isimd/',
msarett1c8a5872015-07-07 08:50:01 -0700342 '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)',
343 '<(RULE_INPUT_PATH)',
344 ],
345 'process_outputs_as_sources': 1,
346 'message': 'Building <(RULE_INPUT_ROOT).<(object_suffix)',
347 }],
348 ]
349 },
350 ],
351 },
352 ],
353}