c112c1e41b34968cdd326c5c7448794e896ee76c
[platform/framework/web/crosswalk.git] / src / third_party / libjpeg_turbo / libjpeg.gyp
1 # 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   # This file is not used when use_system_libjpeg==1. Settings for building with
7   # the system libjpeg is in third_party/libjpeg/libjpeg.gyp.
8   'variables': {
9     'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/libjpeg_turbo',
10     'conditions': [
11       [ 'OS=="win"', {
12         'object_suffix': 'obj',
13       }, {
14         'object_suffix': 'o',
15       }],
16     ],
17   },
18   'targets': [
19     {
20       'target_name': 'libjpeg',
21       'type': 'static_library',
22       'include_dirs': [
23         '.',
24       ],
25       'defines': [
26         'WITH_SIMD',
27         'MOTION_JPEG_SUPPORTED',
28         'NO_GETENV',
29       ],
30       'sources': [
31         'jcapimin.c',
32         'jcapistd.c',
33         'jccoefct.c',
34         'jccolor.c',
35         'jcdctmgr.c',
36         'jchuff.c',
37         'jchuff.h',
38         'jcinit.c',
39         'jcmainct.c',
40         'jcmarker.c',
41         'jcmaster.c',
42         'jcomapi.c',
43         'jconfig.h',
44         'jcparam.c',
45         'jcphuff.c',
46         'jcprepct.c',
47         'jcsample.c',
48         'jdapimin.c',
49         'jdapistd.c',
50         'jdatadst.c',
51         'jdatasrc.c',
52         'jdcoefct.c',
53         'jdcolor.c',
54         'jdct.h',
55         'jddctmgr.c',
56         'jdhuff.c',
57         'jdhuff.h',
58         'jdinput.c',
59         'jdmainct.c',
60         'jdmarker.c',
61         'jdmaster.c',
62         'jdmerge.c',
63         'jdphuff.c',
64         'jdpostct.c',
65         'jdsample.c',
66         'jerror.c',
67         'jerror.h',
68         'jfdctflt.c',
69         'jfdctfst.c',
70         'jfdctint.c',
71         'jidctflt.c',
72         'jidctfst.c',
73         'jidctint.c',
74         'jidctred.c',
75         'jinclude.h',
76         'jmemmgr.c',
77         'jmemnobs.c',
78         'jmemsys.h',
79         'jmorecfg.h',
80         'jpegint.h',
81         'jpeglib.h',
82         'jpeglibmangler.h',
83         'jquant1.c',
84         'jquant2.c',
85         'jutils.c',
86         'jversion.h',
87       ],
88       'direct_dependent_settings': {
89         'include_dirs': [
90           '.',
91         ],
92       },
93       'msvs_disabled_warnings': [4018, 4101],
94       # VS2010 does not correctly incrementally link obj files generated
95       # from asm files. This flag disables UseLibraryDependencyInputs to
96       # avoid this problem.
97       'msvs_2010_disable_uldi_when_referenced': 1,
98       'conditions': [
99         [ 'OS!="win"', {'product_name': 'jpeg_turbo'}],
100         # Add target-specific source files.
101         [ 'target_arch=="ia32"', {
102           'sources': [
103             'simd/jsimd_i386.c',
104             'simd/jccolmmx.asm',
105             'simd/jccolss2.asm',
106             'simd/jcgrammx.asm',
107             'simd/jcgrass2.asm',
108             'simd/jcqnt3dn.asm',
109             'simd/jcqntmmx.asm',
110             'simd/jcqnts2f.asm',
111             'simd/jcqnts2i.asm',
112             'simd/jcqntsse.asm',
113             'simd/jcsammmx.asm',
114             'simd/jcsamss2.asm',
115             'simd/jdcolmmx.asm',
116             'simd/jdcolss2.asm',
117             'simd/jdmermmx.asm',
118             'simd/jdmerss2.asm',
119             'simd/jdsammmx.asm',
120             'simd/jdsamss2.asm',
121             'simd/jf3dnflt.asm',
122             'simd/jfmmxfst.asm',
123             'simd/jfmmxint.asm',
124             'simd/jfss2fst.asm',
125             'simd/jfss2int.asm',
126             'simd/jfsseflt.asm',
127             'simd/ji3dnflt.asm',
128             'simd/jimmxfst.asm',
129             'simd/jimmxint.asm',
130             'simd/jimmxred.asm',
131             'simd/jiss2flt.asm',
132             'simd/jiss2fst.asm',
133             'simd/jiss2int.asm',
134             'simd/jiss2red.asm',
135             'simd/jisseflt.asm',
136             'simd/jsimdcpu.asm',
137           ],
138         }],
139         [ 'target_arch=="x64" and msan!=1', {
140           'sources': [
141             'simd/jsimd_x86_64.c',
142             'simd/jccolss2-64.asm',
143             'simd/jcgrass2-64.asm',
144             'simd/jcqnts2f-64.asm',
145             'simd/jcqnts2i-64.asm',
146             'simd/jcsamss2-64.asm',
147             'simd/jdcolss2-64.asm',
148             'simd/jdmerss2-64.asm',
149             'simd/jdsamss2-64.asm',
150             'simd/jfss2fst-64.asm',
151             'simd/jfss2int-64.asm',
152             'simd/jfsseflt-64.asm',
153             'simd/jiss2flt-64.asm',
154             'simd/jiss2fst-64.asm',
155             'simd/jiss2int-64.asm',
156             'simd/jiss2red-64.asm',
157           ],
158         }],
159         # MemorySanitizer doesn't support assembly code, so keep it disabled in
160         # MSan builds for now.
161         [ 'msan==1', {
162           'sources': [
163             'jsimd_none.c',
164           ],
165         }],
166         # The ARM SIMD implementation can be used for devices that support
167         # the NEON instruction set. This can safely be done dynamically by
168         # probing CPU features at runtime, if you wish.
169         [ 'target_arch=="arm"', {
170           'conditions': [
171             [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
172               'sources': [
173                 'simd/jsimd_arm.c',
174                 'simd/jsimd_arm_neon.S',
175               ],
176             }, {
177               'sources': [
178                 'jsimd_none.c',
179               ],
180             }]
181           ],
182         }],
183         [ 'target_arch=="arm64"', {
184           'sources': [
185             'jsimd_none.c',
186           ],
187         }],
188         [ 'target_arch=="mipsel"', {
189           'sources': [
190             'jsimd_none.c',
191           ],
192         }],
193
194         # Build rules for an asm file.
195         # On Windows, we use the precompiled yasm binary. On Linux, we build
196         # our patched yasm and use it except when use_system_yasm is 1. On
197         # Mac, we always build our patched yasm and use it because of
198         # <http://www.tortall.net/projects/yasm/ticket/236>.
199         [ 'OS=="win"', {
200           'variables': {
201             'yasm_path': '../yasm/binaries/win/yasm<(EXECUTABLE_SUFFIX)',
202             'conditions': [
203               [ 'target_arch=="ia32"', {
204                 'yasm_format': '-fwin32',
205                 'yasm_flags': [
206                   '-D__x86__',
207                   '-DWIN32',
208                   '-DMSVC',
209                   '-Iwin/'
210                 ],
211               }, {
212                 'yasm_format': '-fwin64',
213                 'yasm_flags': [
214                   '-D__x86_64__',
215                   '-DWIN64',
216                   '-DMSVC',
217                   '-Iwin/'
218                 ],
219               }],
220             ],
221           },
222         }],
223         [ 'OS=="mac"', {
224           'dependencies': [
225             '../yasm/yasm.gyp:yasm#host',
226           ],
227           'variables': {
228             'yasm_path': '<(PRODUCT_DIR)/yasm',
229             'conditions': [
230               [ 'target_arch=="ia32"', {
231                 'yasm_format': '-fmacho',
232                 'yasm_flags': [
233                   '-D__x86__',
234                   '-DMACHO',
235                   '-Imac/'
236                 ],
237               }, {
238                 'yasm_format': '-fmacho64',
239                 'yasm_flags': [
240                   '-D__x86_64__',
241                   '-DMACHO',
242                   '-Imac/'
243                 ],
244               }],
245             ],
246           },
247         }],
248         [ 'OS=="linux" or OS=="freebsd" or (OS=="android" and target_arch!="arm")', {
249           'conditions': [
250             [ 'use_system_yasm==0', {
251               'dependencies': [
252                 '../yasm/yasm.gyp:yasm#host',
253               ],
254             }],
255           ],
256           'variables': {
257             'conditions': [
258               [ 'use_system_yasm==1', {
259                 'yasm_path': '<!(which yasm)',
260               }, {
261                 'yasm_path': '<(PRODUCT_DIR)/yasm',
262               }],
263               [ 'target_arch=="ia32"', {
264                 'yasm_format': '-felf',
265                 'yasm_flags': [
266                   '-D__x86__',
267                   '-DELF',
268                   '-Ilinux/'
269                 ],
270               }, {
271                 'yasm_format': '-felf64',
272                 'yasm_flags': [
273                   '-D__x86_64__',
274                   '-DELF',
275                   '-Ilinux/'
276                 ],
277               }],
278             ],
279           },
280         }],
281       ],
282       'rules': [
283         {
284           'rule_name': 'assemble',
285           'extension': 'asm',
286           'conditions': [
287             [ 'target_arch!="arm"', {
288               'inputs': [ '<(yasm_path)', ],
289               'outputs': [
290                 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)',
291               ],
292               'action': [
293                 '<(yasm_path)',
294                 '<(yasm_format)',
295                 '<@(yasm_flags)',
296                 '-DRGBX_FILLER_0XFF',
297                 '-DSTRICT_MEMORY_ACCESS',
298                 '-Isimd/',
299                 '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)',
300                 '<(RULE_INPUT_PATH)',
301               ],
302               'process_outputs_as_sources': 1,
303               'message': 'Building <(RULE_INPUT_ROOT).<(object_suffix)',
304             }],
305           ]
306         },
307       ],
308     },
309   ],
310 }
311
312 # Local Variables:
313 # tab-width:2
314 # indent-tabs-mode:nil
315 # End:
316 # vim: set expandtab tabstop=2 shiftwidth=2: