Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / third_party / libwebp / BUILD.gn
blob3259ec3fd0e8dacb5de447b434c66f7ee99f3470
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 source_set("libwebp_utils") {
166   sources = [
167     "utils/bit_reader.c",
168     "utils/bit_writer.c",
169     "utils/color_cache.c",
170     "utils/filters.c",
171     "utils/huffman.c",
172     "utils/huffman_encode.c",
173     "utils/quant_levels.c",
174     "utils/quant_levels_dec.c",
175     "utils/random.c",
176     "utils/rescaler.c",
177     "utils/thread.c",
178     "utils/utils.c",
179   ]
180   configs -= [ "//build/config/compiler:chromium_code" ]
181   configs += [ "//build/config/compiler:no_chromium_code" ]
183   all_dependent_configs = [ ":libwebp_config" ]
185   config("libwebp_utils_warnings") {
186     if (is_clang) {
187       # See https://code.google.com/p/webp/issues/detail?id=253.
188       cflags = [ "-Wno-incompatible-pointer-types" ]
189     }
190   }
191   public_configs = [ ":libwebp_utils_warnings" ]
194 group("libwebp") {
195   deps = [
196     ":libwebp_dec",
197     ":libwebp_demux",
198     ":libwebp_dsp",
199     ":libwebp_enc",
200     ":libwebp_utils",
201   ]
202   public_configs = [ ":libwebp_config" ]
203   if (use_dsp_neon) {
204     deps += [ ":libwebp_dsp_neon" ]
205   }