Use consistent types for leb128 decoder.
[chromium-blink-merge.git] / third_party / libwebp / BUILD.gn
blob7ea5d2cb80f0f0e42d9f5414a6f15de4365479b2
1 # Copyright 2014 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.
5 import("//build/config/arm.gni")
7 config("libwebp_config") {
8   include_dirs = [ "." ]
11 use_dsp_neon = (cpu_arch == "arm64" ||
12             (cpu_arch == "arm" && arm_version >= 7 &&
13                 (arm_use_neon || arm_optionally_use_neon)))
15 source_set("libwebp_dec") {
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   ]
29   configs -= [ "//build/config/compiler:chromium_code" ]
30   configs += [ "//build/config/compiler:no_chromium_code" ]
32   deps = [
33     ":libwebp_dsp",
34     ":libwebp_utils",
35   ]
36   all_dependent_configs = [
37     ":libwebp_config"
38   ]
39   if (use_dsp_neon) {
40     deps += [ ":libwebp_dsp_neon"]
41   }
44 source_set("libwebp_demux") {
45   sources = [
46     "demux/demux.c",
47   ]
48   all_dependent_configs = [
49     ":libwebp_config"
50   ]
51   configs -= [ "//build/config/compiler:chromium_code" ]
52   configs += [ "//build/config/compiler:no_chromium_code" ]
56 source_set("libwebp_dsp") {
57   sources = [
58     "dsp/alpha_processing.c",
59     "dsp/alpha_processing_sse2.c",
60     "dsp/cpu.c",
61     "dsp/dec.c",
62     "dsp/dec_clip_tables.c",
63     "dsp/dec_mips32.c",
64     "dsp/dec_sse2.c",
65     "dsp/enc.c",
66     "dsp/enc_avx2.c",
67     "dsp/enc_mips32.c",
68     "dsp/enc_sse2.c",
69     "dsp/lossless.c",
70     "dsp/lossless_mips32.c",
71     "dsp/lossless_sse2.c",
72     "dsp/upsampling.c",
73     "dsp/upsampling_sse2.c",
74     "dsp/yuv.c",
75     "dsp/yuv_mips32.c",
76     "dsp/yuv_sse2.c",
77   ]
78   configs -= [ "//build/config/compiler:chromium_code" ]
79   configs += [ "//build/config/compiler:no_chromium_code" ]
81   all_dependent_configs = [
82     ":libwebp_config"
83   ]
84   deps = []
85   if (is_android) {
86     deps += [ "//third_party/android_tools:cpu_features" ]
87   }
88 # TODO(GYP):
89 #      'conditions': [
90 #        ['order_profiling != 0', {
91 #          'target_conditions' : [
92 #            ['_toolset=="target"', {
93 #              'cflags!': [ '-finstrument-functions' ],
94 #            }],
95 #          ],
96 #        }],
97 #      ],
100 if (use_dsp_neon) {
102 source_set("libwebp_dsp_neon") {
103   sources = [
104     "dsp/dec_neon.c",
105     "dsp/enc_neon.c",
106     "dsp/lossless_neon.c",
107     "dsp/upsampling_neon.c",
108   ]
110   include_dirs = [ "." ]
112   if (cpu_arch == "arm") {
113     # behavior similar to *.c.neon in an Android.mk
114     configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
115     cflags = [ "-mfpu=neon" ]
116   } else if (cpu_arch == "arm64") {
117     # avoid an ICE with gcc-4.9: b/15574841
118     cflags = [ "-frename-registers" ]
119   }
121 # TODO(GYP):
122 #        ['order_profiling != 0', {
123 #          'target_conditions' : [
124 #            ['_toolset=="target"', {
125 #              'cflags!': [ '-finstrument-functions' ],
126 #            }],
127 #          ],
128 #        }],
129 #      ],
130 #    }
133 }  # use_dsp_neon
135 source_set("libwebp_enc") {
136   sources = [
137     "enc/alpha.c",
138     "enc/analysis.c",
139     "enc/backward_references.c",
140     "enc/config.c",
141     "enc/cost.c",
142     "enc/filter.c",
143     "enc/frame.c",
144     "enc/histogram.c",
145     "enc/iterator.c",
146     "enc/picture.c",
147     "enc/picture_csp.c",
148     "enc/picture_psnr.c",
149     "enc/picture_rescale.c",
150     "enc/picture_tools.c",
151     "enc/quant.c",
152     "enc/syntax.c",
153     "enc/token.c",
154     "enc/tree.c",
155     "enc/vp8l.c",
156     "enc/webpenc.c",
157   ]
158   configs -= [ "//build/config/compiler:chromium_code" ]
159   configs += [ "//build/config/compiler:no_chromium_code" ]
161   all_dependent_configs = [
162     ":libwebp_config"
163   ]
166 source_set("libwebp_utils") {
167   sources = [
168     "utils/bit_reader.c",
169     "utils/bit_writer.c",
170     "utils/color_cache.c",
171     "utils/filters.c",
172     "utils/huffman.c",
173     "utils/huffman_encode.c",
174     "utils/quant_levels.c",
175     "utils/quant_levels_dec.c",
176     "utils/random.c",
177     "utils/rescaler.c",
178     "utils/thread.c",
179     "utils/utils.c",
180   ]
181   configs -= [ "//build/config/compiler:chromium_code" ]
182   configs += [ "//build/config/compiler:no_chromium_code" ]
184   all_dependent_configs = [
185     ":libwebp_config"
186   ]
189 group("libwebp") {
190   deps = [
191     ":libwebp_dec",
192     ":libwebp_demux",
193     ":libwebp_dsp",
194     ":libwebp_enc",
195     ":libwebp_utils",
196   ]
197   public_configs = [
198     ":libwebp_config"
199   ]
200   if (use_dsp_neon) {
201     deps += [ ":libwebp_dsp_neon" ]
202   }