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

Side by Side Diff: BUILD.gn

Issue 2292343003: GN: add sources_when_disabled to optional (Closed)
Patch Set: Created 4 years, 3 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 | tools/fiddle/fiddle_main.cpp » ('j') | 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_enable_tools = !is_fuchsia && !is_component_build 7 skia_enable_tools = !is_fuchsia && !is_component_build
8 8
9 skia_use_expat = true 9 skia_use_expat = true
10 skia_use_fontconfig = is_linux 10 skia_use_fontconfig = is_linux
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 opts("dsp") { 232 opts("dsp") {
233 enabled = current_cpu == "mipsel" 233 enabled = current_cpu == "mipsel"
234 sources = opts_gypi.mips_dsp_sources 234 sources = opts_gypi.mips_dsp_sources
235 cflags = [] 235 cflags = []
236 } 236 }
237 237
238 # Any feature of Skia that requires third-party code should be optional and use this template. 238 # Any feature of Skia that requires third-party code should be optional and use this template.
239 template("optional") { 239 template("optional") {
240 if (invoker.enabled) { 240 if (invoker.enabled) {
241 config(target_name + "_public") { 241 config(target_name + "_public") {
242 defines = invoker.public_defines 242 if (defined(invoker.public_defines)) {
243 defines = invoker.public_defines
244 }
243 } 245 }
244 source_set(target_name) { 246 source_set(target_name) {
245 forward_variables_from(invoker, "*", [ "public_defines" ]) 247 forward_variables_from(invoker,
248 "*",
249 [
250 "public_defines",
251 "sources_when_disabled",
252 ])
246 all_dependent_configs = [ ":" + target_name + "_public" ] 253 all_dependent_configs = [ ":" + target_name + "_public" ]
247 configs += skia_library_configs 254 configs += skia_library_configs
248 } 255 }
249 } else { 256 } else {
250 # If not enabled, a phony empty target that swallows all otherwise unused va riables.
251 source_set(target_name) { 257 source_set(target_name) {
252 forward_variables_from(invoker, 258 forward_variables_from(invoker,
253 "*", 259 "*",
254 [ 260 [
255 "public_defines", 261 "public_defines",
256 "deps", 262 "deps",
257 "sources", 263 "sources",
264 "sources_when_disabled",
258 ]) 265 ])
266 if (defined(invoker.sources_when_disabled)) {
267 sources = invoker.sources_when_disabled
268 }
269 configs += skia_library_configs
259 } 270 }
260 } 271 }
261 } 272 }
262 273
263 optional("fontmgr_android") { 274 optional("fontmgr_android") {
264 enabled = fontmgr_android_enabled 275 enabled = fontmgr_android_enabled
265 public_defines = []
266 276
267 deps = [ 277 deps = [
268 "//third_party/expat", 278 "//third_party/expat",
269 "//third_party/freetype2", 279 "//third_party/freetype2",
270 ] 280 ]
271 sources = [ 281 sources = [
272 "src/ports/SkFontMgr_android.cpp", 282 "src/ports/SkFontMgr_android.cpp",
273 "src/ports/SkFontMgr_android_factory.cpp", 283 "src/ports/SkFontMgr_android_factory.cpp",
274 "src/ports/SkFontMgr_android_parser.cpp", 284 "src/ports/SkFontMgr_android_parser.cpp",
275 ] 285 ]
276 } 286 }
277 287
278 optional("fontmgr_fontconfig") { 288 optional("fontmgr_fontconfig") {
279 enabled = skia_use_freetype && skia_use_fontconfig 289 enabled = skia_use_freetype && skia_use_fontconfig
280 public_defines = []
281 290
282 deps = [ 291 deps = [
283 "//third_party:fontconfig", 292 "//third_party:fontconfig",
284 "//third_party/freetype2", 293 "//third_party/freetype2",
285 ] 294 ]
286 sources = [ 295 sources = [
287 "src/ports/SkFontConfigInterface_direct.cpp", 296 "src/ports/SkFontConfigInterface_direct.cpp",
288 "src/ports/SkFontConfigInterface_direct_factory.cpp", 297 "src/ports/SkFontConfigInterface_direct_factory.cpp",
289 "src/ports/SkFontMgr_FontConfigInterface.cpp", 298 "src/ports/SkFontMgr_FontConfigInterface.cpp",
290 "src/ports/SkFontMgr_fontconfig.cpp", 299 "src/ports/SkFontMgr_fontconfig.cpp",
(...skipping 24 matching lines...) Expand all
315 "src/codec/SkJpegCodec.cpp", 324 "src/codec/SkJpegCodec.cpp",
316 "src/codec/SkJpegDecoderMgr.cpp", 325 "src/codec/SkJpegDecoderMgr.cpp",
317 "src/codec/SkJpegUtility.cpp", 326 "src/codec/SkJpegUtility.cpp",
318 "src/images/SkJPEGImageEncoder.cpp", 327 "src/images/SkJPEGImageEncoder.cpp",
319 "src/images/SkJPEGWriteUtility.cpp", 328 "src/images/SkJPEGWriteUtility.cpp",
320 ] 329 ]
321 } 330 }
322 331
323 optional("pdf") { 332 optional("pdf") {
324 enabled = skia_use_zlib 333 enabled = skia_use_zlib
325 public_defines = []
326 334
327 deps = [ 335 deps = [
328 "//third_party/zlib", 336 "//third_party/zlib",
329 ] 337 ]
330 sources = pdf_gypi.sources 338 sources = pdf_gypi.sources
339 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
331 340
332 if (skia_use_sfntly) { 341 if (skia_use_sfntly) {
333 deps += [ "//third_party/sfntly" ] 342 deps += [ "//third_party/sfntly" ]
334 public_defines += [ "SK_PDF_USE_SFNTLY" ] 343 public_defines = [ "SK_PDF_USE_SFNTLY" ]
335 } 344 }
336 } 345 }
337 346
338 optional("png") { 347 optional("png") {
339 enabled = skia_use_libpng 348 enabled = skia_use_libpng
340 public_defines = [ "SK_HAS_PNG_LIBRARY" ] 349 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
341 350
342 deps = [ 351 deps = [
343 "//third_party/libpng", 352 "//third_party/libpng",
344 ] 353 ]
345 sources = [ 354 sources = [
346 "src/codec/SkIcoCodec.cpp", 355 "src/codec/SkIcoCodec.cpp",
347 "src/codec/SkPngCodec.cpp", 356 "src/codec/SkPngCodec.cpp",
348 "src/images/SkPNGImageEncoder.cpp", 357 "src/images/SkPNGImageEncoder.cpp",
349 ] 358 ]
350 } 359 }
351 360
352 optional("typeface_freetype") { 361 optional("typeface_freetype") {
353 enabled = skia_use_freetype 362 enabled = skia_use_freetype
354 public_defines = []
355 363
356 deps = [ 364 deps = [
357 "//third_party/freetype2", 365 "//third_party/freetype2",
358 ] 366 ]
359 sources = [ 367 sources = [
360 "src/ports/SkFontHost_FreeType.cpp", 368 "src/ports/SkFontHost_FreeType.cpp",
361 "src/ports/SkFontHost_FreeType_common.cpp", 369 "src/ports/SkFontHost_FreeType_common.cpp",
362 ] 370 ]
363 } 371 }
364 372
365 optional("webp") { 373 optional("webp") {
366 enabled = skia_use_libwebp 374 enabled = skia_use_libwebp
367 public_defines = [ "SK_HAS_WEBP_LIBRARY" ] 375 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
368 376
369 deps = [ 377 deps = [
370 "//third_party/libwebp", 378 "//third_party/libwebp",
371 ] 379 ]
372 sources = [ 380 sources = [
373 "src/codec/SkWebpAdapterCodec.cpp", 381 "src/codec/SkWebpAdapterCodec.cpp",
374 "src/codec/SkWebpCodec.cpp", 382 "src/codec/SkWebpCodec.cpp",
375 "src/images/SkWEBPImageEncoder.cpp", 383 "src/images/SkWEBPImageEncoder.cpp",
376 ] 384 ]
377 } 385 }
378 386
379 optional("xml") { 387 optional("xml") {
380 enabled = skia_use_expat 388 enabled = skia_use_expat
381 public_defines = []
382 389
383 deps = [ 390 deps = [
384 "//third_party/expat", 391 "//third_party/expat",
385 ] 392 ]
386 sources = [ 393 sources = [
387 "src/xml/SkDOM.cpp", 394 "src/xml/SkDOM.cpp",
388 "src/xml/SkXMLParser.cpp", 395 "src/xml/SkXMLParser.cpp",
389 "src/xml/SkXMLWriter.cpp", 396 "src/xml/SkXMLWriter.cpp",
390 ] 397 ]
391 } 398 }
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 "tools/using_skia_and_harfbuzz.cpp", 827 "tools/using_skia_and_harfbuzz.cpp",
821 ] 828 ]
822 deps = [ 829 deps = [
823 ":skia", 830 ":skia",
824 "//third_party/harfbuzz", 831 "//third_party/harfbuzz",
825 ] 832 ]
826 testonly = true 833 testonly = true
827 } 834 }
828 } 835 }
829 } 836 }
OLDNEW
« no previous file with comments | « no previous file | tools/fiddle/fiddle_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698