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  'variables': {
7    'skia_warnings_as_errors': 0,
8    'conditions':[
9      ['skia_android_framework == 1', {
10        'use_system_libwebp': 1,
11      }, {
12        'use_system_libwebp%': 0,
13      }],
14    ],
15  },
16  'conditions': [
17    ['use_system_libwebp==0', {
18      'targets': [
19        {
20          'target_name': 'libwebp_dec',
21          'type': 'static_library',
22          'include_dirs': [
23              '../third_party/externals/libwebp',
24          ],
25          'sources': [
26            '../third_party/externals/libwebp/src/dec/alpha.c',
27            '../third_party/externals/libwebp/src/dec/buffer.c',
28            '../third_party/externals/libwebp/src/dec/frame.c',
29            '../third_party/externals/libwebp/src/dec/idec.c',
30            '../third_party/externals/libwebp/src/dec/io.c',
31            '../third_party/externals/libwebp/src/dec/layer.c',
32            '../third_party/externals/libwebp/src/dec/quant.c',
33            '../third_party/externals/libwebp/src/dec/tree.c',
34            '../third_party/externals/libwebp/src/dec/vp8.c',
35            '../third_party/externals/libwebp/src/dec/vp8l.c',
36            '../third_party/externals/libwebp/src/dec/webp.c',
37          ],
38          'cflags': [ '-w' ],
39          'xcode_settings': { 'WARNING_CFLAGS': [ '-w' ] },
40        },
41        {
42          'target_name': 'libwebp_demux',
43          'type': 'static_library',
44          'include_dirs': [
45              '../third_party/externals/libwebp',
46          ],
47          'sources': [
48            '../third_party/externals/libwebp/src/demux/demux.c',
49          ],
50          'cflags': [ '-w' ],
51          'xcode_settings': { 'WARNING_CFLAGS': [ '-w' ] },
52        },
53        {
54          'target_name': 'libwebp_dsp',
55          'type': 'static_library',
56          'include_dirs': [
57              '../third_party/externals/libwebp',
58          ],
59          'sources': [
60            '../third_party/externals/libwebp/src/dsp/cpu.c',
61            '../third_party/externals/libwebp/src/dsp/dec.c',
62            '../third_party/externals/libwebp/src/dsp/dec_sse2.c',
63            '../third_party/externals/libwebp/src/dsp/enc.c',
64            '../third_party/externals/libwebp/src/dsp/enc_sse2.c',
65            '../third_party/externals/libwebp/src/dsp/lossless.c',
66            '../third_party/externals/libwebp/src/dsp/upsampling.c',
67            '../third_party/externals/libwebp/src/dsp/upsampling_sse2.c',
68            '../third_party/externals/libwebp/src/dsp/yuv.c',
69          ],
70          'cflags': [ '-w' ],
71          'xcode_settings': { 'WARNING_CFLAGS': [ '-w' ] },
72          'conditions': [
73            ['skia_os == "android"', {
74              'dependencies' : [
75                'android_deps.gyp:cpu_features',
76              ],
77            }],
78          ],
79        },
80        {
81          'target_name': 'libwebp_dsp_neon',
82          'conditions': [
83            ['arm_version >= 7', {
84              'type': 'static_library',
85              'include_dirs': [
86                  '../third_party/externals/libwebp',
87              ],
88              'sources': [
89                '../third_party/externals/libwebp/src/dsp/dec_neon.c',
90                '../third_party/externals/libwebp/src/dsp/enc_neon.c',
91                '../third_party/externals/libwebp/src/dsp/upsampling_neon.c',
92              ],
93              # behavior similar dsp_neon.c.neon in an Android.mk
94              'cflags!': [
95                '-mfpu=vfpv3-d16',
96              ],
97              'cflags': [ '-mfpu=neon', '-w' ],
98            },{  # !(arm_version >= 7)
99              'type': 'none',
100            }],
101          ],
102        },
103        {
104          'target_name': 'libwebp_enc',
105          'type': 'static_library',
106          'include_dirs': [
107              '../third_party/externals/libwebp',
108          ],
109          'sources': [
110            '../third_party/externals/libwebp/src/enc/alpha.c',
111            '../third_party/externals/libwebp/src/enc/analysis.c',
112            '../third_party/externals/libwebp/src/enc/backward_references.c',
113            '../third_party/externals/libwebp/src/enc/config.c',
114            '../third_party/externals/libwebp/src/enc/cost.c',
115            '../third_party/externals/libwebp/src/enc/filter.c',
116            '../third_party/externals/libwebp/src/enc/frame.c',
117            '../third_party/externals/libwebp/src/enc/histogram.c',
118            '../third_party/externals/libwebp/src/enc/iterator.c',
119            '../third_party/externals/libwebp/src/enc/layer.c',
120            '../third_party/externals/libwebp/src/enc/picture.c',
121            '../third_party/externals/libwebp/src/enc/quant.c',
122            '../third_party/externals/libwebp/src/enc/syntax.c',
123            '../third_party/externals/libwebp/src/enc/token.c',
124            '../third_party/externals/libwebp/src/enc/tree.c',
125            '../third_party/externals/libwebp/src/enc/vp8l.c',
126            '../third_party/externals/libwebp/src/enc/webpenc.c',
127          ],
128          'cflags': [ '-w' ],
129          'xcode_settings': { 'WARNING_CFLAGS': [ '-w' ] },
130        },
131        {
132          'target_name': 'libwebp_utils',
133          'type': 'static_library',
134          'include_dirs': [
135              '../third_party/externals/libwebp',
136          ],
137          'sources': [
138            '../third_party/externals/libwebp/src/utils/bit_reader.c',
139            '../third_party/externals/libwebp/src/utils/bit_writer.c',
140            '../third_party/externals/libwebp/src/utils/color_cache.c',
141            '../third_party/externals/libwebp/src/utils/filters.c',
142            '../third_party/externals/libwebp/src/utils/huffman.c',
143            '../third_party/externals/libwebp/src/utils/huffman_encode.c',
144            '../third_party/externals/libwebp/src/utils/quant_levels.c',
145            '../third_party/externals/libwebp/src/utils/quant_levels_dec.c',
146            '../third_party/externals/libwebp/src/utils/rescaler.c',
147            '../third_party/externals/libwebp/src/utils/thread.c',
148            '../third_party/externals/libwebp/src/utils/utils.c',
149          ],
150          'cflags': [ '-w' ],
151          'xcode_settings': { 'WARNING_CFLAGS': [ '-w' ] },
152        },
153        {
154          'target_name': 'libwebp',
155          'type': 'none',
156          'dependencies' : [
157            'libwebp_dec',
158            'libwebp_demux',
159            'libwebp_dsp',
160            'libwebp_dsp_neon',
161            'libwebp_enc',
162            'libwebp_utils',
163          ],
164          'direct_dependent_settings': {
165            'include_dirs': [
166              '../third_party/externals/libwebp/src',
167            ],
168            'cflags': [ '-w' ],
169            'xcode_settings': { 'WARNING_CFLAGS': [ '-w' ] },
170          },
171          'conditions': [
172            ['OS!="win"', {'product_name': 'webp'}],
173          ],
174        },
175      ],
176    }, {
177      # use_system_libwep == 1
178      'targets': [
179        {
180          'target_name': 'libwebp',
181          'type': 'none',
182          'conditions': [
183            [ 'skia_android_framework', {
184              'direct_dependent_settings': {
185                'libraries': [
186                  'libwebp-decode.a',
187                  'libwebp-encode.a',
188                ],
189              'include_dirs': [
190                'external/webp/include',
191              ],
192              },
193            }, { # skia_android_framework == 0
194              'direct_dependent_settings': {
195                'defines': [
196                  'ENABLE_WEBP',
197                ],
198                },
199                'link_settings': {
200                  'libraries': [
201                    '-lwebp',
202                  ],
203                },
204              },
205            ],
206          ],
207        }
208      ],
209    }],
210  ],
211}
212