Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: BUILD.gn

Issue 2270833003: GN: extract optional() as a template and use for giflib-dependent code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 Google Inc. 1 # Copyright 2016 Google Inc.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 declare_args() { 6 declare_args() {
7 skia_use_giflib = !is_fuchsia
7 skia_use_libwebp = !is_fuchsia 8 skia_use_libwebp = !is_fuchsia
8 } 9 }
9 10
10 skia_public_includes = [ 11 skia_public_includes = [
11 "include/android", 12 "include/android",
12 "include/c", 13 "include/c",
13 "include/codec", 14 "include/codec",
14 "include/config", 15 "include/config",
15 "include/core", 16 "include/core",
16 "include/effects", 17 "include/effects",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 "src/sfnt", 56 "src/sfnt",
56 "src/utils", 57 "src/utils",
57 "src/utils/win", 58 "src/utils/win",
58 "third_party/etc1", 59 "third_party/etc1",
59 "third_party/ktx", 60 "third_party/ktx",
60 ] 61 ]
61 62
62 defines = [ 63 defines = [
63 "SK_GAMMA_APPLY_TO_A8", 64 "SK_GAMMA_APPLY_TO_A8",
64 65
65 "SK_HAS_GIF_LIBRARY",
66 "SK_HAS_JPEG_LIBRARY", 66 "SK_HAS_JPEG_LIBRARY",
67 "SK_HAS_PNG_LIBRARY", 67 "SK_HAS_PNG_LIBRARY",
68 68
69 # TODO(halcanary): make this the default; this is the value Android uses. 69 # TODO(halcanary): make this the default; this is the value Android uses.
70 "SK_SFNTLY_SUBSETTER=\"sample/chromium/font_subsetter.h\"", 70 "SK_SFNTLY_SUBSETTER=\"sample/chromium/font_subsetter.h\"",
71 ] 71 ]
72 if (is_linux) { 72 if (is_linux) {
73 defines += [ "SK_SAMPLES_FOR_X" ] 73 defines += [ "SK_SAMPLES_FOR_X" ]
74 } 74 }
75 } 75 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 cflags = [ "-msse4.2" ] 172 cflags = [ "-msse4.2" ]
173 } 173 }
174 174
175 source_set("opts_avx") { 175 source_set("opts_avx") {
176 configs += skia_library_configs 176 configs += skia_library_configs
177 sources = opts_gypi.avx_sources 177 sources = opts_gypi.avx_sources
178 cflags = [ "-mavx" ] 178 cflags = [ "-mavx" ]
179 } 179 }
180 } 180 }
181 181
182 if (skia_use_libwebp) { 182 template("optional") {
183 config("webp_config") { 183 if (invoker.enabled) {
184 defines = [ "SK_HAS_WEBP_LIBRARY" ] 184 config(target_name + "_public") {
185 defines = invoker.public_defines
186 }
187 source_set(target_name) {
188 forward_variables_from(invoker, "*", [ "public_defines" ])
189 all_dependent_configs = [ ":" + target_name + "_public" ]
190 }
191 } else {
192 # If not enabled, a phony empty target that swallows all otherwise unused va riables.
193 source_set(target_name) {
194 forward_variables_from(invoker,
195 "*",
196 [
197 "public_defines",
198 "configs",
199 "deps",
200 "sources",
201 ])
202 }
185 } 203 }
186 source_set("webp") { 204 }
187 configs += skia_library_configs 205 set_defaults("optional") {
188 all_dependent_configs = [ ":webp_config" ] 206 configs = default_configs
189 deps = [ 207 }
190 "//third_party/libwebp", 208
191 ] 209 optional("gif") {
192 sources = [ 210 enabled = skia_use_giflib
193 "src/codec/SkWebpAdapterCodec.cpp", 211 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
194 "src/codec/SkWebpCodec.cpp", 212
195 "src/images/SkWEBPImageEncoder.cpp", 213 configs += skia_library_configs
196 ] 214 deps = [
197 } 215 "//third_party/giflib",
198 } else { 216 ]
199 source_set("webp") { 217 sources = [
200 } 218 "src/codec/SkGifCodec.cpp",
219 ]
220 }
221
222 optional("webp") {
223 enabled = skia_use_libwebp
224 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
225
226 configs += skia_library_configs
227 deps = [
228 "//third_party/libwebp",
229 ]
230 sources = [
231 "src/codec/SkWebpAdapterCodec.cpp",
232 "src/codec/SkWebpCodec.cpp",
233 "src/images/SkWEBPImageEncoder.cpp",
234 ]
201 } 235 }
202 236
203 component("skia") { 237 component("skia") {
204 public_configs = [ ":skia_public" ] 238 public_configs = [ ":skia_public" ]
205 configs += skia_library_configs 239 configs += skia_library_configs
206 240
207 deps = [ 241 deps = [
242 ":gif",
208 ":webp", 243 ":webp",
209 "//third_party/expat", 244 "//third_party/expat",
210 "//third_party/giflib",
211 "//third_party/libjpeg-turbo:libjpeg", 245 "//third_party/libjpeg-turbo:libjpeg",
212 "//third_party/libpng", 246 "//third_party/libpng",
213 "//third_party/sfntly", 247 "//third_party/sfntly",
214 "//third_party/zlib", 248 "//third_party/zlib",
215 ] 249 ]
216 if (is_x86) { 250 if (is_x86) {
217 deps += [ 251 deps += [
218 ":opts_avx", 252 ":opts_avx",
219 ":opts_sse2", 253 ":opts_sse2",
220 ":opts_sse41", 254 ":opts_sse41",
(...skipping 17 matching lines...) Expand all
238 sources += [ 272 sources += [
239 "src/android/SkBitmapRegionCodec.cpp", 273 "src/android/SkBitmapRegionCodec.cpp",
240 "src/android/SkBitmapRegionDecoder.cpp", 274 "src/android/SkBitmapRegionDecoder.cpp",
241 "src/codec/SkAndroidCodec.cpp", 275 "src/codec/SkAndroidCodec.cpp",
242 "src/codec/SkBmpCodec.cpp", 276 "src/codec/SkBmpCodec.cpp",
243 "src/codec/SkBmpMaskCodec.cpp", 277 "src/codec/SkBmpMaskCodec.cpp",
244 "src/codec/SkBmpRLECodec.cpp", 278 "src/codec/SkBmpRLECodec.cpp",
245 "src/codec/SkBmpStandardCodec.cpp", 279 "src/codec/SkBmpStandardCodec.cpp",
246 "src/codec/SkCodec.cpp", 280 "src/codec/SkCodec.cpp",
247 "src/codec/SkCodecImageGenerator.cpp", 281 "src/codec/SkCodecImageGenerator.cpp",
248 "src/codec/SkGifCodec.cpp",
249 "src/codec/SkIcoCodec.cpp", 282 "src/codec/SkIcoCodec.cpp",
250 "src/codec/SkJpegCodec.cpp", 283 "src/codec/SkJpegCodec.cpp",
251 "src/codec/SkJpegDecoderMgr.cpp", 284 "src/codec/SkJpegDecoderMgr.cpp",
252 "src/codec/SkJpegUtility.cpp", 285 "src/codec/SkJpegUtility.cpp",
253 "src/codec/SkMaskSwizzler.cpp", 286 "src/codec/SkMaskSwizzler.cpp",
254 "src/codec/SkMasks.cpp", 287 "src/codec/SkMasks.cpp",
255 "src/codec/SkPngCodec.cpp", 288 "src/codec/SkPngCodec.cpp",
256 "src/codec/SkSampledCodec.cpp", 289 "src/codec/SkSampledCodec.cpp",
257 "src/codec/SkSampler.cpp", 290 "src/codec/SkSampler.cpp",
258 "src/codec/SkSwizzler.cpp", 291 "src/codec/SkSwizzler.cpp",
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 "tools/SkShaper_harfbuzz.cpp", 658 "tools/SkShaper_harfbuzz.cpp",
626 "tools/using_skia_and_harfbuzz.cpp", 659 "tools/using_skia_and_harfbuzz.cpp",
627 ] 660 ]
628 deps = [ 661 deps = [
629 ":skia", 662 ":skia",
630 "//third_party/harfbuzz", 663 "//third_party/harfbuzz",
631 ] 664 ]
632 testonly = true 665 testonly = true
633 } 666 }
634 } 667 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698