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    'neon_sources': [
8      'dsp/dec_neon.c',
9      'dsp/enc_neon.c',
10      'dsp/lossless_neon.c',
11      'dsp/upsampling_neon.c',
12    ]
13  },
14  'targets': [
15    {
16      'target_name': 'libwebp_dec',
17      'type': 'static_library',
18      'dependencies' : [
19        'libwebp_dsp',
20        'libwebp_dsp_neon',
21        'libwebp_utils',
22      ],
23      'include_dirs': ['.'],
24      'sources': [
25        'dec/alpha.c',
26        'dec/buffer.c',
27        'dec/frame.c',
28        'dec/idec.c',
29        'dec/io.c',
30        'dec/quant.c',
31        'dec/tree.c',
32        'dec/vp8.c',
33        'dec/vp8l.c',
34        'dec/webp.c',
35      ],
36    },
37    {
38      'target_name': 'libwebp_demux',
39      'type': 'static_library',
40      'include_dirs': ['.'],
41      'sources': [
42        'demux/demux.c',
43      ],
44    },
45    {
46      'target_name': 'libwebp_dsp',
47      'type': 'static_library',
48      'include_dirs': ['.'],
49      'sources': [
50        'dsp/alpha_processing.c',
51        'dsp/cpu.c',
52        'dsp/dec.c',
53        'dsp/dec_clip_tables.c',
54        'dsp/dec_mips32.c',
55        'dsp/dec_sse2.c',
56        'dsp/enc.c',
57        'dsp/enc_avx2.c',
58        'dsp/enc_mips32.c',
59        'dsp/enc_sse2.c',
60        'dsp/lossless.c',
61        'dsp/lossless_mips32.c',
62        'dsp/lossless_sse2.c',
63        'dsp/upsampling.c',
64        'dsp/upsampling_sse2.c',
65        'dsp/yuv.c',
66        'dsp/yuv_mips32.c',
67        'dsp/yuv_sse2.c',
68      ],
69      'conditions': [
70        ['OS == "android"', {
71          'includes': [ '../../build/android/cpufeatures.gypi' ],
72        }],
73        ['order_profiling != 0', {
74          'target_conditions' : [
75            ['_toolset=="target"', {
76              'cflags!': [ '-finstrument-functions' ],
77            }],
78          ],
79        }],
80      ],
81    },
82    {
83      'target_name': 'libwebp_dsp_neon',
84      'conditions': [
85        ['target_arch == "arm" and arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
86          'type': 'static_library',
87          'include_dirs': ['.'],
88          'sources': [
89            '<@(neon_sources)'
90          ],
91          # behavior similar to *.c.neon in an Android.mk
92          'cflags!': [ '-mfpu=vfpv3-d16' ],
93          'cflags': [ '-mfpu=neon' ],
94        },{
95          'conditions': [
96            ['target_arch == "arm64"', {
97              'type': 'static_library',
98              'include_dirs': ['.'],
99              'sources': [
100                '<@(neon_sources)'
101              ],
102              # avoid an ICE with gcc-4.9: b/15574841
103              'cflags': [ '-frename-registers' ],
104            },{  # "target_arch != "arm|arm64" or arm_version < 7"
105              'type': 'none',
106            }],
107          ],
108        }],
109        ['order_profiling != 0', {
110          'target_conditions' : [
111            ['_toolset=="target"', {
112              'cflags!': [ '-finstrument-functions' ],
113            }],
114          ],
115        }],
116      ],
117    },
118    {
119      'target_name': 'libwebp_enc',
120      'type': 'static_library',
121      'include_dirs': ['.'],
122      'sources': [
123        'enc/alpha.c',
124        'enc/analysis.c',
125        'enc/backward_references.c',
126        'enc/config.c',
127        'enc/cost.c',
128        'enc/filter.c',
129        'enc/frame.c',
130        'enc/histogram.c',
131        'enc/iterator.c',
132        'enc/picture.c',
133        'enc/picture_csp.c',
134        'enc/picture_psnr.c',
135        'enc/picture_rescale.c',
136        'enc/picture_tools.c',
137        'enc/quant.c',
138        'enc/syntax.c',
139        'enc/token.c',
140        'enc/tree.c',
141        'enc/vp8l.c',
142        'enc/webpenc.c',
143      ],
144    },
145    {
146      'target_name': 'libwebp_utils',
147      'type': 'static_library',
148      'include_dirs': ['.'],
149      'sources': [
150        'utils/bit_reader.c',
151        'utils/bit_writer.c',
152        'utils/color_cache.c',
153        'utils/filters.c',
154        'utils/huffman.c',
155        'utils/huffman_encode.c',
156        'utils/quant_levels.c',
157        'utils/quant_levels_dec.c',
158        'utils/random.c',
159        'utils/rescaler.c',
160        'utils/thread.c',
161        'utils/utils.c',
162      ],
163    },
164    {
165      'target_name': 'libwebp',
166      'type': 'none',
167      'dependencies' : [
168        'libwebp_dec',
169        'libwebp_demux',
170        'libwebp_dsp',
171        'libwebp_dsp_neon',
172        'libwebp_enc',
173        'libwebp_utils',
174      ],
175      'direct_dependent_settings': {
176        'include_dirs': ['.'],
177      },
178      'conditions': [
179        ['OS!="win"', {'product_name': 'webp'}],
180      ],
181    },
182  ],
183}
184