Ensure low-memory renderers retry failed loads correctly.
[chromium-blink-merge.git] / third_party / libwebp / BUILD.gn
blobd52e1da7ccfa3bd6a3fe6f9947221ee2b8518aae
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 =
12     current_cpu == "arm64" || (current_cpu == "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 = [ ":libwebp_config" ]
37   if (use_dsp_neon) {
38     deps += [ ":libwebp_dsp_neon" ]
39   }
42 source_set("libwebp_demux") {
43   sources = [
44     "demux/demux.c",
45   ]
46   all_dependent_configs = [ ":libwebp_config" ]
47   configs -= [ "//build/config/compiler:chromium_code" ]
48   configs += [ "//build/config/compiler:no_chromium_code" ]
49   deps = [
50     ":libwebp_utils",
51   ]
54 source_set("libwebp_dsp") {
55   sources = [
56     "dsp/alpha_processing.c",
57     "dsp/alpha_processing_sse2.c",
58     "dsp/cpu.c",
59     "dsp/dec.c",
60     "dsp/dec_clip_tables.c",
61     "dsp/dec_mips32.c",
62     "dsp/dec_sse2.c",
63     "dsp/enc.c",
64     "dsp/enc_avx2.c",
65     "dsp/enc_mips32.c",
66     "dsp/enc_sse2.c",
67     "dsp/lossless.c",
68     "dsp/lossless_mips32.c",
69     "dsp/lossless_sse2.c",
70     "dsp/upsampling.c",
71     "dsp/upsampling_sse2.c",
72     "dsp/yuv.c",
73     "dsp/yuv_mips32.c",
74     "dsp/yuv_sse2.c",
75   ]
76   configs -= [ "//build/config/compiler:chromium_code" ]
77   configs += [ "//build/config/compiler:no_chromium_code" ]
79   all_dependent_configs = [ ":libwebp_config" ]
80   deps = [
81     ":libwebp_utils",
82   ]
83   if (is_android) {
84     deps += [ "//third_party/android_tools:cpu_features" ]
85   }
87   # TODO(GYP):
88   #      'conditions': [
89   #        ['order_profiling != 0', {
90   #          'target_conditions' : [
91   #            ['_toolset=="target"', {
92   #              'cflags!': [ '-finstrument-functions' ],
93   #            }],
94   #          ],
95   #        }],
96   #      ],
99 if (use_dsp_neon) {
100   source_set("libwebp_dsp_neon") {
101     sources = [
102       "dsp/dec_neon.c",
103       "dsp/enc_neon.c",
104       "dsp/lossless_neon.c",
105       "dsp/upsampling_neon.c",
106     ]
108     include_dirs = [ "." ]
110     if (current_cpu == "arm") {
111       # behavior similar to *.c.neon in an Android.mk
112       configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
113       cflags = [ "-mfpu=neon" ]
114     } else if (current_cpu == "arm64") {
115       # avoid an ICE with gcc-4.9: b/15574841
116       cflags = [ "-frename-registers" ]
117     }
119     # TODO(GYP):
120     #        ['order_profiling != 0', {
121     #          'target_conditions' : [
122     #            ['_toolset=="target"', {
123     #              'cflags!': [ '-finstrument-functions' ],
124     #            }],
125     #          ],
126     #        }],
127     #      ],
128     #    }
129   }
130 }  # use_dsp_neon
132 source_set("libwebp_enc") {
133   sources = [
134     "enc/alpha.c",
135     "enc/analysis.c",
136     "enc/backward_references.c",
137     "enc/config.c",
138     "enc/cost.c",
139     "enc/filter.c",
140     "enc/frame.c",
141     "enc/histogram.c",
142     "enc/iterator.c",
143     "enc/picture.c",
144     "enc/picture_csp.c",
145     "enc/picture_psnr.c",
146     "enc/picture_rescale.c",
147     "enc/picture_tools.c",
148     "enc/quant.c",
149     "enc/syntax.c",
150     "enc/token.c",
151     "enc/tree.c",
152     "enc/vp8l.c",
153     "enc/webpenc.c",
154   ]
155   configs -= [ "//build/config/compiler:chromium_code" ]
156   configs += [ "//build/config/compiler:no_chromium_code" ]
158   all_dependent_configs = [ ":libwebp_config" ]
160   deps = [
161     ":libwebp_utils",
162   ]
165 config("libwebp_utils_warnings") {
166   if (is_clang) {
167     # See https://code.google.com/p/webp/issues/detail?id=253.
168     cflags = [ "-Wno-incompatible-pointer-types" ]
169   }
172 source_set("libwebp_utils") {
173   sources = [
174     "utils/bit_reader.c",
175     "utils/bit_writer.c",
176     "utils/color_cache.c",
177     "utils/filters.c",
178     "utils/huffman.c",
179     "utils/huffman_encode.c",
180     "utils/quant_levels.c",
181     "utils/quant_levels_dec.c",
182     "utils/random.c",
183     "utils/rescaler.c",
184     "utils/thread.c",
185     "utils/utils.c",
186   ]
187   configs -= [ "//build/config/compiler:chromium_code" ]
188   configs += [ "//build/config/compiler:no_chromium_code" ]
190   all_dependent_configs = [ ":libwebp_config" ]
192   public_configs = [ ":libwebp_utils_warnings" ]
195 group("libwebp") {
196   deps = [
197     ":libwebp_dec",
198     ":libwebp_demux",
199     ":libwebp_dsp",
200     ":libwebp_enc",
201     ":libwebp_utils",
202   ]
203   public_configs = [ ":libwebp_config" ]
204   if (use_dsp_neon) {
205     deps += [ ":libwebp_dsp_neon" ]
206   }