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