Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / libwebp / BUILD.gn
blob5495e6460b4fdaf005c5fd8c5d9c0aced0548984
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" ]
51 source_set("libwebp_dsp") {
52   sources = [
53     "dsp/alpha_processing.c",
54     "dsp/alpha_processing_sse2.c",
55     "dsp/cpu.c",
56     "dsp/dec.c",
57     "dsp/dec_clip_tables.c",
58     "dsp/dec_mips32.c",
59     "dsp/dec_sse2.c",
60     "dsp/enc.c",
61     "dsp/enc_avx2.c",
62     "dsp/enc_mips32.c",
63     "dsp/enc_sse2.c",
64     "dsp/lossless.c",
65     "dsp/lossless_mips32.c",
66     "dsp/lossless_sse2.c",
67     "dsp/upsampling.c",
68     "dsp/upsampling_sse2.c",
69     "dsp/yuv.c",
70     "dsp/yuv_mips32.c",
71     "dsp/yuv_sse2.c",
72   ]
73   configs -= [ "//build/config/compiler:chromium_code" ]
74   configs += [ "//build/config/compiler:no_chromium_code" ]
76   all_dependent_configs = [ ":libwebp_config" ]
77   deps = []
78   if (is_android) {
79     deps += [ "//third_party/android_tools:cpu_features" ]
80   }
82   # TODO(GYP):
83   #      'conditions': [
84   #        ['order_profiling != 0', {
85   #          'target_conditions' : [
86   #            ['_toolset=="target"', {
87   #              'cflags!': [ '-finstrument-functions' ],
88   #            }],
89   #          ],
90   #        }],
91   #      ],
94 if (use_dsp_neon) {
95   source_set("libwebp_dsp_neon") {
96     sources = [
97       "dsp/dec_neon.c",
98       "dsp/enc_neon.c",
99       "dsp/lossless_neon.c",
100       "dsp/upsampling_neon.c",
101     ]
103     include_dirs = [ "." ]
105     if (current_cpu == "arm") {
106       # behavior similar to *.c.neon in an Android.mk
107       configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
108       cflags = [ "-mfpu=neon" ]
109     } else if (current_cpu == "arm64") {
110       # avoid an ICE with gcc-4.9: b/15574841
111       cflags = [ "-frename-registers" ]
112     }
114     # TODO(GYP):
115     #        ['order_profiling != 0', {
116     #          'target_conditions' : [
117     #            ['_toolset=="target"', {
118     #              'cflags!': [ '-finstrument-functions' ],
119     #            }],
120     #          ],
121     #        }],
122     #      ],
123     #    }
124   }
125 }  # use_dsp_neon
127 source_set("libwebp_enc") {
128   sources = [
129     "enc/alpha.c",
130     "enc/analysis.c",
131     "enc/backward_references.c",
132     "enc/config.c",
133     "enc/cost.c",
134     "enc/filter.c",
135     "enc/frame.c",
136     "enc/histogram.c",
137     "enc/iterator.c",
138     "enc/picture.c",
139     "enc/picture_csp.c",
140     "enc/picture_psnr.c",
141     "enc/picture_rescale.c",
142     "enc/picture_tools.c",
143     "enc/quant.c",
144     "enc/syntax.c",
145     "enc/token.c",
146     "enc/tree.c",
147     "enc/vp8l.c",
148     "enc/webpenc.c",
149   ]
150   configs -= [ "//build/config/compiler:chromium_code" ]
151   configs += [ "//build/config/compiler:no_chromium_code" ]
153   all_dependent_configs = [ ":libwebp_config" ]
156 source_set("libwebp_utils") {
157   sources = [
158     "utils/bit_reader.c",
159     "utils/bit_writer.c",
160     "utils/color_cache.c",
161     "utils/filters.c",
162     "utils/huffman.c",
163     "utils/huffman_encode.c",
164     "utils/quant_levels.c",
165     "utils/quant_levels_dec.c",
166     "utils/random.c",
167     "utils/rescaler.c",
168     "utils/thread.c",
169     "utils/utils.c",
170   ]
171   configs -= [ "//build/config/compiler:chromium_code" ]
172   configs += [ "//build/config/compiler:no_chromium_code" ]
174   all_dependent_configs = [ ":libwebp_config" ]
177 group("libwebp") {
178   deps = [
179     ":libwebp_dec",
180     ":libwebp_demux",
181     ":libwebp_dsp",
182     ":libwebp_enc",
183     ":libwebp_utils",
184   ]
185   public_configs = [ ":libwebp_config" ]
186   if (use_dsp_neon) {
187     deps += [ ":libwebp_dsp_neon" ]
188   }