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

Side by Side Diff: BUILD.gn

Issue 2356853002: GN: add skia_enable_gpu (default true) (Closed)
Patch Set: rebase 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 | infra/bots/recipe_modules/flavor/gn_flavor.py » ('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 import("gn/shared_sources.gni") 6 import("gn/shared_sources.gni")
7 7
8 declare_args() { 8 declare_args() {
9 skia_enable_tools = !is_fuchsia && !is_component_build
10
11 skia_use_expat = true 9 skia_use_expat = true
12 skia_use_fontconfig = is_linux 10 skia_use_fontconfig = is_linux
13 skia_use_freetype = is_android || is_fuchsia || is_linux 11 skia_use_freetype = is_android || is_fuchsia || is_linux
14 skia_use_giflib = !is_fuchsia 12 skia_use_giflib = !is_fuchsia
15 skia_use_libjpeg_turbo = true 13 skia_use_libjpeg_turbo = true
16 skia_use_libpng = true 14 skia_use_libpng = true
17 skia_use_libwebp = !is_fuchsia 15 skia_use_libwebp = !is_fuchsia
18 skia_use_sfntly = !is_fuchsia 16 skia_use_sfntly = !is_fuchsia
19 skia_use_vulkan = is_android && defined(ndk_api) && ndk_api >= 24 17 skia_use_vulkan = is_android && defined(ndk_api) && ndk_api >= 24
20 skia_use_zlib = true 18 skia_use_zlib = true
21 19
22 skia_enable_android_framework_defines = false 20 skia_enable_android_framework_defines = false
21 skia_enable_gpu = true
22 skia_enable_tools = !is_fuchsia
23 } 23 }
24 24
25 # Our tools require static linking (they use non-exported symbols) and GPU suppo rt (just lazy).
26 skia_enable_tools = skia_enable_tools && skia_enable_gpu && !is_component_build
27
25 fontmgr_android_enabled = skia_use_expat && skia_use_freetype 28 fontmgr_android_enabled = skia_use_expat && skia_use_freetype
26 29
27 skia_public_includes = [ 30 skia_public_includes = [
28 "include/android", 31 "include/android",
29 "include/c", 32 "include/c",
30 "include/codec", 33 "include/codec",
31 "include/config", 34 "include/config",
32 "include/core", 35 "include/core",
33 "include/effects", 36 "include/effects",
34 "include/gpu", 37 "include/gpu",
(...skipping 10 matching lines...) Expand all
45 # Skia public API, generally provided by :skia. 48 # Skia public API, generally provided by :skia.
46 config("skia_public") { 49 config("skia_public") {
47 include_dirs = skia_public_includes 50 include_dirs = skia_public_includes
48 defines = [ "SKIA_DLL" ] 51 defines = [ "SKIA_DLL" ]
49 if (is_linux) { 52 if (is_linux) {
50 defines += [ "SK_SAMPLES_FOR_X" ] 53 defines += [ "SK_SAMPLES_FOR_X" ]
51 } 54 }
52 if (skia_enable_android_framework_defines) { 55 if (skia_enable_android_framework_defines) {
53 defines += skia_android_framework_defines 56 defines += skia_android_framework_defines
54 } 57 }
58 if (!skia_enable_gpu) {
59 defines += [ "SK_SUPPORT_GPU=0" ]
60 }
55 } 61 }
56 62
57 # Skia internal APIs, used by Skia itself and a few test tools. 63 # Skia internal APIs, used by Skia itself and a few test tools.
58 config("skia_private") { 64 config("skia_private") {
59 visibility = [ ":*" ] 65 visibility = [ ":*" ]
60 66
61 include_dirs = [ 67 include_dirs = [
62 "include/private", 68 "include/private",
63 "src/c", 69 "src/c",
64 "src/codec", 70 "src/codec",
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 public_defines = [ "SK_HAS_GIF_LIBRARY" ] 293 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
288 294
289 deps = [ 295 deps = [
290 "//third_party/giflib", 296 "//third_party/giflib",
291 ] 297 ]
292 sources = [ 298 sources = [
293 "src/codec/SkGifCodec.cpp", 299 "src/codec/SkGifCodec.cpp",
294 ] 300 ]
295 } 301 }
296 302
303 optional("gpu") {
304 enabled = skia_enable_gpu
305 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
306
307 # These paths need to be absolute to match the ones produced by shared_sources .gni.
308 sources -= get_path_info([
309 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
310 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
311 ],
312 "abspath")
313 if (is_android) {
314 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
315 } else if (is_linux) {
316 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
317 } else if (is_mac) {
318 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
319 } else {
320 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
321 }
322 }
323
297 optional("jpeg") { 324 optional("jpeg") {
298 enabled = skia_use_libjpeg_turbo 325 enabled = skia_use_libjpeg_turbo
299 public_defines = [ "SK_HAS_JPEG_LIBRARY" ] 326 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
300 327
301 deps = [ 328 deps = [
302 "//third_party/libjpeg-turbo:libjpeg", 329 "//third_party/libjpeg-turbo:libjpeg",
303 ] 330 ]
304 sources = [ 331 sources = [
305 "src/codec/SkJpegCodec.cpp", 332 "src/codec/SkJpegCodec.cpp",
306 "src/codec/SkJpegDecoderMgr.cpp", 333 "src/codec/SkJpegDecoderMgr.cpp",
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 ":arm64", 420 ":arm64",
394 ":armv7", 421 ":armv7",
395 ":avx", 422 ":avx",
396 ":crc32", 423 ":crc32",
397 ":dsp", 424 ":dsp",
398 ":fontmgr_android", 425 ":fontmgr_android",
399 ":fontmgr_custom", 426 ":fontmgr_custom",
400 ":fontmgr_fontconfig", 427 ":fontmgr_fontconfig",
401 ":fontmgr_fuchsia", 428 ":fontmgr_fuchsia",
402 ":gif", 429 ":gif",
430 ":gpu",
403 ":jpeg", 431 ":jpeg",
404 ":none", 432 ":none",
405 ":pdf", 433 ":pdf",
406 ":png", 434 ":png",
407 ":sse2", 435 ":sse2",
408 ":sse41", 436 ":sse41",
409 ":sse42", 437 ":sse42",
410 ":ssse3", 438 ":ssse3",
411 ":typeface_freetype", 439 ":typeface_freetype",
412 ":vulkan", 440 ":vulkan",
413 ":webp", 441 ":webp",
414 ":xml", 442 ":xml",
415 ] 443 ]
416 444
417 sources = [] 445 sources = []
418 sources += skia_core_sources 446 sources += skia_core_sources
419 sources += skia_effects_sources 447 sources += skia_effects_sources
420 sources += skia_gpu_sources
421 sources += skia_sksl_sources 448 sources += skia_sksl_sources
422 sources += skia_utils_sources 449 sources += skia_utils_sources
423 sources += [ 450 sources += [
424 "src/android/SkBitmapRegionCodec.cpp", 451 "src/android/SkBitmapRegionCodec.cpp",
425 "src/android/SkBitmapRegionDecoder.cpp", 452 "src/android/SkBitmapRegionDecoder.cpp",
426 "src/codec/SkAndroidCodec.cpp", 453 "src/codec/SkAndroidCodec.cpp",
427 "src/codec/SkBmpCodec.cpp", 454 "src/codec/SkBmpCodec.cpp",
428 "src/codec/SkBmpMaskCodec.cpp", 455 "src/codec/SkBmpMaskCodec.cpp",
429 "src/codec/SkBmpRLECodec.cpp", 456 "src/codec/SkBmpRLECodec.cpp",
430 "src/codec/SkBmpStandardCodec.cpp", 457 "src/codec/SkBmpStandardCodec.cpp",
431 "src/codec/SkCodec.cpp", 458 "src/codec/SkCodec.cpp",
432 "src/codec/SkCodecImageGenerator.cpp", 459 "src/codec/SkCodecImageGenerator.cpp",
433 "src/codec/SkMaskSwizzler.cpp", 460 "src/codec/SkMaskSwizzler.cpp",
434 "src/codec/SkMasks.cpp", 461 "src/codec/SkMasks.cpp",
435 "src/codec/SkSampledCodec.cpp", 462 "src/codec/SkSampledCodec.cpp",
436 "src/codec/SkSampler.cpp", 463 "src/codec/SkSampler.cpp",
437 "src/codec/SkSwizzler.cpp", 464 "src/codec/SkSwizzler.cpp",
438 "src/codec/SkWbmpCodec.cpp", 465 "src/codec/SkWbmpCodec.cpp",
439 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
440 "src/images/SkImageEncoder.cpp", 466 "src/images/SkImageEncoder.cpp",
441 "src/images/SkImageEncoder_Factory.cpp", 467 "src/images/SkImageEncoder_Factory.cpp",
442 "src/images/SkKTXImageEncoder.cpp", 468 "src/images/SkKTXImageEncoder.cpp",
443 "src/ports/SkDiscardableMemory_none.cpp", 469 "src/ports/SkDiscardableMemory_none.cpp",
444 "src/ports/SkGlobalInitialization_default.cpp", 470 "src/ports/SkGlobalInitialization_default.cpp",
445 "src/ports/SkImageGenerator_skia.cpp", 471 "src/ports/SkImageGenerator_skia.cpp",
446 "src/ports/SkMemory_malloc.cpp", 472 "src/ports/SkMemory_malloc.cpp",
447 "src/ports/SkOSFile_stdio.cpp", 473 "src/ports/SkOSFile_stdio.cpp",
448 "src/sfnt/SkOTTable_name.cpp", 474 "src/sfnt/SkOTTable_name.cpp",
449 "src/sfnt/SkOTUtils.cpp", 475 "src/sfnt/SkOTUtils.cpp",
450 "src/svg/SkSVGCanvas.cpp", 476 "src/svg/SkSVGCanvas.cpp",
451 "src/svg/SkSVGDevice.cpp", 477 "src/svg/SkSVGDevice.cpp",
452 "src/utils/mac/SkStream_mac.cpp", 478 "src/utils/mac/SkStream_mac.cpp",
453 "third_party/etc1/etc1.cpp", 479 "third_party/etc1/etc1.cpp",
454 "third_party/ktx/ktx.cpp", 480 "third_party/ktx/ktx.cpp",
455 ] 481 ]
456 482
457 # These paths need to be absolute to match the ones produced by
458 # shared_sources.gni, but this file may be used from different directory
459 # locations.
460 sources -= get_path_info([
461 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
462 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
463 ],
464 "abspath")
465
466 libs = [] 483 libs = []
467 484
468 if (is_win) { 485 if (is_win) {
469 sources += [ 486 sources += [
470 "src/ports/SkDebug_win.cpp", 487 "src/ports/SkDebug_win.cpp",
471 "src/ports/SkFontHost_win.cpp", 488 "src/ports/SkFontHost_win.cpp",
472 "src/ports/SkFontMgr_win_dw.cpp", 489 "src/ports/SkFontMgr_win_dw.cpp",
473 "src/ports/SkFontMgr_win_dw_factory.cpp", 490 "src/ports/SkFontMgr_win_dw_factory.cpp",
474 "src/ports/SkImageEncoder_WIC.cpp", 491 "src/ports/SkImageEncoder_WIC.cpp",
475 "src/ports/SkImageGeneratorWIC.cpp", 492 "src/ports/SkImageGeneratorWIC.cpp",
(...skipping 11 matching lines...) Expand all
487 "src/ports/SkTLS_pthread.cpp", 504 "src/ports/SkTLS_pthread.cpp",
488 "src/xps/SkDocument_XPS_None.cpp", 505 "src/xps/SkDocument_XPS_None.cpp",
489 ] 506 ]
490 } 507 }
491 508
492 if (is_android) { 509 if (is_android) {
493 deps += [ 510 deps += [
494 "//third_party/cpu-features", 511 "//third_party/cpu-features",
495 "//third_party/expat", 512 "//third_party/expat",
496 ] 513 ]
497 sources += [ 514 sources += [ "src/ports/SkDebug_android.cpp" ]
498 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
499 "src/ports/SkDebug_android.cpp",
500 ]
501 libs += [ 515 libs += [
502 "EGL", 516 "EGL",
503 "GLESv2", 517 "GLESv2",
504 "log", 518 "log",
505 ] 519 ]
506 } 520 }
507 521
508 if (is_linux) { 522 if (is_linux) {
509 libs += [ 523 libs += [
510 "GL", 524 "GL",
511 "GLU", 525 "GLU",
512 "X11", 526 "X11",
513 ] 527 ]
514 sources += [ 528 sources += [ "src/ports/SkDebug_stdio.cpp" ]
515 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
516 "src/ports/SkDebug_stdio.cpp",
517 ]
518 } 529 }
519 530
520 if (is_mac) { 531 if (is_mac) {
521 sources += [ 532 sources += [
522 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
523 "src/ports/SkDebug_stdio.cpp", 533 "src/ports/SkDebug_stdio.cpp",
524 "src/ports/SkFontHost_mac.cpp", 534 "src/ports/SkFontHost_mac.cpp",
525 "src/ports/SkImageEncoder_CG.cpp", 535 "src/ports/SkImageEncoder_CG.cpp",
526 "src/ports/SkImageGeneratorCG.cpp", 536 "src/ports/SkImageGeneratorCG.cpp",
527 ] 537 ]
528 libs += [ 538 libs += [
529 "ApplicationServices.framework", 539 "ApplicationServices.framework",
530 "OpenGL.framework", 540 "OpenGL.framework",
531 ] 541 ]
532 } 542 }
533 543
534 if (is_fuchsia) { 544 if (is_fuchsia) {
535 sources += [ 545 sources += [ "src/ports/SkDebug_stdio.cpp" ]
536 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
537 "src/ports/SkDebug_stdio.cpp",
538 ]
539 } 546 }
540 } 547 }
541 548
542 skia_h_headers = exec_script("gyp/find.py", 549 skia_h_headers = exec_script("gyp/find.py",
543 [ "*.h" ] + rebase_path(skia_public_includes), 550 [ "*.h" ] + rebase_path(skia_public_includes),
544 "list lines", 551 "list lines",
545 []) - 552 []) -
546 [ 553 [
547 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"), 554 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
548 rebase_path("include/gpu/vk/GrVkBackendContext.h"), 555 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
549 rebase_path("include/gpu/vk/GrVkDefines.h"), 556 rebase_path("include/gpu/vk/GrVkDefines.h"),
550 rebase_path("include/gpu/vk/GrVkInterface.h"), 557 rebase_path("include/gpu/vk/GrVkInterface.h"),
551 rebase_path("include/gpu/vk/GrVkTypes.h"), 558 rebase_path("include/gpu/vk/GrVkTypes.h"),
552 rebase_path("include/ports/SkFontMgr_fontconfig.h"), 559 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
553 ] 560 ]
554 561
555 action("skia.h") { 562 action("skia.h") {
556 script = "gn/echo_headers.py" 563 script = "gn/echo_headers.py"
557 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] + 564 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
558 rebase_path(skia_h_headers, target_gen_dir) 565 rebase_path(skia_h_headers, target_gen_dir)
559 outputs = [ 566 outputs = [
560 "$target_gen_dir/skia.h", 567 "$target_gen_dir/skia.h",
561 ] 568 ]
562 } 569 }
563 570
564 if (target_cpu == "x64") { 571 if (skia_enable_gpu && target_cpu == "x64") {
565 # Our bots only have 64-bit libOSMesa installed. 572 # Our bots only have 64-bit libOSMesa installed.
566 # TODO: worth fixing? 573 # TODO: worth fixing?
567 executable("fiddle") { 574 executable("fiddle") {
568 include_dirs = [ "$target_gen_dir" ] 575 include_dirs = [ "$target_gen_dir" ]
569 libs = [] 576 libs = []
570 if (is_linux) { 577 if (is_linux) {
571 libs += [ "OSMesa" ] 578 libs += [ "OSMesa" ]
572 } 579 }
573 580
574 sources = [ 581 sources = [
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 "tools/get_images_from_skps.cpp", 887 "tools/get_images_from_skps.cpp",
881 ] 888 ]
882 deps = [ 889 deps = [
883 ":flags", 890 ":flags",
884 ":skia", 891 ":skia",
885 "//third_party/jsoncpp", 892 "//third_party/jsoncpp",
886 ] 893 ]
887 testonly = true 894 testonly = true
888 } 895 }
889 } 896 }
OLDNEW
« no previous file with comments | « no previous file | infra/bots/recipe_modules/flavor/gn_flavor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698