build: On Android, disable LTO for specific targets only when targeting GCC.
[chromium-blink-merge.git] / third_party / libwebp / libwebp.gyp
blob99ce5a81b43aa9442e0c507ff5611bdb12e76384
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.
6   'targets': [
7     {
8       'target_name': 'libwebp_dec',
9       'type': 'static_library',
10       'dependencies' : [
11         'libwebp_dsp',
12         'libwebp_dsp_neon',
13         'libwebp_utils',
14       ],
15       'include_dirs': ['.'],
16       'sources': [
17         'dec/alpha.c',
18         'dec/buffer.c',
19         'dec/frame.c',
20         'dec/idec.c',
21         'dec/io.c',
22         'dec/quant.c',
23         'dec/tree.c',
24         'dec/vp8.c',
25         'dec/vp8l.c',
26         'dec/webp.c',
27       ],
28     },
29     {
30       'target_name': 'libwebp_demux',
31       'type': 'static_library',
32       'include_dirs': ['.'],
33       'sources': [
34         'demux/demux.c',
35       ],
36       'dependencies' : [
37         'libwebp_utils',
38       ],
39     },
40     {
41       'target_name': 'libwebp_dsp',
42       'type': 'static_library',
43       'include_dirs': ['.'],
44       'sources': [
45         'dsp/alpha_processing.c',
46         'dsp/alpha_processing_sse2.c',
47         'dsp/cpu.c',
48         'dsp/dec.c',
49         'dsp/dec_clip_tables.c',
50         'dsp/dec_mips32.c',
51         'dsp/dec_sse2.c',
52         'dsp/enc.c',
53         'dsp/enc_avx2.c',
54         'dsp/enc_mips32.c',
55         'dsp/enc_sse2.c',
56         'dsp/lossless.c',
57         'dsp/lossless_mips32.c',
58         'dsp/lossless_sse2.c',
59         'dsp/upsampling.c',
60         'dsp/upsampling_sse2.c',
61         'dsp/yuv.c',
62         'dsp/yuv_mips32.c',
63         'dsp/yuv_sse2.c',
64       ],
65       'dependencies' : [
66         'libwebp_utils',
67       ],
68       'conditions': [
69         ['OS == "android"', {
70           'dependencies': [ '../../build/android/ndk.gyp:cpu_features' ],
71         }],
72         ['order_profiling != 0', {
73           'target_conditions' : [
74             ['_toolset=="target"', {
75               'cflags!': [ '-finstrument-functions' ],
76             }],
77           ],
78         }],
79       ],
80     },
81     {
82       'target_name': 'libwebp_dsp_neon',
83       'includes' : [
84         # Disable LTO due to Neon issues.
85         # crbug.com/408997
86         '../../build/android/disable_gcc_lto.gypi',
87       ],
88       'conditions': [
89         # iOS uses the same project to generate build project for both device
90         # and simulator and do not use "target_arch" variable. Other platform
91         # set it correctly.
92         ['OS == "ios" or (target_arch == "arm" and arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)) or (target_arch == "arm64")', {
93           'type': 'static_library',
94           'include_dirs': ['.'],
95           'sources': [
96             'dsp/dec_neon.c',
97             'dsp/enc_neon.c',
98             'dsp/lossless_neon.c',
99             'dsp/upsampling_neon.c',
100           ],
101           'conditions': [
102             ['target_arch == "arm" and arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
103               # behavior similar to *.c.neon in an Android.mk
104               'cflags!': [ '-mfpu=vfpv3-d16' ],
105               'cflags': [ '-mfpu=neon' ],
106             }],
107             ['target_arch == "arm64"', {
108               # avoid an ICE with gcc-4.9: b/15574841
109               'cflags': [ '-frename-registers' ],
110             }],
111           ]
112         }, {
113           'type': 'none',
114         }],
115         ['order_profiling != 0', {
116           'target_conditions' : [
117             ['_toolset=="target"', {
118               'cflags!': [ '-finstrument-functions' ],
119             }],
120           ],
121         }],
122       ],
123     },
124     {
125       'target_name': 'libwebp_enc',
126       'type': 'static_library',
127       'include_dirs': ['.'],
128       'sources': [
129         'enc/alpha.c',
130         'enc/analysis.c',
131         'enc/backward_references.c',
132         'enc/config.c',
133         'enc/cost.c',
134         'enc/filter.c',
135         'enc/frame.c',
136         'enc/histogram.c',
137         'enc/iterator.c',
138         'enc/picture.c',
139         'enc/picture_csp.c',
140         'enc/picture_psnr.c',
141         'enc/picture_rescale.c',
142         'enc/picture_tools.c',
143         'enc/quant.c',
144         'enc/syntax.c',
145         'enc/token.c',
146         'enc/tree.c',
147         'enc/vp8l.c',
148         'enc/webpenc.c',
149       ],
150       'dependencies' : [
151         'libwebp_utils',
152       ],
153     },
154     {
155       'target_name': 'libwebp_utils',
156       'type': 'static_library',
157       'include_dirs': ['.'],
158       'sources': [
159         'utils/bit_reader.c',
160         'utils/bit_writer.c',
161         'utils/color_cache.c',
162         'utils/filters.c',
163         'utils/huffman.c',
164         'utils/huffman_encode.c',
165         'utils/quant_levels.c',
166         'utils/quant_levels_dec.c',
167         'utils/random.c',
168         'utils/rescaler.c',
169         'utils/thread.c',
170         'utils/utils.c',
171       ],
172       'variables': {
173         'clang_warning_flags': [
174           # See https://code.google.com/p/webp/issues/detail?id=253.
175           '-Wno-incompatible-pointer-types',
176         ]
177       },
178       'direct_dependent_settings': {
179         'variables': {
180           'clang_warning_flags': [
181             # See https://code.google.com/p/webp/issues/detail?id=253.
182             '-Wno-incompatible-pointer-types',
183           ]
184         },
185       },
186     },
187     {
188       'target_name': 'libwebp',
189       'type': 'none',
190       'dependencies' : [
191         'libwebp_dec',
192         'libwebp_demux',
193         'libwebp_dsp',
194         'libwebp_dsp_neon',
195         'libwebp_enc',
196         'libwebp_utils',
197       ],
198       'direct_dependent_settings': {
199         'include_dirs': ['.'],
200       },
201       'conditions': [
202         ['OS!="win"', {'product_name': 'webp'}],
203       ],
204     },
205   ],