1# Copyright 2016 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import("gn/flutter_defines.gni") 7import("gn/fuchsia_defines.gni") 8import("gn/shared_sources.gni") 9 10if (is_fuchsia) { 11 import("//build/vulkan/config.gni") 12} 13 14if (!defined(is_skia_standalone)) { 15 is_skia_standalone = false 16} 17is_skia_dev_build = is_skia_standalone && !is_official_build 18 19declare_args() { 20 skia_enable_flutter_defines = false 21} 22 23declare_args() { 24 skia_use_angle = false 25 skia_use_egl = false 26 skia_use_expat = true 27 skia_use_fontconfig = is_linux 28 skia_use_fonthost_mac = is_mac 29 skia_use_freetype = is_android || is_fuchsia || is_linux 30 skia_use_fixed_gamma_text = is_android 31 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows 32 skia_use_libjpeg_turbo = true 33 skia_use_libpng = true 34 skia_use_libwebp = !is_fuchsia 35 skia_use_lua = is_skia_dev_build && !is_ios 36 skia_use_opencl = false 37 skia_use_piex = !is_win 38 skia_use_wuffs = false 39 skia_use_zlib = true 40 skia_use_metal = false 41 skia_use_libheif = is_skia_dev_build 42 skia_use_x11 = is_linux 43 44 skia_android_serial = "" 45 skia_enable_ccpr = true 46 skia_enable_nvpr = !skia_enable_flutter_defines 47 skia_enable_discrete_gpu = true 48 skia_enable_gpu = true 49 skia_enable_nima = false 50 skia_enable_pdf = true 51 skia_enable_spirv_validation = is_skia_dev_build && is_debug 52 skia_enable_skpicture = true 53 skia_enable_tools = is_skia_dev_build 54 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug 55 skia_qt_path = getenv("QT_PATH") 56 skia_compile_processors = false 57 skia_generate_workarounds = false 58 skia_lex = false 59 60 skia_skqp_global_error_tolerance = 0 61 62 skia_llvm_path = "" 63 skia_llvm_lib = "LLVM" 64 65 skia_tools_require_resources = false 66} 67declare_args() { 68 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib 69 skia_use_sfntly = skia_use_icu 70 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu 71 skia_enable_fontmgr_empty = false 72 skia_enable_fontmgr_custom = 73 is_linux && skia_use_freetype && !skia_use_fontconfig 74 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype 75 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype 76 skia_enable_fontmgr_fuchsia = is_fuchsia 77 78 if (is_android) { 79 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24 80 } else if (is_fuchsia) { 81 skia_use_vulkan = fuchsia_use_vulkan 82 } else { 83 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != "" 84 } 85 86 if (is_ios) { 87 skia_ios_identity = ".*Google.*" 88 skia_ios_profile = "Google Development" 89 } 90} 91 92if (defined(skia_settings)) { 93 import(skia_settings) 94} 95 96# Our tools require static linking (they use non-exported symbols), and the GPU backend. 97skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu 98 99skia_public_includes = [ 100 "include/android", 101 "include/c", 102 "include/codec", 103 "include/config", 104 "include/core", 105 "include/docs", 106 "include/effects", 107 "include/encode", 108 "include/gpu", 109 "include/atlastext", 110 "include/pathops", 111 "include/ports", 112 "include/svg", 113 "include/utils", 114 "include/utils/mac", 115] 116 117if (skia_enable_atlas_text) { 118 skia_public_includes += [ "include/atlastext" ] 119} 120 121# Skia public API, generally provided by :skia. 122config("skia_public") { 123 include_dirs = skia_public_includes 124 defines = [] 125 if (is_component_build) { 126 defines += [ "SKIA_DLL" ] 127 } 128 if (is_fuchsia || is_linux) { 129 defines += [ "SK_SAMPLES_FOR_X" ] 130 } 131 if (skia_enable_flutter_defines) { 132 defines += flutter_defines 133 } 134 if (!skia_enable_gpu) { 135 defines += [ "SK_SUPPORT_GPU=0" ] 136 } 137 if (skia_enable_atlas_text) { 138 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ] 139 } 140 if (is_fuchsia) { 141 defines += fuchsia_defines 142 } 143} 144 145# Skia internal APIs, used by Skia itself and a few test tools. 146config("skia_private") { 147 visibility = [ ":*" ] 148 149 include_dirs = [ 150 "include/private", 151 "src/c", 152 "src/codec", 153 "src/core", 154 "src/effects", 155 "src/fonts", 156 "src/image", 157 "src/images", 158 "src/lazy", 159 "src/opts", 160 "src/pathops", 161 "src/pdf", 162 "src/ports", 163 "src/sfnt", 164 "src/shaders", 165 "src/shaders/gradients", 166 "src/sksl", 167 "src/utils", 168 "src/utils/win", 169 "src/xml", 170 "third_party/etc1", 171 "third_party/gif", 172 ] 173 174 defines = [ "SK_GAMMA_APPLY_TO_A8" ] 175 if (skia_use_fixed_gamma_text) { 176 defines += [ 177 "SK_GAMMA_EXPONENT=1.4", 178 "SK_GAMMA_CONTRAST=0.0", 179 ] 180 } 181 if (is_official_build || is_android) { 182 # TODO(bsalomon): it'd be nice to make Android normal. 183 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ] 184 } 185 libs = [] 186 lib_dirs = [] 187 if (skia_enable_gpu) { 188 include_dirs += [ "src/gpu" ] 189 if (is_skia_dev_build && skia_use_vulkan) { 190 include_dirs += [ "tools/gpu/vk" ] 191 } 192 } 193 if (skia_use_angle) { 194 defines += [ "SK_ANGLE" ] 195 } 196 if (skia_enable_discrete_gpu) { 197 defines += [ "SK_ENABLE_DISCRETE_GPU" ] 198 } 199 if (!is_official_build) { 200 defines += [ "GR_TEST_UTILS=1" ] 201 } 202 if (skia_llvm_path != "") { 203 defines += [ "SK_LLVM_AVAILABLE" ] 204 include_dirs += [ "$skia_llvm_path/include" ] 205 libs += [ skia_llvm_lib ] 206 lib_dirs += [ "$skia_llvm_path/lib/" ] 207 } 208} 209 210# Any code that's linked into Skia-the-library should use this config via += skia_library_configs. 211config("skia_library") { 212 visibility = [ ":*" ] 213 defines = [ "SKIA_IMPLEMENTATION=1" ] 214} 215 216skia_library_configs = [ 217 ":skia_public", 218 ":skia_private", 219 ":skia_library", 220] 221 222# Use for CPU-specific Skia code that needs particular compiler flags. 223template("opts") { 224 visibility = [ ":*" ] 225 if (invoker.enabled) { 226 source_set(target_name) { 227 forward_variables_from(invoker, "*") 228 configs += skia_library_configs 229 } 230 } else { 231 # If not enabled, a phony empty target that swallows all otherwise unused variables. 232 source_set(target_name) { 233 forward_variables_from(invoker, 234 "*", 235 [ 236 "sources", 237 "cflags", 238 ]) 239 } 240 } 241} 242 243is_x86 = current_cpu == "x64" || current_cpu == "x86" 244 245opts("none") { 246 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64" 247 sources = skia_opts.none_sources 248 cflags = [] 249} 250 251opts("armv7") { 252 enabled = current_cpu == "arm" 253 sources = skia_opts.armv7_sources + skia_opts.neon_sources 254 cflags = [] 255} 256 257opts("arm64") { 258 enabled = current_cpu == "arm64" 259 sources = skia_opts.arm64_sources 260 cflags = [] 261} 262 263opts("crc32") { 264 enabled = current_cpu == "arm64" 265 sources = skia_opts.crc32_sources 266 cflags = [ "-march=armv8-a+crc" ] 267} 268 269opts("sse2") { 270 enabled = is_x86 271 sources = skia_opts.sse2_sources 272 if (!is_clang && is_win) { 273 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ] 274 } else { 275 cflags = [ "-msse2" ] 276 } 277} 278 279opts("ssse3") { 280 enabled = is_x86 281 sources = skia_opts.ssse3_sources 282 if (!is_clang && is_win) { 283 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ] 284 } else { 285 cflags = [ "-mssse3" ] 286 } 287} 288 289opts("sse41") { 290 enabled = is_x86 291 sources = skia_opts.sse41_sources 292 if (!is_clang && is_win) { 293 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ] 294 } else { 295 cflags = [ "-msse4.1" ] 296 } 297} 298 299opts("sse42") { 300 enabled = is_x86 301 sources = skia_opts.sse42_sources 302 if (!is_clang && is_win) { 303 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ] 304 } else { 305 cflags = [ "-msse4.2" ] 306 } 307} 308 309opts("avx") { 310 enabled = is_x86 311 sources = skia_opts.avx_sources 312 if (is_win) { 313 cflags = [ "/arch:AVX" ] 314 } else { 315 cflags = [ "-mavx" ] 316 } 317} 318 319opts("hsw") { 320 enabled = is_x86 321 sources = skia_opts.hsw_sources 322 if (is_win) { 323 cflags = [ "/arch:AVX2" ] 324 } else { 325 cflags = [ "-march=haswell" ] 326 } 327 328 # Oddly, clang-cl doesn't recognize this as a valid flag. 329 # If it ever does, it'd nice to move this up with -mavx2 and co. 330 if (is_clang && !is_win) { 331 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional, 332 # but nice to have, generating slightly better code for paths without explicit FMAs. 333 cflags += [ "-ffp-contract=fast" ] 334 } 335} 336 337# Any feature of Skia that requires third-party code should be optional and use this template. 338template("optional") { 339 visibility = [ ":*" ] 340 if (invoker.enabled) { 341 config(target_name + "_public") { 342 if (defined(invoker.public_defines)) { 343 defines = invoker.public_defines 344 } 345 if (defined(invoker.public_configs)) { 346 configs = invoker.public_configs 347 } 348 } 349 source_set(target_name) { 350 forward_variables_from(invoker, 351 "*", 352 [ 353 "public_defines", 354 "sources_when_disabled", 355 "configs_to_remove", 356 ]) 357 all_dependent_configs = [ ":" + target_name + "_public" ] 358 configs += skia_library_configs 359 if (defined(invoker.configs_to_remove)) { 360 configs -= invoker.configs_to_remove 361 } 362 } 363 } else { 364 source_set(target_name) { 365 forward_variables_from(invoker, 366 "*", 367 [ 368 "public_defines", 369 "public_deps", 370 "deps", 371 "libs", 372 "sources", 373 "sources_when_disabled", 374 "configs_to_remove", 375 ]) 376 if (defined(invoker.sources_when_disabled)) { 377 sources = invoker.sources_when_disabled 378 } 379 configs += skia_library_configs 380 } 381 } 382} 383 384optional("fontmgr_android") { 385 enabled = skia_enable_fontmgr_android 386 387 deps = [ 388 ":typeface_freetype", 389 "//third_party/expat", 390 ] 391 sources = [ 392 "src/ports/SkFontMgr_android.cpp", 393 "src/ports/SkFontMgr_android_factory.cpp", 394 "src/ports/SkFontMgr_android_parser.cpp", 395 ] 396} 397 398optional("fontmgr_custom") { 399 enabled = skia_enable_fontmgr_custom 400 401 deps = [ 402 ":typeface_freetype", 403 ] 404 sources = [ 405 "src/ports/SkFontMgr_custom.cpp", 406 "src/ports/SkFontMgr_custom.h", 407 "src/ports/SkFontMgr_custom_directory.cpp", 408 "src/ports/SkFontMgr_custom_directory_factory.cpp", 409 "src/ports/SkFontMgr_custom_embedded.cpp", 410 "src/ports/SkFontMgr_custom_empty.cpp", 411 ] 412} 413 414optional("fontmgr_wasm") { 415 enabled = target_cpu == "wasm" 416 417 deps = [ 418 ":typeface_freetype", 419 ] 420 sources = [ 421 "src/ports/SkFontMgr_custom.cpp", 422 "src/ports/SkFontMgr_custom.h", 423 "src/ports/SkFontMgr_custom_embedded.cpp", 424 "src/ports/SkFontMgr_custom_embedded_factory.cpp", 425 ] 426} 427 428optional("fontmgr_fuchsia") { 429 enabled = skia_enable_fontmgr_fuchsia 430 431 deps = [ 432 "//garnet/public/fidl/fuchsia.fonts", 433 ] 434 sources = [ 435 "src/ports/SkFontMgr_fuchsia.cpp", 436 "src/ports/SkFontMgr_fuchsia.h", 437 ] 438} 439 440optional("fontmgr_empty") { 441 enabled = skia_enable_fontmgr_empty 442 sources = [ 443 "src/ports/SkFontMgr_empty_factory.cpp", 444 ] 445} 446 447optional("fontmgr_fontconfig") { 448 enabled = skia_use_freetype && skia_use_fontconfig 449 450 deps = [ 451 ":typeface_freetype", 452 "//third_party:fontconfig", 453 ] 454 sources = [ 455 "src/ports/SkFontConfigInterface.cpp", 456 "src/ports/SkFontConfigInterface_direct.cpp", 457 "src/ports/SkFontConfigInterface_direct_factory.cpp", 458 "src/ports/SkFontMgr_FontConfigInterface.cpp", 459 "src/ports/SkFontMgr_fontconfig.cpp", 460 "src/ports/SkFontMgr_fontconfig_factory.cpp", 461 ] 462} 463 464optional("fontmgr_custom_empty") { 465 enabled = skia_enable_fontmgr_custom_empty 466 467 deps = [ 468 ":typeface_freetype", 469 ] 470 sources = [ 471 "src/ports/SkFontMgr_custom.cpp", 472 "src/ports/SkFontMgr_custom_empty.cpp", 473 "src/ports/SkFontMgr_custom_empty_factory.cpp", 474 ] 475} 476 477if (skia_lex) { 478 executable("sksllex") { 479 sources = [ 480 "src/sksl/lex/Main.cpp", 481 "src/sksl/lex/NFA.cpp", 482 "src/sksl/lex/RegexNode.cpp", 483 "src/sksl/lex/RegexParser.cpp", 484 ] 485 include_dirs = [ "src/sksl/lex" ] 486 } 487 488 action("run_sksllex") { 489 script = "gn/run_sksllex.py" 490 deps = [ 491 ":sksllex(//gn/toolchain:$host_toolchain)", 492 ] 493 sources = [ 494 "src/sksl/lex/sksl.lex", 495 ] 496 497 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a 498 # path that starts with target_out_dir and then uses ".." to back up into the src dir. 499 outputs = [ 500 "$target_out_dir/" + 501 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir), 502 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets 503 # confused due to the same file being named by two different paths 504 ] 505 sksllex_path = "$root_out_dir/" 506 sksllex_path += "sksllex" 507 if (host_os == "win") { 508 sksllex_path += ".exe" 509 } 510 args = [ 511 rebase_path(sksllex_path), 512 rebase_path("bin/clang-format"), 513 rebase_path("src"), 514 ] 515 } 516} else { 517 group("run_sksllex") { 518 } 519} 520 521if (skia_compile_processors) { 522 executable("skslc") { 523 defines = [ "SKSL_STANDALONE" ] 524 sources = [ 525 "src/sksl/SkSLMain.cpp", 526 ] 527 sources += skia_sksl_sources 528 include_dirs = [ 529 "src/gpu", 530 "src/sksl", 531 ] 532 deps = [ 533 ":run_sksllex", 534 "//third_party/spirv-tools", 535 ] 536 } 537 538 skia_gpu_processor_outputs = [] 539 foreach(src, skia_gpu_processor_sources) { 540 dir = get_path_info(src, "dir") 541 name = get_path_info(src, "name") 542 543 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a 544 # path that starts with target_out_dir and then uses ".." to back up into the src dir. 545 skia_gpu_processor_outputs += [ 546 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir), 547 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets 548 # confused due to the same file being named by two different paths 549 ] 550 } 551 552 action("create_sksl_enums") { 553 script = "gn/create_sksl_enums.py" 554 sources = [ 555 "include/private/GrSharedEnums.h", 556 ] 557 outputs = [ 558 "$target_out_dir/" + 559 rebase_path("src/sksl/sksl_enums.inc", target_out_dir), 560 ] 561 args = [ 562 rebase_path(sources[0]), 563 rebase_path(outputs[0]), 564 ] 565 } 566 567 action("compile_processors") { 568 script = "gn/compile_processors.py" 569 deps = [ 570 ":create_sksl_enums", 571 ":skslc(//gn/toolchain:$host_toolchain)", 572 ] 573 sources = skia_gpu_processor_sources 574 outputs = skia_gpu_processor_outputs 575 skslc_path = "$root_out_dir/" 576 if (host_toolchain != default_toolchain_name) { 577 skslc_path += "$host_toolchain/" 578 } 579 skslc_path += "skslc" 580 if (host_os == "win") { 581 skslc_path += ".exe" 582 } 583 args = [ 584 rebase_path(skslc_path), 585 rebase_path("bin/clang-format"), 586 ] 587 args += rebase_path(skia_gpu_processor_sources) 588 } 589} else { 590 skia_gpu_processor_outputs = [] 591 group("compile_processors") { 592 } 593} 594 595optional("gpu_for_real") { 596 enabled = skia_enable_gpu 597 deps = [ 598 ":compile_processors", 599 ":run_sksllex", 600 ] 601 if (skia_generate_workarounds) { 602 deps += [ ":workaround_list" ] 603 } 604 public_defines = [] 605 public_configs = [] 606 public_deps = [] 607 608 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs 609 if (!skia_enable_ccpr) { 610 sources -= skia_ccpr_sources 611 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ] 612 } 613 if (!skia_enable_nvpr) { 614 sources -= skia_nvpr_sources 615 sources += [ "src/gpu/GrPathRendering_none.cpp" ] 616 } 617 618 # These paths need to be absolute to match the ones produced by shared_sources.gni. 619 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ], 620 "abspath") 621 libs = [] 622 if (is_android) { 623 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ] 624 625 # this lib is required to link against AHardwareBuffer 626 if (defined(ndk_api) && ndk_api >= 26) { 627 libs += [ "android" ] 628 } 629 } else if (skia_use_egl) { 630 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ] 631 libs += [ "EGL" ] 632 } else if (is_linux && skia_use_x11) { 633 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ] 634 libs += [ "GL" ] 635 } else if (is_mac) { 636 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ] 637 } else if (is_ios) { 638 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ] 639 } else if (is_win) { 640 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ] 641 if (target_cpu != "arm64") { 642 libs += [ "OpenGL32.lib" ] 643 } 644 } else { 645 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ] 646 } 647 648 if (skia_use_vulkan) { 649 public_defines += [ "SK_VULKAN" ] 650 deps += [ "third_party/vulkanmemoryallocator" ] 651 sources += skia_vk_sources 652 if (skia_enable_vulkan_debug_layers) { 653 public_defines += [ "SK_ENABLE_VK_LAYERS" ] 654 } 655 if (is_fuchsia) { 656 public_deps += 657 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ] 658 } 659 } 660 661 if (skia_enable_spirv_validation) { 662 deps += [ "//third_party/spirv-tools" ] 663 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ] 664 } 665 666 cflags_objcc = [] 667 if (skia_use_metal) { 668 public_defines += [ "SK_METAL" ] 669 sources += skia_metal_sources 670 libs += [ "Metal.framework" ] 671 libs += [ "Foundation.framework" ] 672 cflags_objcc += [ "-fobjc-arc" ] 673 } 674 675 if (skia_enable_atlas_text) { 676 sources += skia_atlas_text_sources 677 } 678 679 if (is_debug) { 680 public_defines += [ "SK_ENABLE_DUMP_GPU" ] 681 } 682} 683 684optional("gif") { 685 enabled = !skia_use_wuffs 686 sources = [ 687 "src/codec/SkGifCodec.cpp", 688 "third_party/gif/SkGifImageReader.cpp", 689 ] 690} 691 692optional("heif") { 693 enabled = skia_use_libheif 694 public_defines = [ "SK_HAS_HEIF_LIBRARY" ] 695 696 deps = [] 697 698 sources = [ 699 "src/codec/SkHeifCodec.cpp", 700 ] 701} 702 703optional("jpeg") { 704 enabled = skia_use_libjpeg_turbo 705 public_defines = [ "SK_HAS_JPEG_LIBRARY" ] 706 707 deps = [ 708 "//third_party/libjpeg-turbo:libjpeg", 709 ] 710 public = [ 711 "include/encode/SkJpegEncoder.h", 712 ] 713 sources = [ 714 "src/codec/SkJpegCodec.cpp", 715 "src/codec/SkJpegDecoderMgr.cpp", 716 "src/codec/SkJpegUtility.cpp", 717 "src/images/SkJPEGWriteUtility.cpp", 718 "src/images/SkJpegEncoder.cpp", 719 ] 720} 721 722optional("pdf") { 723 enabled = skia_use_zlib && skia_enable_pdf 724 public_defines = [ "SK_SUPPORT_PDF" ] 725 726 deps = [ 727 "//third_party/zlib", 728 ] 729 if (skia_use_libjpeg_turbo) { 730 deps += [ ":jpeg" ] 731 } 732 sources = skia_pdf_sources 733 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ] 734 735 if (skia_use_sfntly) { 736 deps += [ "//third_party/sfntly" ] 737 public_defines += [ "SK_PDF_USE_SFNTLY" ] 738 } 739} 740 741optional("png") { 742 enabled = skia_use_libpng 743 public_defines = [ "SK_HAS_PNG_LIBRARY" ] 744 745 deps = [ 746 "//third_party/libpng", 747 ] 748 sources = [ 749 "src/codec/SkIcoCodec.cpp", 750 "src/codec/SkPngCodec.cpp", 751 "src/images/SkPngEncoder.cpp", 752 ] 753} 754 755optional("raw") { 756 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex 757 public_defines = [ "SK_CODEC_DECODES_RAW" ] 758 759 deps = [ 760 "//third_party/dng_sdk", 761 "//third_party/libjpeg-turbo:libjpeg", 762 "//third_party/piex", 763 ] 764 765 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of 766 # Skia. 767 configs_to_remove = [ "//gn:no_exceptions" ] 768 769 sources = [ 770 "src/codec/SkRawCodec.cpp", 771 ] 772} 773 774import("third_party/skcms/skcms.gni") 775source_set("skcms") { 776 cflags = [] 777 if (!is_win || is_clang) { 778 cflags += [ 779 "-w", 780 "-std=c11", 781 ] 782 } 783 784 public = [ 785 "third_party/skcms/skcms.h", 786 ] 787 sources = rebase_path(skcms_sources, ".", "third_party/skcms") 788} 789 790optional("typeface_freetype") { 791 enabled = skia_use_freetype 792 793 deps = [ 794 "//third_party/freetype2", 795 ] 796 sources = [ 797 "src/ports/SkFontHost_FreeType.cpp", 798 "src/ports/SkFontHost_FreeType_common.cpp", 799 ] 800} 801 802optional("webp") { 803 enabled = skia_use_libwebp 804 public_defines = [ "SK_HAS_WEBP_LIBRARY" ] 805 806 deps = [ 807 "//third_party/libwebp", 808 ] 809 sources = [ 810 "src/codec/SkWebpCodec.cpp", 811 "src/images/SkWebpEncoder.cpp", 812 ] 813} 814 815optional("wuffs") { 816 enabled = skia_use_wuffs 817 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ] 818 819 deps = [ 820 "//third_party/wuffs", 821 ] 822 sources = [ 823 "src/codec/SkWuffsCodec.cpp", 824 ] 825} 826 827optional("xml") { 828 enabled = skia_use_expat 829 public_defines = [ "SK_XML" ] 830 831 deps = [ 832 "//third_party/expat", 833 ] 834 sources = [ 835 "src/svg/SkSVGCanvas.cpp", 836 "src/svg/SkSVGDevice.cpp", 837 "src/xml/SkDOM.cpp", 838 "src/xml/SkXMLParser.cpp", 839 "src/xml/SkXMLWriter.cpp", 840 ] 841} 842 843if (skia_enable_gpu && skia_generate_workarounds) { 844 action("workaround_list") { 845 script = "tools/build_workaround_header.py" 846 847 inputs = [ 848 "src/gpu/gpu_workaround_list.txt", 849 ] 850 851 # see comments in skia_compile_processors about out dir path shenanigans. 852 output_file = 853 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir) 854 855 outputs = [ 856 "$root_out_dir/$output_file", 857 ] 858 args = [ 859 "--output-file", 860 "$output_file", 861 ] 862 863 foreach(file, inputs) { 864 args += [ rebase_path(file, root_build_dir) ] 865 } 866 } 867} 868 869# Temporary fake targets so Flutter-in-Fuchsia can "depend" on them. 870# TODO: rename :gpu_for_real back to :gpu when cleaning up. 871source_set("effects") { 872} 873source_set("gpu") { 874} 875 876component("skia") { 877 public_configs = [ ":skia_public" ] 878 configs += skia_library_configs 879 880 public_deps = [ 881 ":gpu_for_real", 882 ":pdf", 883 ":skcms", 884 ] 885 886 deps = [ 887 ":arm64", 888 ":armv7", 889 ":avx", 890 ":compile_processors", 891 ":crc32", 892 ":fontmgr_android", 893 ":fontmgr_custom", 894 ":fontmgr_custom_empty", 895 ":fontmgr_empty", 896 ":fontmgr_fontconfig", 897 ":fontmgr_fuchsia", 898 ":fontmgr_wasm", 899 ":gif", 900 ":heif", 901 ":hsw", 902 ":jpeg", 903 ":none", 904 ":png", 905 ":raw", 906 ":sse2", 907 ":sse41", 908 ":sse42", 909 ":ssse3", 910 ":webp", 911 ":wuffs", 912 ":xml", 913 ] 914 915 if (skia_enable_nima) { 916 deps += [ "//third_party/Nima-Cpp" ] 917 } 918 919 # This file (and all GN files in Skia) are designed to work with an 920 # empty sources assignment filter; we handle all that explicitly. 921 # We clear the filter here for clients who may have set up a global filter. 922 set_sources_assignment_filter([]) 923 924 sources = [] 925 sources += skia_core_sources 926 sources += skia_utils_sources 927 sources += skia_xps_sources 928 sources += skia_effects_sources 929 sources += skia_effects_imagefilter_sources 930 sources += [ 931 "src/android/SkAndroidFrameworkUtils.cpp", 932 "src/android/SkAnimatedImage.cpp", 933 "src/android/SkBitmapRegionCodec.cpp", 934 "src/android/SkBitmapRegionDecoder.cpp", 935 "src/codec/SkAndroidCodec.cpp", 936 "src/codec/SkAndroidCodecAdapter.cpp", 937 "src/codec/SkBmpBaseCodec.cpp", 938 "src/codec/SkBmpCodec.cpp", 939 "src/codec/SkBmpMaskCodec.cpp", 940 "src/codec/SkBmpRLECodec.cpp", 941 "src/codec/SkBmpStandardCodec.cpp", 942 "src/codec/SkCodec.cpp", 943 "src/codec/SkCodecImageGenerator.cpp", 944 "src/codec/SkColorTable.cpp", 945 "src/codec/SkEncodedInfo.cpp", 946 "src/codec/SkMaskSwizzler.cpp", 947 "src/codec/SkMasks.cpp", 948 "src/codec/SkSampledCodec.cpp", 949 "src/codec/SkSampler.cpp", 950 "src/codec/SkStreamBuffer.cpp", 951 "src/codec/SkSwizzler.cpp", 952 "src/codec/SkWbmpCodec.cpp", 953 "src/images/SkImageEncoder.cpp", 954 "src/ports/SkDiscardableMemory_none.cpp", 955 "src/ports/SkGlobalInitialization_default.cpp", 956 "src/ports/SkImageGenerator_skia.cpp", 957 "src/ports/SkMemory_malloc.cpp", 958 "src/ports/SkOSFile_stdio.cpp", 959 "src/sfnt/SkOTTable_name.cpp", 960 "src/sfnt/SkOTUtils.cpp", 961 "src/utils/mac/SkStream_mac.cpp", 962 "third_party/etc1/etc1.cpp", 963 ] 964 965 defines = [] 966 if (!skia_enable_skpicture) { 967 defines = [ "SK_DISABLE_SKPICTURE" ] 968 sources -= skia_skpicture_sources 969 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ] 970 sources += [ "src/core/SkPicture_none.cpp" ] 971 } 972 973 libs = [] 974 975 if (is_win) { 976 sources += [ 977 "src/fonts/SkFontMgr_indirect.cpp", 978 "src/ports/SkDebug_win.cpp", 979 "src/ports/SkFontHost_win.cpp", 980 "src/ports/SkFontMgr_win_dw.cpp", 981 "src/ports/SkFontMgr_win_dw_factory.cpp", 982 "src/ports/SkImageEncoder_WIC.cpp", 983 "src/ports/SkImageGeneratorWIC.cpp", 984 "src/ports/SkOSFile_win.cpp", 985 "src/ports/SkOSLibrary_win.cpp", 986 "src/ports/SkScalerContext_win_dw.cpp", 987 "src/ports/SkTLS_win.cpp", 988 "src/ports/SkTypeface_win_dw.cpp", 989 ] 990 libs += [ 991 "FontSub.lib", 992 "Gdi32.lib", 993 "Ole32.lib", 994 "OleAut32.lib", 995 "User32.lib", 996 "Usp10.lib", 997 ] 998 } else { 999 sources += [ 1000 "src/ports/SkOSFile_posix.cpp", 1001 "src/ports/SkOSLibrary_posix.cpp", 1002 "src/ports/SkTLS_pthread.cpp", 1003 ] 1004 libs += [ "dl" ] 1005 } 1006 1007 if (is_android) { 1008 deps += [ "//third_party/expat" ] 1009 if (defined(ndk) && ndk != "") { 1010 deps += [ "//third_party/cpu-features" ] 1011 } 1012 sources += [ "src/ports/SkDebug_android.cpp" ] 1013 libs += [ 1014 "EGL", 1015 "GLESv2", 1016 "log", 1017 ] 1018 } 1019 1020 if (is_linux || target_cpu == "wasm") { 1021 sources += [ "src/ports/SkDebug_stdio.cpp" ] 1022 if (skia_use_egl) { 1023 libs += [ "GLESv2" ] 1024 } 1025 } 1026 1027 if (skia_use_fonthost_mac) { 1028 sources += [ "src/ports/SkFontHost_mac.cpp" ] 1029 } 1030 1031 if (is_mac) { 1032 sources += [ 1033 "src/ports/SkDebug_stdio.cpp", 1034 "src/ports/SkImageEncoder_CG.cpp", 1035 "src/ports/SkImageGeneratorCG.cpp", 1036 ] 1037 libs += [ 1038 # AppKit symbols NSFontWeightXXX may be dlsym'ed. 1039 "AppKit.framework", 1040 "ApplicationServices.framework", 1041 "OpenGL.framework", 1042 ] 1043 } 1044 1045 if (is_ios) { 1046 sources += [ 1047 "src/ports/SkDebug_stdio.cpp", 1048 "src/ports/SkFontHost_mac.cpp", 1049 "src/ports/SkImageEncoder_CG.cpp", 1050 "src/ports/SkImageGeneratorCG.cpp", 1051 ] 1052 libs += [ 1053 "CoreFoundation.framework", 1054 "CoreGraphics.framework", 1055 "CoreText.framework", 1056 "ImageIO.framework", 1057 "MobileCoreServices.framework", 1058 1059 # UIKit symbols UIFontWeightXXX may be dlsym'ed. 1060 "UIKit.framework", 1061 ] 1062 } 1063 1064 if (is_fuchsia) { 1065 sources += [ "src/ports/SkDebug_stdio.cpp" ] 1066 } 1067} 1068 1069static_library("pathkit") { 1070 public_configs = [ ":skia_public" ] 1071 configs += skia_library_configs 1072 1073 deps = [ 1074 ":arm64", 1075 ":armv7", 1076 ":avx", 1077 ":crc32", 1078 ":hsw", 1079 ":none", 1080 ":sse2", 1081 ":sse41", 1082 ":sse42", 1083 ":ssse3", 1084 ] 1085 1086 # This file (and all GN files in Skia) are designed to work with an 1087 # empty sources assignment filter; we handle all that explicitly. 1088 # We clear the filter here for clients who may have set up a global filter. 1089 set_sources_assignment_filter([]) 1090 1091 sources = [] 1092 sources += skia_pathops_sources 1093 sources += [ 1094 "src/core/SkAnalyticEdge.cpp", 1095 "src/core/SkArenaAlloc.cpp", 1096 "src/core/SkCubicMap.cpp", 1097 "src/core/SkEdge.cpp", 1098 "src/core/SkEdgeBuilder.cpp", 1099 "src/core/SkEdgeClipper.cpp", 1100 "src/core/SkGeometry.cpp", 1101 "src/core/SkLineClipper.cpp", 1102 "src/core/SkMallocPixelRef.cpp", 1103 "src/core/SkMath.cpp", 1104 "src/core/SkMatrix.cpp", 1105 "src/core/SkOpts.cpp", 1106 "src/core/SkPaint.cpp", 1107 "src/core/SkPath.cpp", 1108 "src/core/SkPathEffect.cpp", 1109 "src/core/SkPathMeasure.cpp", 1110 "src/core/SkPathRef.cpp", 1111 "src/core/SkPoint.cpp", 1112 "src/core/SkRRect.cpp", 1113 "src/core/SkRect.cpp", 1114 "src/core/SkSemaphore.cpp", 1115 "src/core/SkStream.cpp", 1116 "src/core/SkString.cpp", 1117 "src/core/SkStringUtils.cpp", 1118 "src/core/SkStroke.cpp", 1119 "src/core/SkStrokeRec.cpp", 1120 "src/core/SkStrokerPriv.cpp", 1121 "src/core/SkThreadID.cpp", 1122 "src/core/SkUtils.cpp", 1123 "src/effects/SkDashPathEffect.cpp", 1124 "src/effects/SkTrimPathEffect.cpp", 1125 "src/ports/SkDebug_stdio.cpp", 1126 "src/ports/SkMemory_malloc.cpp", 1127 "src/utils/SkDashPath.cpp", 1128 "src/utils/SkParse.cpp", 1129 "src/utils/SkParsePath.cpp", 1130 "src/utils/SkUTF.cpp", 1131 ] 1132} 1133 1134# Targets guarded by skia_enable_tools may use //third_party freely. 1135if (skia_enable_tools) { 1136 # Used by gn_to_bp.py to list our public include dirs. 1137 source_set("public") { 1138 configs += [ ":skia_public" ] 1139 } 1140 1141 config("skia.h_config") { 1142 include_dirs = [ "$target_gen_dir" ] 1143 } 1144 action("skia.h") { 1145 public_configs = [ ":skia.h_config" ] 1146 skia_h = "$target_gen_dir/skia.h" 1147 script = "gn/find_headers.py" 1148 1149 # TODO: would be cool to not hard-code these here, but how? 1150 module_public_includes = [ 1151 "modules/sksg/include", 1152 "modules/skottie/include", 1153 ] 1154 args = 1155 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] + 1156 [ rebase_path(skia_h, root_build_dir) ] + 1157 rebase_path(skia_public_includes) + rebase_path(module_public_includes) 1158 depfile = "$skia_h.deps" 1159 outputs = [ 1160 skia_h, 1161 ] 1162 } 1163 1164 if (target_cpu == "x64") { 1165 executable("fiddle") { 1166 libs = [] 1167 sources = [ 1168 "tools/fiddle/draw.cpp", 1169 "tools/fiddle/fiddle_main.cpp", 1170 ] 1171 1172 if (skia_use_egl) { 1173 sources += [ "tools/fiddle/egl_context.cpp" ] 1174 } else { 1175 sources += [ "tools/fiddle/null_context.cpp" ] 1176 } 1177 testonly = true 1178 deps = [ 1179 ":flags", 1180 ":gpu_tool_utils", 1181 ":skia", 1182 ":skia.h", 1183 "modules/skottie", 1184 ] 1185 } 1186 } 1187 1188 source_set("public_headers_warnings_check") { 1189 sources = [ 1190 "tools/public_headers_warnings_check.cpp", 1191 ] 1192 configs -= [ "//gn:warnings_except_public_headers" ] 1193 deps = [ 1194 ":skia", 1195 ":skia.h", 1196 "modules/skottie", 1197 ] 1198 1199 # We add this directory to simulate the client already have 1200 # vulkan/vulkan_core.h on their path. 1201 include_dirs = [ "include/third_party/vulkan" ] 1202 } 1203 1204 template("test_lib") { 1205 config(target_name + "_config") { 1206 include_dirs = invoker.public_include_dirs 1207 if (defined(invoker.public_defines)) { 1208 defines = invoker.public_defines 1209 } 1210 } 1211 source_set(target_name) { 1212 forward_variables_from(invoker, "*", [ "public_include_dirs" ]) 1213 public_configs = [ 1214 ":" + target_name + "_config", 1215 ":skia_private", 1216 ] 1217 1218 if (!defined(deps)) { 1219 deps = [] 1220 } 1221 deps += [ ":skia" ] 1222 testonly = true 1223 } 1224 } 1225 1226 template("test_app") { 1227 if (is_ios) { 1228 app_name = target_name 1229 gen_path = target_gen_dir 1230 1231 action("${app_name}_generate_info_plist") { 1232 script = "//gn/gen_plist_ios.py" 1233 outputs = [ 1234 "$gen_path/${app_name}_Info.plist", 1235 ] 1236 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ] 1237 } 1238 1239 bundle_data("${app_name}_bundle_info_plist") { 1240 public_deps = [ 1241 ":${app_name}_generate_info_plist", 1242 ] 1243 sources = [ 1244 "$gen_path/${app_name}_Info.plist", 1245 ] 1246 outputs = [ 1247 "{{bundle_root_dir}}/Info.plist", 1248 ] 1249 } 1250 1251 bundle_ios_data = 1252 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data 1253 1254 if (bundle_ios_data) { 1255 has_skps = 1256 "True" == exec_script("//gn/checkdir.py", 1257 [ rebase_path("skps", root_build_dir) ], 1258 "trim string") 1259 bundle_data("${app_name}_bundle_resources") { 1260 sources = [ 1261 "resources", 1262 ] 1263 outputs = [ 1264 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper 1265 "{{bundle_resources_dir}}/data/resources", 1266 ] 1267 } 1268 1269 if (has_skps) { 1270 bundle_data("${app_name}_bundle_skps") { 1271 sources = [ 1272 "skps", 1273 ] 1274 outputs = [ 1275 # Store in same folder as resources 1276 "{{bundle_resources_dir}}/data/skps", 1277 ] 1278 } 1279 } 1280 } 1281 1282 executable("${app_name}_generate_executable") { 1283 forward_variables_from(invoker, 1284 "*", 1285 [ 1286 "output_name", 1287 "visibility", 1288 "is_shared_library", 1289 ]) 1290 configs += [ ":skia_private" ] 1291 testonly = true 1292 output_name = rebase_path("$gen_path/$app_name", root_build_dir) 1293 } 1294 1295 bundle_data("${app_name}_bundle_executable") { 1296 public_deps = [ 1297 ":${app_name}_generate_executable", 1298 ] 1299 sources = [ 1300 "$gen_path/$app_name", 1301 ] 1302 outputs = [ 1303 "{{bundle_executable_dir}}/$app_name", 1304 ] 1305 testonly = true 1306 } 1307 1308 create_bundle("$app_name") { 1309 product_type = "com.apple.product-type.application" 1310 testonly = true 1311 1312 bundle_root_dir = "${root_build_dir}/${target_name}.app" 1313 bundle_resources_dir = bundle_root_dir 1314 bundle_executable_dir = bundle_root_dir 1315 bundle_plugins_dir = bundle_root_dir + "/Plugins" 1316 1317 deps = [ 1318 ":${app_name}_bundle_executable", 1319 ":${app_name}_bundle_info_plist", 1320 ] 1321 if (bundle_ios_data) { 1322 deps += [ ":${app_name}_bundle_resources" ] 1323 if (has_skps) { 1324 deps += [ ":${app_name}_bundle_skps" ] 1325 } 1326 } 1327 1328 # should only code sign when running on a device, not the simulator 1329 if (target_cpu != "x64") { 1330 code_signing_script = "//gn/codesign_ios.py" 1331 code_signing_sources = [ "$target_gen_dir/$app_name" ] 1332 code_signing_outputs = [ 1333 "$bundle_root_dir/_CodeSignature/CodeResources", 1334 "$bundle_root_dir/embedded.mobileprovision", 1335 ] 1336 code_signing_args = [ 1337 rebase_path("$bundle_root_dir", root_build_dir), 1338 skia_ios_identity, 1339 skia_ios_profile, 1340 ] 1341 } 1342 } 1343 } else { 1344 # !is_ios 1345 1346 if (defined(invoker.is_shared_library) && invoker.is_shared_library) { 1347 shared_library("lib" + target_name) { 1348 forward_variables_from(invoker, "*", [ "is_shared_library" ]) 1349 configs += [ ":skia_private" ] 1350 testonly = true 1351 } 1352 } else { 1353 _executable = target_name 1354 executable(_executable) { 1355 forward_variables_from(invoker, "*", [ "is_shared_library" ]) 1356 configs += [ ":skia_private" ] 1357 testonly = true 1358 } 1359 } 1360 if (is_android && skia_android_serial != "" && defined(_executable)) { 1361 action("push_" + target_name) { 1362 script = "gn/push_to_android.py" 1363 deps = [ 1364 ":" + _executable, 1365 ] 1366 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial" 1367 outputs = [ 1368 _stamp, 1369 ] 1370 args = [ 1371 rebase_path("$root_build_dir/$_executable"), 1372 skia_android_serial, 1373 rebase_path(_stamp), 1374 ] 1375 testonly = true 1376 } 1377 } 1378 } 1379 } 1380 1381 config("moltenvk_config") { 1382 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") { 1383 if (is_ios) { 1384 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS" 1385 } else { 1386 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS" 1387 } 1388 cflags = [ "-F$moltenvk_framework_path" ] 1389 ldflags = [ "-F$moltenvk_framework_path" ] 1390 libs = [ 1391 "MoltenVK.framework", 1392 "Metal.framework", 1393 "IOSurface.framework", 1394 "QuartzCore.framework", 1395 "Foundation.framework", 1396 ] 1397 if (is_ios) { 1398 libs += [ "UIKit.framework" ] 1399 } else { 1400 libs += [ "IOKit.framework" ] 1401 } 1402 defines = [ "SK_MOLTENVK" ] 1403 } 1404 } 1405 1406 source_set("moltenvk") { 1407 public_configs = [ ":moltenvk_config" ] 1408 } 1409 1410 test_lib("gpu_tool_utils") { 1411 public_include_dirs = [] 1412 public_defines = [] 1413 public_include_dirs += [ "tools/gpu" ] 1414 1415 deps = [] 1416 public_deps = [] 1417 sources = [ 1418 "tools/gpu/GrContextFactory.cpp", 1419 "tools/gpu/GrTest.cpp", 1420 "tools/gpu/MemoryCache.cpp", 1421 "tools/gpu/MemoryCache.h", 1422 "tools/gpu/ProxyUtils.cpp", 1423 "tools/gpu/TestContext.cpp", 1424 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp", 1425 "tools/gpu/gl/GLTestContext.cpp", 1426 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp", 1427 "tools/gpu/gl/null/NullGLTestContext.cpp", 1428 "tools/gpu/mock/MockTestContext.cpp", 1429 ] 1430 libs = [] 1431 1432 if (is_android || skia_use_egl) { 1433 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ] 1434 } else if (is_ios) { 1435 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ] 1436 libs += [ "OpenGLES.framework" ] 1437 } else if (is_linux) { 1438 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ] 1439 libs += [ 1440 "GLU", 1441 "X11", 1442 ] 1443 } else if (is_mac) { 1444 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ] 1445 } else if (is_win) { 1446 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ] 1447 libs += [ "Gdi32.lib" ] 1448 if (target_cpu != "arm64") { 1449 libs += [ "OpenGL32.lib" ] 1450 } 1451 } 1452 1453 cflags_objcc = [ "-fobjc-arc" ] 1454 1455 if (skia_use_angle) { 1456 deps += [ "//third_party/angle2" ] 1457 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ] 1458 } 1459 1460 public_include_dirs += [ "include/third_party/vulkan" ] 1461 if (skia_use_vulkan) { 1462 sources += [ "tools/gpu/vk/VkTestContext.cpp" ] 1463 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ] 1464 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") { 1465 public_deps += [ ":moltenvk" ] 1466 } 1467 } 1468 if (skia_use_metal) { 1469 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ] 1470 } 1471 } 1472 1473 test_lib("flags") { 1474 public_include_dirs = [ "tools/flags" ] 1475 sources = [ 1476 "tools/flags/SkCommandLineFlags.cpp", 1477 ] 1478 } 1479 test_lib("common_flags") { 1480 public_include_dirs = [ "tools/flags" ] 1481 sources = [ 1482 "tools/flags/SkCommonFlags.cpp", 1483 "tools/flags/SkCommonFlagsConfig.cpp", 1484 ] 1485 deps = [ 1486 ":flags", 1487 ] 1488 public_deps = [ 1489 ":gpu_tool_utils", 1490 ] 1491 } 1492 1493 test_lib("tool_utils") { 1494 public_include_dirs = [ 1495 "tools", 1496 "tools/debugger", 1497 "tools/fonts", 1498 "tools/timer", 1499 "tools/trace", 1500 ] 1501 sources = [ 1502 "tools/AndroidSkDebugToStdOut.cpp", 1503 "tools/CrashHandler.cpp", 1504 "tools/DDLPromiseImageHelper.cpp", 1505 "tools/DDLTileHelper.cpp", 1506 "tools/LsanSuppressions.cpp", 1507 "tools/ProcStats.cpp", 1508 "tools/Resources.cpp", 1509 "tools/UrlDataManager.cpp", 1510 "tools/debugger/SkDebugCanvas.cpp", 1511 "tools/debugger/SkDrawCommand.cpp", 1512 "tools/debugger/SkJsonWriteBuffer.cpp", 1513 "tools/fonts/SkRandomScalerContext.cpp", 1514 "tools/fonts/SkTestEmptyTypeface.h", 1515 "tools/fonts/SkTestFontMgr.cpp", 1516 "tools/fonts/SkTestFontMgr.h", 1517 "tools/fonts/SkTestSVGTypeface.cpp", 1518 "tools/fonts/SkTestSVGTypeface.h", 1519 "tools/fonts/SkTestTypeface.cpp", 1520 "tools/fonts/SkTestTypeface.h", 1521 "tools/fonts/sk_tool_utils_font.cpp", 1522 "tools/random_parse_path.cpp", 1523 "tools/sk_tool_utils.cpp", 1524 "tools/timer/SkAnimTimer.h", 1525 "tools/timer/Timer.cpp", 1526 "tools/trace/SkChromeTracingTracer.cpp", 1527 "tools/trace/SkChromeTracingTracer.h", 1528 "tools/trace/SkDebugfTracer.cpp", 1529 "tools/trace/SkDebugfTracer.h", 1530 "tools/trace/SkEventTracingPriv.cpp", 1531 "tools/trace/SkEventTracingPriv.h", 1532 ] 1533 libs = [] 1534 if (is_ios) { 1535 sources += [ "tools/ios_utils.m" ] 1536 libs += [ "Foundation.framework" ] 1537 } 1538 defines = [] 1539 if (skia_tools_require_resources) { 1540 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ] 1541 } 1542 deps = [ 1543 ":experimental_svg_model", 1544 ":flags", 1545 "//third_party/libpng", 1546 ] 1547 public_deps = [ 1548 ":common_flags", 1549 ] 1550 } 1551 1552 import("gn/gm.gni") 1553 test_lib("gm") { 1554 public_include_dirs = [ "gm" ] 1555 sources = gm_sources 1556 deps = [ 1557 ":flags", 1558 ":skia", 1559 ":tool_utils", 1560 "modules/skottie", 1561 "modules/skottie:gm", 1562 "modules/sksg", 1563 ] 1564 public_deps = [ 1565 ":gpu_tool_utils", 1566 ] 1567 } 1568 1569 import("gn/tests.gni") 1570 test_lib("tests") { 1571 public_include_dirs = [ "tests" ] 1572 sources = tests_sources + pathops_tests_sources 1573 if (!skia_enable_fontmgr_android) { 1574 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ] 1575 } 1576 if (!(skia_use_freetype && skia_use_fontconfig)) { 1577 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ] 1578 } 1579 deps = [ 1580 ":experimental_svg_model", 1581 ":flags", 1582 ":skia", 1583 ":tool_utils", 1584 "modules/skottie:tests", 1585 "modules/sksg:tests", 1586 "//third_party/libpng", 1587 "//third_party/zlib", 1588 ] 1589 public_deps = [ 1590 ":gpu_tool_utils", # Test.h #includes headers from this target. 1591 ] 1592 } 1593 1594 import("gn/bench.gni") 1595 test_lib("bench") { 1596 public_include_dirs = [ "bench" ] 1597 sources = bench_sources 1598 deps = [ 1599 ":flags", 1600 ":gm", 1601 ":gpu_tool_utils", 1602 ":skia", 1603 ":tool_utils", 1604 ] 1605 } 1606 1607 test_lib("experimental_svg_model") { 1608 public_include_dirs = [] 1609 if (skia_use_expat) { 1610 public_include_dirs += [ "experimental/svg/model" ] 1611 sources = [ 1612 "experimental/svg/model/SkSVGAttribute.cpp", 1613 "experimental/svg/model/SkSVGAttributeParser.cpp", 1614 "experimental/svg/model/SkSVGCircle.cpp", 1615 "experimental/svg/model/SkSVGClipPath.cpp", 1616 "experimental/svg/model/SkSVGContainer.cpp", 1617 "experimental/svg/model/SkSVGDOM.cpp", 1618 "experimental/svg/model/SkSVGEllipse.cpp", 1619 "experimental/svg/model/SkSVGGradient.cpp", 1620 "experimental/svg/model/SkSVGLine.cpp", 1621 "experimental/svg/model/SkSVGLinearGradient.cpp", 1622 "experimental/svg/model/SkSVGNode.cpp", 1623 "experimental/svg/model/SkSVGPath.cpp", 1624 "experimental/svg/model/SkSVGPattern.cpp", 1625 "experimental/svg/model/SkSVGPoly.cpp", 1626 "experimental/svg/model/SkSVGRadialGradient.cpp", 1627 "experimental/svg/model/SkSVGRect.cpp", 1628 "experimental/svg/model/SkSVGRenderContext.cpp", 1629 "experimental/svg/model/SkSVGSVG.cpp", 1630 "experimental/svg/model/SkSVGShape.cpp", 1631 "experimental/svg/model/SkSVGStop.cpp", 1632 "experimental/svg/model/SkSVGTransformableNode.cpp", 1633 "experimental/svg/model/SkSVGUse.cpp", 1634 "experimental/svg/model/SkSVGValue.cpp", 1635 ] 1636 deps = [ 1637 ":skia", 1638 ":xml", 1639 ] 1640 } 1641 } 1642 1643 if (skia_use_lua) { 1644 test_lib("lua") { 1645 public_include_dirs = [] 1646 sources = [ 1647 "src/utils/SkLua.cpp", 1648 "src/utils/SkLuaCanvas.cpp", 1649 ] 1650 deps = [ 1651 "modules/skshaper", 1652 "//third_party/lua", 1653 ] 1654 } 1655 1656 test_app("lua_app") { 1657 sources = [ 1658 "tools/lua/lua_app.cpp", 1659 ] 1660 deps = [ 1661 ":lua", 1662 ":skia", 1663 "//third_party/lua", 1664 ] 1665 } 1666 1667 test_app("lua_pictures") { 1668 sources = [ 1669 "tools/lua/lua_pictures.cpp", 1670 ] 1671 deps = [ 1672 ":flags", 1673 ":lua", 1674 ":skia", 1675 ":tool_utils", 1676 "//third_party/lua", 1677 ] 1678 } 1679 } 1680 1681 test_app("bookmaker") { 1682 sources = [ 1683 "tools/bookmaker/bmhParser.cpp", 1684 "tools/bookmaker/bookmaker.cpp", 1685 "tools/bookmaker/cataloger.cpp", 1686 "tools/bookmaker/definition.cpp", 1687 "tools/bookmaker/fiddleParser.cpp", 1688 "tools/bookmaker/hackParser.cpp", 1689 "tools/bookmaker/includeParser.cpp", 1690 "tools/bookmaker/includeWriter.cpp", 1691 "tools/bookmaker/mdOut.cpp", 1692 "tools/bookmaker/parserCommon.cpp", 1693 "tools/bookmaker/selfCheck.cpp", 1694 "tools/bookmaker/spellCheck.cpp", 1695 "tools/bookmaker/textParser.cpp", 1696 ] 1697 deps = [ 1698 ":flags", 1699 ":skia", 1700 ":tool_utils", 1701 "//third_party/jsoncpp", 1702 ] 1703 } 1704 1705 if (is_linux || is_mac) { 1706 test_app("skottie_tool") { 1707 deps = [ 1708 "modules/skottie:tool", 1709 ] 1710 } 1711 } 1712 1713 if (target_cpu != "wasm") { 1714 import("gn/samples.gni") 1715 test_lib("samples") { 1716 public_include_dirs = [ "samplecode" ] 1717 include_dirs = [ "experimental" ] 1718 sources = samples_sources 1719 public_deps = [ 1720 ":tool_utils", 1721 ] 1722 deps = [ 1723 ":experimental_svg_model", 1724 ":flags", 1725 ":xml", 1726 "modules/skshaper", 1727 ] 1728 1729 # NIMA does not build on Windows clang 1730 if (!is_win || !is_clang) { 1731 sources += [ "experimental/nima/NimaActor.cpp" ] 1732 deps += [ "//third_party/Nima-Cpp" ] 1733 } 1734 1735 if (skia_use_lua) { 1736 sources += [ "samplecode/SampleLua.cpp" ] 1737 deps += [ 1738 ":lua", 1739 "//third_party/lua", 1740 ] 1741 } 1742 } 1743 test_app("imgcvt") { 1744 sources = [ 1745 "tools/imgcvt.cpp", 1746 ] 1747 deps = [ 1748 ":skcms", 1749 ":skia", 1750 ] 1751 } 1752 test_app("dm") { 1753 sources = [ 1754 "dm/DM.cpp", 1755 "dm/DMGpuTestProcs.cpp", 1756 "dm/DMJsonWriter.cpp", 1757 "dm/DMSrcSink.cpp", 1758 ] 1759 deps = [ 1760 ":common_flags", 1761 ":experimental_svg_model", 1762 ":flags", 1763 ":gm", 1764 ":gpu_tool_utils", 1765 ":skia", 1766 ":tests", 1767 ":tool_utils", 1768 "modules/skottie", 1769 "modules/skottie:utils", 1770 "modules/sksg", 1771 "//third_party/libpng", 1772 ] 1773 1774 # NIMA does not build on Windows clang 1775 if (!is_win || !is_clang) { 1776 deps += [ "//third_party/Nima-Cpp" ] 1777 } 1778 } 1779 } 1780 1781 if (!is_win) { 1782 test_app("remote_demo") { 1783 sources = [ 1784 "tools/remote_demo.cpp", 1785 ] 1786 deps = [ 1787 ":skia", 1788 ] 1789 } 1790 } 1791 1792 test_app("nanobench") { 1793 sources = [ 1794 "bench/nanobench.cpp", 1795 ] 1796 deps = [ 1797 ":bench", 1798 ":common_flags", 1799 ":experimental_svg_model", 1800 ":flags", 1801 ":gm", 1802 ":gpu_tool_utils", 1803 ":skia", 1804 ":tool_utils", 1805 "modules/sksg", 1806 ] 1807 } 1808 1809 test_app("skpinfo") { 1810 sources = [ 1811 "tools/skpinfo.cpp", 1812 ] 1813 deps = [ 1814 ":flags", 1815 ":skia", 1816 ] 1817 } 1818 1819 test_app("skpbench") { 1820 sources = [ 1821 "tools/skpbench/skpbench.cpp", 1822 ] 1823 deps = [ 1824 ":flags", 1825 ":gpu_tool_utils", 1826 ":skia", 1827 ":tool_utils", 1828 ] 1829 } 1830 1831 test_app("sktexttopdf") { 1832 sources = [ 1833 "tools/using_skia_and_harfbuzz.cpp", 1834 ] 1835 deps = [ 1836 ":skia", 1837 "modules/skshaper", 1838 ] 1839 } 1840 1841 test_app("create_test_font") { 1842 sources = [ 1843 "tools/fonts/create_test_font.cpp", 1844 ] 1845 deps = [ 1846 ":skia", 1847 ] 1848 assert_no_deps = [ 1849 # tool_utils requires the output of this app. 1850 ":tool_utils", 1851 ] 1852 } 1853 1854 if (skia_use_expat) { 1855 test_app("create_test_font_color") { 1856 sources = [ 1857 "tools/fonts/create_test_font_color.cpp", 1858 ] 1859 deps = [ 1860 ":flags", 1861 ":skia", 1862 ":tool_utils", 1863 ] 1864 } 1865 } 1866 1867 test_app("get_images_from_skps") { 1868 sources = [ 1869 "tools/get_images_from_skps.cpp", 1870 ] 1871 deps = [ 1872 ":flags", 1873 ":skia", 1874 ] 1875 } 1876 1877 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) { 1878 test_app("skiaserve") { 1879 sources = [ 1880 "tools/skiaserve/Request.cpp", 1881 "tools/skiaserve/Response.cpp", 1882 "tools/skiaserve/skiaserve.cpp", 1883 "tools/skiaserve/urlhandlers/BreakHandler.cpp", 1884 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp", 1885 "tools/skiaserve/urlhandlers/CmdHandler.cpp", 1886 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp", 1887 "tools/skiaserve/urlhandlers/DataHandler.cpp", 1888 "tools/skiaserve/urlhandlers/DownloadHandler.cpp", 1889 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp", 1890 "tools/skiaserve/urlhandlers/ImgHandler.cpp", 1891 "tools/skiaserve/urlhandlers/InfoHandler.cpp", 1892 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp", 1893 "tools/skiaserve/urlhandlers/OpsHandler.cpp", 1894 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp", 1895 "tools/skiaserve/urlhandlers/PostHandler.cpp", 1896 "tools/skiaserve/urlhandlers/QuitHandler.cpp", 1897 "tools/skiaserve/urlhandlers/RootHandler.cpp", 1898 ] 1899 deps = [ 1900 ":flags", 1901 ":gpu_tool_utils", 1902 ":skia", 1903 ":tool_utils", 1904 "//third_party/libmicrohttpd", 1905 "//third_party/libpng", 1906 ] 1907 } 1908 } 1909 1910 test_app("fuzz") { 1911 include_dirs = [ 1912 "tools", 1913 "tools/debugger", 1914 "tools/fonts", 1915 ] 1916 sources = [ 1917 "fuzz/Fuzz.cpp", 1918 "fuzz/FuzzCanvas.cpp", 1919 "fuzz/FuzzCommon.cpp", 1920 "fuzz/FuzzDrawFunctions.cpp", 1921 "fuzz/FuzzEncoders.cpp", 1922 "fuzz/FuzzGradients.cpp", 1923 "fuzz/FuzzMain.cpp", 1924 "fuzz/FuzzParsePath.cpp", 1925 "fuzz/FuzzPathMeasure.cpp", 1926 "fuzz/FuzzPathop.cpp", 1927 "fuzz/FuzzPolyUtils.cpp", 1928 "fuzz/FuzzRegionOp.cpp", 1929 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp", 1930 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp", 1931 "fuzz/oss_fuzz/FuzzImage.cpp", 1932 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp", 1933 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp", 1934 "fuzz/oss_fuzz/FuzzJSON.cpp", 1935 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp", 1936 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp", 1937 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp", 1938 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp", 1939 "tools/UrlDataManager.cpp", 1940 "tools/debugger/SkDebugCanvas.cpp", 1941 "tools/debugger/SkDrawCommand.cpp", 1942 "tools/debugger/SkJsonWriteBuffer.cpp", 1943 ] 1944 deps = [ 1945 ":flags", 1946 ":gpu_tool_utils", 1947 ":skia", 1948 "modules/skottie:fuzz", 1949 "//third_party/libpng", 1950 ] 1951 } 1952 1953 test_app("pathops_unittest") { 1954 sources = pathops_tests_sources + [ 1955 rebase_path("tests/skia_test.cpp"), 1956 rebase_path("tests/Test.cpp"), 1957 ] 1958 deps = [ 1959 ":flags", 1960 ":gpu_tool_utils", 1961 ":skia", 1962 ":tool_utils", 1963 ] 1964 } 1965 1966 test_app("dump_record") { 1967 sources = [ 1968 "tools/DumpRecord.cpp", 1969 "tools/dump_record.cpp", 1970 ] 1971 deps = [ 1972 ":flags", 1973 ":skia", 1974 ] 1975 } 1976 1977 test_app("skdiff") { 1978 sources = [ 1979 "tools/skdiff/skdiff.cpp", 1980 "tools/skdiff/skdiff_html.cpp", 1981 "tools/skdiff/skdiff_main.cpp", 1982 "tools/skdiff/skdiff_utils.cpp", 1983 ] 1984 deps = [ 1985 ":skia", 1986 ":tool_utils", 1987 ] 1988 } 1989 1990 test_app("skp_parser") { 1991 sources = [ 1992 "tools/skp_parser.cpp", 1993 ] 1994 deps = [ 1995 ":skia", 1996 ":tool_utils", 1997 ] 1998 } 1999 2000 if (!is_win) { 2001 test_lib("skqp_lib") { 2002 public_include_dirs = [ "tools/skqp/src" ] 2003 defines = 2004 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ] 2005 sources = [ 2006 "dm/DMGpuTestProcs.cpp", 2007 "tools/skqp/src/skqp.cpp", 2008 "tools/skqp/src/skqp_model.cpp", 2009 ] 2010 deps = [ 2011 ":gm", 2012 ":gpu_tool_utils", 2013 ":skia", 2014 ":tests", 2015 ":tool_utils", 2016 ] 2017 } 2018 test_app("skqp") { 2019 sources = [ 2020 "tools/skqp/src/skqp_main.cpp", 2021 ] 2022 deps = [ 2023 ":skia", 2024 ":skqp_lib", 2025 ":tool_utils", 2026 ] 2027 } 2028 test_app("jitter_gms") { 2029 sources = [ 2030 "tools/skqp/jitter_gms.cpp", 2031 ] 2032 deps = [ 2033 ":gm", 2034 ":skia", 2035 ":skqp_lib", 2036 ] 2037 } 2038 } 2039 if (is_android) { 2040 test_app("skqp_app") { 2041 is_shared_library = true 2042 sources = [ 2043 "tools/skqp/src/jni_skqp.cpp", 2044 ] 2045 deps = [ 2046 ":skia", 2047 ":skqp_lib", 2048 ":tool_utils", 2049 ] 2050 libs = [ "android" ] 2051 } 2052 } 2053 if (is_android && skia_enable_gpu) { 2054 test_app("skottie_android") { 2055 is_shared_library = true 2056 2057 sources = [ 2058 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp", 2059 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp", 2060 ] 2061 libs = [] 2062 2063 include_dirs = [] 2064 deps = [ 2065 ":skia", 2066 "modules/skottie", 2067 "modules/sksg:samples", 2068 ] 2069 } 2070 } 2071 2072 test_app("list_gms") { 2073 sources = [ 2074 "tools/list_gms.cpp", 2075 ] 2076 deps = [ 2077 ":gm", 2078 ":skia", 2079 ] 2080 } 2081 test_app("list_gpu_unit_tests") { 2082 sources = [ 2083 "dm/DMGpuTestProcs.cpp", 2084 "tools/list_gpu_unit_tests.cpp", 2085 ] 2086 deps = [ 2087 ":skia", 2088 ":tests", 2089 ] 2090 } 2091 2092 test_lib("sk_app") { 2093 public_include_dirs = [ "tools/sk_app" ] 2094 sources = [ 2095 "tools/sk_app/CommandSet.cpp", 2096 "tools/sk_app/GLWindowContext.cpp", 2097 "tools/sk_app/Window.cpp", 2098 ] 2099 libs = [] 2100 2101 if (is_android) { 2102 sources += [ 2103 "tools/sk_app/android/GLWindowContext_android.cpp", 2104 "tools/sk_app/android/RasterWindowContext_android.cpp", 2105 "tools/sk_app/android/Window_android.cpp", 2106 "tools/sk_app/android/main_android.cpp", 2107 "tools/sk_app/android/surface_glue_android.cpp", 2108 ] 2109 libs += [ "android" ] 2110 } else if (is_linux) { 2111 sources += [ 2112 "tools/sk_app/unix/GLWindowContext_unix.cpp", 2113 "tools/sk_app/unix/RasterWindowContext_unix.cpp", 2114 "tools/sk_app/unix/Window_unix.cpp", 2115 "tools/sk_app/unix/keysym2ucs.c", 2116 "tools/sk_app/unix/main_unix.cpp", 2117 ] 2118 libs += [ 2119 "GL", 2120 "X11", 2121 ] 2122 } else if (is_win) { 2123 sources += [ 2124 "tools/sk_app/win/GLWindowContext_win.cpp", 2125 "tools/sk_app/win/RasterWindowContext_win.cpp", 2126 "tools/sk_app/win/Window_win.cpp", 2127 "tools/sk_app/win/main_win.cpp", 2128 ] 2129 if (skia_use_angle) { 2130 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ] 2131 } 2132 } else if (is_mac) { 2133 sources += [ 2134 "tools/sk_app/mac/GLWindowContext_mac.mm", 2135 "tools/sk_app/mac/RasterWindowContext_mac.mm", 2136 "tools/sk_app/mac/Window_mac.mm", 2137 "tools/sk_app/mac/main_mac.mm", 2138 ] 2139 libs += [ 2140 "QuartzCore.framework", 2141 "Cocoa.framework", 2142 "Foundation.framework", 2143 ] 2144 } else if (is_ios) { 2145 sources += [ 2146 "tools/sk_app/ios/GLWindowContext_ios.cpp", 2147 "tools/sk_app/ios/RasterWindowContext_ios.cpp", 2148 "tools/sk_app/ios/Window_ios.cpp", 2149 "tools/sk_app/ios/main_ios.cpp", 2150 ] 2151 } 2152 2153 if (skia_use_vulkan) { 2154 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ] 2155 if (is_android) { 2156 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ] 2157 } else if (is_linux) { 2158 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ] 2159 libs += [ "X11-xcb" ] 2160 } else if (is_win) { 2161 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ] 2162 } 2163 } 2164 2165 deps = [ 2166 ":gpu_tool_utils", 2167 ":skia", 2168 ":tool_utils", 2169 ] 2170 if (is_android) { 2171 deps += [ "//third_party/native_app_glue" ] 2172 } else if (is_ios) { 2173 deps += [ "//third_party/libsdl" ] 2174 } 2175 if (skia_use_angle) { 2176 deps += [ "//third_party/angle2" ] 2177 } 2178 } 2179 2180 test_app("viewer") { 2181 is_shared_library = is_android 2182 if (is_ios) { 2183 bundle_ios_data = true 2184 } 2185 sources = [ 2186 "tools/viewer/BisectSlide.cpp", 2187 "tools/viewer/GMSlide.cpp", 2188 "tools/viewer/ImGuiLayer.cpp", 2189 "tools/viewer/ImageSlide.cpp", 2190 "tools/viewer/SKPSlide.cpp", 2191 "tools/viewer/SampleSlide.cpp", 2192 "tools/viewer/SkottieSlide.cpp", 2193 "tools/viewer/SlideDir.cpp", 2194 "tools/viewer/StatsLayer.cpp", 2195 "tools/viewer/SvgSlide.cpp", 2196 "tools/viewer/TouchGesture.cpp", 2197 "tools/viewer/TouchGesture.h", 2198 "tools/viewer/Viewer.cpp", 2199 ] 2200 libs = [] 2201 2202 include_dirs = [ "experimental" ] 2203 deps = [ 2204 ":experimental_svg_model", 2205 ":flags", 2206 ":gm", 2207 ":gpu_tool_utils", 2208 ":samples", 2209 ":sk_app", 2210 ":skia", 2211 ":tool_utils", 2212 "modules/skottie", 2213 "modules/skottie:utils", 2214 "modules/sksg", 2215 "modules/sksg:samples", 2216 "//third_party/imgui", 2217 ] 2218 2219 # NIMA does not build on Windows clang 2220 if (!is_win || !is_clang) { 2221 sources += [ "tools/viewer/NIMASlide.cpp" ] 2222 deps += [ "//third_party/Nima-Cpp" ] 2223 } 2224 } 2225 2226 if (is_android) { 2227 test_app("arcore") { 2228 is_shared_library = true 2229 configs = [ 2230 ":skia_public", 2231 "gn:default", 2232 ] 2233 2234 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia. 2235 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so. 2236 sources = [] 2237 sources += skia_core_sources 2238 sources += skia_utils_sources 2239 sources += skia_xps_sources 2240 sources += [ 2241 "src/android/SkAndroidFrameworkUtils.cpp", 2242 "src/android/SkAnimatedImage.cpp", 2243 "src/android/SkBitmapRegionCodec.cpp", 2244 "src/android/SkBitmapRegionDecoder.cpp", 2245 "src/codec/SkAndroidCodec.cpp", 2246 "src/codec/SkBmpBaseCodec.cpp", 2247 "src/codec/SkBmpCodec.cpp", 2248 "src/codec/SkBmpMaskCodec.cpp", 2249 "src/codec/SkBmpRLECodec.cpp", 2250 "src/codec/SkBmpStandardCodec.cpp", 2251 "src/codec/SkCodec.cpp", 2252 "src/codec/SkCodecImageGenerator.cpp", 2253 "src/codec/SkColorTable.cpp", 2254 "src/codec/SkGifCodec.cpp", 2255 "src/codec/SkMaskSwizzler.cpp", 2256 "src/codec/SkMasks.cpp", 2257 "src/codec/SkSampledCodec.cpp", 2258 "src/codec/SkSampler.cpp", 2259 "src/codec/SkStreamBuffer.cpp", 2260 "src/codec/SkSwizzler.cpp", 2261 "src/codec/SkWbmpCodec.cpp", 2262 "src/images/SkImageEncoder.cpp", 2263 "src/ports/SkDiscardableMemory_none.cpp", 2264 "src/ports/SkImageGenerator_skia.cpp", 2265 "src/ports/SkMemory_malloc.cpp", 2266 "src/ports/SkOSFile_stdio.cpp", 2267 "src/sfnt/SkOTTable_name.cpp", 2268 "src/sfnt/SkOTUtils.cpp", 2269 "src/utils/mac/SkStream_mac.cpp", 2270 "third_party/etc1/etc1.cpp", 2271 "third_party/gif/SkGifImageReader.cpp", 2272 ] 2273 deps = [ 2274 ":tool_utils", 2275 "modules/skottie", 2276 "modules/skshaper", 2277 ] 2278 } 2279 } 2280 2281 if (!skia_use_angle && (is_linux || is_win || is_mac)) { 2282 test_app("HelloWorld") { 2283 sources = [ 2284 "example/HelloWorld.cpp", 2285 ] 2286 libs = [] 2287 2288 include_dirs = [] 2289 deps = [ 2290 ":flags", 2291 ":gpu_tool_utils", 2292 ":sk_app", 2293 ":skia", 2294 ":tool_utils", 2295 ] 2296 } 2297 } 2298 2299 if (is_linux || is_mac || is_ios) { 2300 test_app("SkiaSDLExample") { 2301 sources = [ 2302 "example/SkiaSDLExample.cpp", 2303 ] 2304 libs = [] 2305 include_dirs = [] 2306 deps = [ 2307 ":gpu_tool_utils", 2308 ":skia", 2309 "//third_party/libsdl", 2310 ] 2311 } 2312 } 2313 2314 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) { 2315 action_foreach("generate_mocs") { 2316 script = "gn/call.py" 2317 sources = [ 2318 "tools/mdbviz/MainWindow.h", 2319 ] 2320 outputs = [ 2321 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp", 2322 ] 2323 args = [ 2324 "$skia_qt_path" + "/bin/moc", 2325 "{{source}}", 2326 "-o", 2327 "gen/mdbviz/{{source_name_part}}_moc.cpp", 2328 ] 2329 } 2330 action_foreach("generate_resources") { 2331 script = "gn/call.py" 2332 sources = [ 2333 "tools/mdbviz/resources.qrc", 2334 ] 2335 outputs = [ 2336 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp", 2337 ] 2338 args = [ 2339 "$skia_qt_path" + "/bin/rcc", 2340 "{{source}}", 2341 "-o", 2342 "gen/mdbviz/{{source_name_part}}_res.cpp", 2343 ] 2344 } 2345 test_app("mdbviz") { 2346 if (is_win) { 2347 # on Windows we need to disable some exception handling warnings due to the Qt headers 2348 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017 2349 } 2350 sources = [ 2351 "tools/UrlDataManager.cpp", 2352 "tools/debugger/SkDebugCanvas.cpp", 2353 "tools/debugger/SkDrawCommand.cpp", 2354 "tools/debugger/SkJsonWriteBuffer.cpp", 2355 "tools/mdbviz/MainWindow.cpp", 2356 "tools/mdbviz/Model.cpp", 2357 "tools/mdbviz/main.cpp", 2358 2359 # generated files 2360 "$target_gen_dir/mdbviz/MainWindow_moc.cpp", 2361 "$target_gen_dir/mdbviz/resources_res.cpp", 2362 ] 2363 lib_dirs = [ "$skia_qt_path/lib" ] 2364 libs = [ 2365 "Qt5Core.lib", 2366 "Qt5Gui.lib", 2367 "Qt5Widgets.lib", 2368 ] 2369 include_dirs = [ 2370 "$skia_qt_path/include", 2371 "$skia_qt_path/include/QtCore", 2372 "$skia_qt_path/include/QtWidgets", 2373 "tools", 2374 "tools/debugger", 2375 ] 2376 deps = [ 2377 ":generate_mocs", 2378 ":generate_resources", 2379 ":skia", 2380 "//third_party/libpng", 2381 ] 2382 } 2383 } 2384 2385 if (is_android && defined(ndk) && ndk != "") { 2386 copy("gdbserver") { 2387 sources = [ 2388 "$ndk/$ndk_gdbserver", 2389 ] 2390 outputs = [ 2391 "$root_out_dir/gdbserver", 2392 ] 2393 } 2394 } 2395 2396 if (skia_use_opencl) { 2397 test_app("hello-opencl") { 2398 sources = [ 2399 "src/compute/common/cl/assert_cl.c", 2400 "src/compute/common/cl/find_cl.c", 2401 "tools/hello-opencl.cpp", 2402 ] 2403 include_dirs = [ "src/compute/common" ] 2404 if (is_linux) { 2405 libs = [ "OpenCL" ] 2406 } else if (is_win) { 2407 libs = [ "OpenCL.lib" ] 2408 } 2409 } 2410 } 2411} 2412