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/codec.gni") 7import("gn/fuchsia_defines.gni") 8import("gn/shared_sources.gni") 9import("gn/skia.gni") 10import("gn/toolchain/wasm.gni") 11 12if (is_fuchsia) { 13 import("//build/fuchsia/sdk.gni") 14 import("build/fuchsia/fuchsia_download_sdk.gni") 15} 16 17if (skia_use_dawn) { 18 import("//third_party/externals/dawn/scripts/dawn_features.gni") 19} 20 21if (defined(skia_settings)) { 22 import(skia_settings) 23} 24 25import("gn/ios.gni") 26 27# Skia public API, generally provided by :skia. 28config("skia_public") { 29 include_dirs = [ "." ] 30 31 defines = [ 32 "SK_CODEC_DECODES_BMP", 33 "SK_CODEC_DECODES_WBMP", 34 ] 35 cflags_objcc = [] 36 if (is_component_build) { 37 defines += [ "SKIA_DLL" ] 38 } 39 if (is_fuchsia || is_linux) { 40 defines += [ "SK_R32_SHIFT=16" ] 41 } 42 if (skia_enable_optimize_size) { 43 defines += [ "SK_ENABLE_OPTIMIZE_SIZE" ] 44 } 45 if (skia_enable_precompile) { 46 defines += [ "SK_ENABLE_PRECOMPILE" ] 47 } 48 if (is_fuchsia) { 49 defines += fuchsia_defines 50 } 51 if (is_wasm) { 52 defines += wasm_defines 53 } 54 if (skia_gl_standard == "gles") { 55 defines += [ "SK_ASSUME_GL_ES=1" ] 56 } else if (skia_gl_standard == "gl") { 57 defines += [ "SK_ASSUME_GL=1" ] 58 } else if (skia_gl_standard == "webgl") { 59 defines += [ "SK_ASSUME_WEBGL=1" ] 60 } 61 if (skia_enable_ganesh) { 62 defines += [ "SK_GANESH" ] 63 } 64 if (skia_enable_graphite) { 65 defines += [ "SK_GRAPHITE" ] 66 } 67 if (skia_disable_tracing) { 68 defines += [ "SK_DISABLE_TRACING" ] 69 } 70 if (skia_use_perfetto) { 71 defines += [ "SK_USE_PERFETTO" ] 72 } 73 if (skia_use_safe_libcxx) { 74 defines += [ "_LIBCPP_ENABLE_ASSERTIONS=1" ] 75 } 76 77 # Some older versions of the Clang toolchain change the visibility of 78 # symbols decorated with API_AVAILABLE macro to be visible. Users of such 79 # toolchains suppress the use of this macro till toolchain updates are made. 80 if (is_mac || is_ios) { 81 if (skia_enable_api_available_macro) { 82 defines += [ "SK_ENABLE_API_AVAILABLE" ] 83 } else { 84 cflags_objcc += [ "-Wno-unguarded-availability" ] 85 } 86 } 87} 88 89# Skia internal APIs, used by Skia itself and a few test tools. 90config("skia_private") { 91 visibility = [ "./*" ] 92 93 defines = [ "SK_GAMMA_APPLY_TO_A8" ] 94 if (skia_use_fixed_gamma_text) { 95 defines += [ 96 "SK_GAMMA_EXPONENT=1.4", 97 "SK_GAMMA_CONTRAST=0.0", 98 ] 99 } 100 if (is_skia_dev_build && !is_wasm) { 101 defines += [ 102 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1", 103 "GPU_TEST_UTILS=1", 104 ] 105 } 106 libs = [] 107 lib_dirs = [] 108 if (skia_use_gl && skia_use_angle) { 109 defines += [ "SK_ANGLE" ] 110 } 111 if (skia_use_vma) { 112 defines += [ "SK_USE_VMA" ] 113 } 114 if (skia_enable_winuwp) { 115 defines += [ "SK_WINUWP" ] 116 } 117 if (skia_print_sksl_shaders) { 118 defines += [ "SK_PRINT_SKSL_SHADERS" ] 119 } 120 if (skia_print_native_shaders) { 121 defines += [ "SK_PRINT_NATIVE_SHADERS" ] 122 } 123 124 # Temporary staging flag: 125 defines += [ "SK_ENABLE_AVX512_OPTS" ] 126} 127 128# Any code that's linked into Skia-the-library should use this config via += skia_library_configs. 129config("skia_library") { 130 visibility = [ "./*" ] 131 defines = [ "SKIA_IMPLEMENTATION=1" ] 132} 133 134skia_library_configs = [ 135 ":skia_public", 136 ":skia_private", 137 ":skia_library", 138] 139 140# Use for CPU-specific Skia code that needs particular compiler flags. 141template("opts") { 142 if (invoker.enabled) { 143 skia_source_set(target_name) { 144 visibility = [ ":*" ] 145 check_includes = false 146 configs = skia_library_configs 147 forward_variables_from(invoker, "*") 148 if (defined(invoker.configs)) { 149 configs += invoker.configs 150 } 151 } 152 } else { 153 # If not enabled, a phony empty target that swallows all otherwise unused variables. 154 skia_source_set(target_name) { 155 visibility = [ ":*" ] 156 check_includes = false 157 forward_variables_from(invoker, 158 "*", 159 [ 160 "sources", 161 "cflags", 162 ]) 163 } 164 } 165} 166 167is_x86 = current_cpu == "x64" || current_cpu == "x86" 168is_loong64 = current_cpu == "loong64" 169 170opts("hsw") { 171 enabled = is_x86 172 sources = skia_opts.hsw_sources 173 if (is_win) { 174 cflags = [ "/arch:AVX2" ] 175 } else { 176 cflags = [ "-march=haswell" ] 177 } 178} 179 180opts("skx") { 181 enabled = is_x86 182 sources = skia_opts.skx_sources 183 if (is_win) { 184 cflags = [ "/arch:AVX512" ] 185 } else { 186 cflags = [ "-march=skylake-avx512" ] 187 } 188} 189 190opts("lasx") { 191 enabled = is_loong64 192 sources = skia_opts.lasx_sources 193 cflags = [ "-mlasx" ] 194} 195 196# Any feature of Skia that requires third-party code should be optional and use this template. 197template("optional") { 198 if (invoker.enabled) { 199 config(target_name + "_public") { 200 if (defined(invoker.public_defines)) { 201 defines = invoker.public_defines 202 } 203 if (defined(invoker.public_configs)) { 204 configs = invoker.public_configs 205 } 206 } 207 skia_source_set(target_name) { 208 visibility = [ ":*" ] 209 check_includes = false 210 configs = skia_library_configs 211 212 # "*" clobbers the current scope; append to existing configs 213 forward_variables_from(invoker, 214 "*", 215 [ 216 "configs", 217 "public_defines", 218 "sources_for_tests", 219 "sources_when_disabled", 220 ]) 221 if (defined(invoker.configs)) { 222 configs += invoker.configs 223 } 224 all_dependent_configs = [ ":" + target_name + "_public" ] 225 } 226 if (defined(invoker.sources_for_tests) && skia_enable_tools) { 227 skia_source_set(target_name + "_tests") { 228 visibility = [ ":*" ] 229 check_includes = false 230 configs = skia_library_configs 231 232 # "*" clobbers the current scope; append to existing configs 233 forward_variables_from(invoker, 234 "*", 235 [ 236 "configs", 237 "public_defines", 238 "sources", 239 "sources_for_tests", 240 "sources_when_disabled", 241 ]) 242 if (defined(invoker.configs)) { 243 configs += invoker.configs 244 } 245 testonly = true 246 sources = invoker.sources_for_tests 247 if (!defined(deps)) { 248 deps = [] 249 } 250 deps += [ 251 ":test", 252 ":" + target_name, 253 ] 254 all_dependent_configs = [ ":" + target_name + "_public" ] 255 } 256 } 257 } else { 258 skia_source_set(target_name) { 259 visibility = [ ":*" ] 260 configs = skia_library_configs 261 262 # "*" clobbers the current scope; append to existing configs 263 forward_variables_from(invoker, 264 "*", 265 [ 266 "configs", 267 "public", 268 "public_defines", 269 "public_deps", 270 "deps", 271 "libs", 272 "frameworks", 273 "sources", 274 "sources_for_tests", 275 "sources_when_disabled", 276 ]) 277 if (defined(invoker.configs)) { 278 configs += invoker.configs 279 } 280 if (defined(invoker.sources_when_disabled)) { 281 sources = invoker.sources_when_disabled 282 } 283 } 284 if (defined(invoker.sources_for_tests)) { 285 skia_source_set(target_name + "_tests") { 286 visibility = [ ":*" ] 287 } 288 } 289 } 290} 291 292optional("android_utils") { 293 enabled = skia_enable_android_utils 294 295 public = [ 296 "client_utils/android/BRDAllocator.h", 297 "client_utils/android/BitmapRegionDecoder.h", 298 "client_utils/android/FrontBufferedStream.h", 299 ] 300 public_defines = [ "SK_ENABLE_ANDROID_UTILS" ] 301 sources = [ 302 "client_utils/android/BitmapRegionDecoder.cpp", 303 "client_utils/android/FrontBufferedStream.cpp", 304 ] 305} 306 307optional("fontmgr_android") { 308 enabled = skia_enable_fontmgr_android 309 310 deps = [ 311 ":typeface_freetype", 312 ":typeface_proxy", 313 "//third_party/expat", 314 ] 315 public_defines = [ "SK_FONTMGR_ANDROID_AVAILABLE" ] 316 public = skia_ports_fontmgr_android_public 317 sources = skia_ports_fontmgr_android_sources 318 sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ] 319} 320 321# if building Skia for API >= 30 and not using custom fonts, enable 322# skia_enable_fontmgr_android_ndk and disable skia_enable_fontmgr_android 323optional("fontmgr_android_ndk") { 324 enabled = skia_enable_fontmgr_android_ndk 325 326 deps = [ ":typeface_freetype" ] 327 libs = [ "android" ] 328 public_defines = [ "SK_FONTMGR_ANDROID_NDK_AVAILABLE" ] 329 public = skia_ports_fontmgr_android_ndk_public 330 sources = skia_ports_fontmgr_android_ndk_sources 331} 332 333optional("fontmgr_custom") { 334 enabled = 335 skia_enable_fontmgr_custom_directory || 336 skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty 337 338 deps = [ ":typeface_freetype" ] 339 sources = skia_ports_fontmgr_custom_sources 340} 341 342optional("fontmgr_custom_directory") { 343 enabled = skia_enable_fontmgr_custom_directory 344 public_defines = [ "SK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE" ] 345 deps = [ 346 ":fontmgr_custom", 347 ":typeface_freetype", 348 ] 349 public = skia_ports_fontmgr_directory_public 350 sources = skia_ports_fontmgr_directory_sources 351} 352 353optional("fontmgr_custom_embedded") { 354 enabled = skia_enable_fontmgr_custom_embedded 355 public_defines = [ "SK_FONTMGR_FREETYPE_EMBEDDED_AVAILABLE" ] 356 deps = [ 357 ":fontmgr_custom", 358 ":typeface_freetype", 359 ] 360 public = skia_ports_fontmgr_embedded_public 361 sources = skia_ports_fontmgr_embedded_sources 362} 363 364optional("fontmgr_custom_empty") { 365 enabled = skia_enable_fontmgr_custom_empty 366 public_defines = [ "SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE" ] 367 deps = [ 368 ":fontmgr_custom", 369 ":typeface_freetype", 370 ] 371 public = skia_ports_fontmgr_empty_public 372 sources = skia_ports_fontmgr_empty_sources 373} 374 375skia_source_set("typeface_proxy") { 376 configs = [ ":skia_public" ] 377 sources = skia_ports_typeface_proxy_sources 378} 379 380optional("fontmgr_fontconfig") { 381 enabled = skia_enable_fontmgr_fontconfig 382 public_defines = [ "SK_FONTMGR_FONTCONFIG_AVAILABLE" ] 383 384 # The public header includes fontconfig.h and uses FcConfig* 385 public_deps = [ "//third_party:fontconfig" ] 386 public = skia_ports_fontmgr_fontconfig_public 387 deps = [ 388 ":typeface_freetype", 389 ":typeface_proxy", 390 ] 391 sources = skia_ports_fontmgr_fontconfig_sources 392 sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ] 393} 394 395skia_source_set("fontscanner_tests") { 396 testonly = true 397 398 deps = [ ":skia" ] 399 sources = [ 400 "tests/FontScanner.cpp", 401 "tests/FontScanner.h", 402 ] 403} 404 405optional("fontmgr_FontConfigInterface") { 406 enabled = skia_enable_fontmgr_FontConfigInterface 407 408 deps = [ 409 ":typeface_freetype", 410 "//third_party:fontconfig", 411 ] 412 public = skia_ports_fci_public 413 sources = skia_ports_fci_sources 414 sources_for_tests = [ "tests/FCITest.cpp" ] 415} 416 417optional("fontmgr_fontations_empty") { 418 enabled = skia_use_fontations 419 public_defines = [ "SK_FONTMGR_FONTATIONS_AVAILABLE" ] 420 421 deps = [ ":typeface_fontations" ] 422 public = skia_ports_fontmgr_fontations_public 423 sources = skia_ports_fontmgr_fontations_sources 424} 425 426optional("fontmgr_fuchsia") { 427 enabled = skia_enable_fontmgr_fuchsia 428 public_defines = [ "SK_FONTMGR_FUCHSIA_AVAILABLE" ] 429 deps = [] 430 431 if (is_fuchsia && using_fuchsia_sdk) { 432 deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ] 433 } else { 434 deps = [ "//sdk/fidl/fuchsia.fonts" ] 435 } 436 public = skia_ports_fontmgr_fuchsia_public 437 sources = skia_ports_fontmgr_fuchsia_sources 438} 439 440optional("fontmgr_mac_ct") { 441 enabled = skia_use_fonthost_mac 442 443 public_defines = [ 444 "SK_TYPEFACE_FACTORY_CORETEXT", 445 "SK_FONTMGR_CORETEXT_AVAILABLE", 446 ] 447 public = skia_ports_fontmgr_coretext_public 448 sources = skia_ports_fontmgr_coretext_sources 449 sources_for_tests = [ "tests/TypefaceMacTest.cpp" ] 450 451 if (is_mac) { 452 frameworks = [ 453 # AppKit symbols NSFontWeightXXX may be dlsym'ed. 454 "AppKit.framework", 455 "ApplicationServices.framework", 456 ] 457 } 458 459 if (is_ios) { 460 frameworks = [ 461 "CoreFoundation.framework", 462 "CoreGraphics.framework", 463 "CoreText.framework", 464 465 # UIKit symbols UIFontWeightXXX may be dlsym'ed. 466 "UIKit.framework", 467 ] 468 } 469} 470 471optional("fontmgr_win") { 472 enabled = skia_enable_fontmgr_win 473 474 public_defines = [ 475 "SK_TYPEFACE_FACTORY_DIRECTWRITE", 476 "SK_FONTMGR_DIRECTWRITE_AVAILABLE", 477 ] 478 public = skia_ports_windows_fonts_public 479 sources = skia_ports_windows_fonts_sources 480 if (skia_dwritecore_sdk != "") { 481 defines = [ "DWRITE_CORE" ] 482 if (is_win && is_clang) { 483 # Clang complains about these headers, so mark them as system. These 484 # headers are hiding SDK headers of the same name, which are also 485 # included as system headers, so these need to go first in the cflags 486 # "includes" before the SDK. gn appends configs in the order listed, 487 # so these flags will be first. 488 cflags = [ 489 "-imsvc", 490 "${skia_dwritecore_sdk}/include", 491 ] 492 } else { 493 include_dirs = [ "${skia_dwritecore_sdk}/include" ] 494 } 495 } 496} 497 498optional("fontmgr_win_gdi") { 499 enabled = skia_enable_fontmgr_win_gdi 500 public_defines = [ "SK_FONTMGR_GDI_AVAILABLE" ] 501 public = skia_ports_windows_fonts_public 502 sources = skia_ports_fonthost_win_sources 503 libs = [ "Gdi32.lib" ] 504} 505 506if (skia_lex) { 507 skia_executable("sksllex") { 508 sources = [ 509 "src/sksl/lex/DFA.h", 510 "src/sksl/lex/DFAState.h", 511 "src/sksl/lex/LexUtil.h", 512 "src/sksl/lex/Main.cpp", 513 "src/sksl/lex/NFA.cpp", 514 "src/sksl/lex/NFA.h", 515 "src/sksl/lex/NFAState.h", 516 "src/sksl/lex/NFAtoDFA.h", 517 "src/sksl/lex/RegexNode.cpp", 518 "src/sksl/lex/RegexNode.h", 519 "src/sksl/lex/RegexParser.cpp", 520 "src/sksl/lex/RegexParser.h", 521 "src/sksl/lex/TransitionTable.cpp", 522 "src/sksl/lex/TransitionTable.h", 523 ] 524 include_dirs = [ "." ] 525 } 526 527 action("run_sksllex") { 528 script = "gn/run_sksllex.py" 529 deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ] 530 sources = [ "src/sksl/lex/sksl.lex" ] 531 532 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a 533 # path that starts with target_out_dir and then uses ".." to back up into the src dir. 534 outputs = [ 535 "$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir), 536 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets 537 # confused due to the same file being named by two different paths 538 ] 539 sksllex_path = "$root_out_dir/" 540 sksllex_path += "sksllex" 541 if (host_os == "win") { 542 sksllex_path += ".exe" 543 } 544 args = [ 545 rebase_path(sksllex_path), 546 rebase_path("bin/clang-format"), 547 rebase_path("bin/fetch-clang-format"), 548 rebase_path("src"), 549 ] 550 } 551} else { 552 group("run_sksllex") { 553 } 554} 555 556if (skia_compile_modules || skia_compile_sksl_tests) { 557 # Copy the module source files into the same directory as skslc. 558 copy("sksl_modules") { 559 sources = [ 560 "src/sksl/sksl_compute.sksl", 561 "src/sksl/sksl_frag.sksl", 562 "src/sksl/sksl_gpu.sksl", 563 "src/sksl/sksl_graphite_frag.sksl", 564 "src/sksl/sksl_graphite_frag_es2.sksl", 565 "src/sksl/sksl_graphite_vert.sksl", 566 "src/sksl/sksl_graphite_vert_es2.sksl", 567 "src/sksl/sksl_public.sksl", 568 "src/sksl/sksl_rt_shader.sksl", 569 "src/sksl/sksl_shared.sksl", 570 "src/sksl/sksl_vert.sksl", 571 ] 572 skslc_dir = "$root_out_dir/" 573 if (host_toolchain != default_toolchain_name) { 574 skslc_dir += "$host_toolchain/" 575 } 576 outputs = [ "$skslc_dir/{{source_file_part}}" ] 577 } 578} 579 580if (skia_compile_modules) { 581 # Generate the sksl-minify binary. 582 skia_executable("sksl-minify") { 583 defines = [ 584 "SKSL_STANDALONE", 585 "SK_DISABLE_TRACING", 586 ] 587 sources = skslc_deps 588 sources += [ 589 "tools/sksl-minify/SkSLMinify.cpp", 590 "tools/skslc/ProcessWorklist.cpp", 591 "tools/skslc/ProcessWorklist.h", 592 ] 593 libs = [] 594 if (is_win) { 595 sources += [ "src/utils/SkGetExecutablePath_win.cpp" ] 596 } else if (is_mac || is_ios) { 597 sources += [ "src/utils/SkGetExecutablePath_mac.cpp" ] 598 } else if (is_linux || is_android) { 599 sources += [ "src/utils/SkGetExecutablePath_linux.cpp" ] 600 } 601 if (is_win) { 602 sources += skia_ports_windows_sources 603 } else { 604 sources += [ "src/ports/SkOSFile_posix.cpp" ] 605 libs += [ "dl" ] 606 } 607 sources += skia_sksl_core_sources 608 sources += skia_sksl_codegen_sources 609 include_dirs = [ "." ] 610 deps = [ ":run_sksllex" ] 611 } 612 613 sksl_minify_path = "$root_out_dir/" 614 if (host_toolchain != default_toolchain_name) { 615 sksl_minify_path += "$host_toolchain/" 616 } 617 sksl_minify_path += "sksl-minify" 618 if (host_os == "win") { 619 sksl_minify_path += ".exe" 620 } 621 622 # Use minify_sksl.py to precompile all of the modules. 623 minify_sksl_sources = get_target_outputs(":sksl_modules") 624 625 minify_sksl_outputs = [] 626 foreach(src, minify_sksl_sources) { 627 name = get_path_info(src, "name") 628 629 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a 630 # path that starts with target_out_dir and then uses ".." to back up into the src dir. 631 minify_sksl_outputs += [ "$target_out_dir/" + rebase_path( 632 "src/sksl/generated/$name.minified.sksl", 633 target_out_dir) ] 634 minify_sksl_outputs += [ "$target_out_dir/" + rebase_path( 635 "src/sksl/generated/$name.unoptimized.sksl", 636 target_out_dir) ] 637 } 638 639 action("minify_sksl") { 640 script = "gn/minify_sksl.py" 641 deps = [ 642 ":sksl-minify(//gn/toolchain:$host_toolchain)", 643 ":sksl_modules", 644 ] 645 sources = minify_sksl_sources 646 outputs = minify_sksl_outputs 647 args = [ 648 rebase_path(sksl_minify_path), 649 rebase_path("src/sksl/generated"), 650 ] 651 args += rebase_path(minify_sksl_sources) 652 } 653 654 if (skia_compile_sksl_tests) { 655 # Minify our existing .rts files into golden minified outputs. 656 import("gn/sksl_tests.gni") 657 action("minify_sksl_tests") { 658 script = "gn/minify_sksl_tests.py" 659 deps = [ 660 ":sksl-minify(//gn/toolchain:$host_toolchain)", 661 ":sksl_modules", 662 ] 663 sources = [] 664 outputs = [] 665 response_file_contents = [] 666 args = [ 667 # Comments match the variable names in minify_sksl_tests.py 668 rebase_path(sksl_minify_path), # sksl_minify 669 rebase_path("src/sksl/sksl_shared.sksl"), # shared_module 670 rebase_path("src/sksl/sksl_public.sksl"), # public_module 671 rebase_path("src/sksl/sksl_rt_shader.sksl"), # public_module 672 rebase_path("resources"), # input_root_dir 673 rebase_path("tests"), # output_root_dir 674 "{{response_file_name}}", # input_file 675 ] 676 677 testsDir = get_path_info("tests/sksl/", "abspath") 678 resourcesDir = get_path_info("resources/sksl/", "abspath") 679 680 foreach(partialPath, sksl_minify_tests_sources) { 681 dst = testsDir + partialPath 682 src = resourcesDir + partialPath 683 684 dir = get_path_info(dst, "dir") 685 name = get_path_info(dst, "name") 686 ext = get_path_info(dst, "extension") 687 if (ext == "rts" || ext == "privrts" || ext == "rtcf" || ext == "rtb" || 688 ext == "mfrag" || ext == "mvert") { 689 response_file_contents += [ rebase_path(src) ] 690 sources += [ src ] 691 outputs += [ target_out_dir + "/" + 692 rebase_path(dir + "/" + name + ".minified.sksl", 693 target_out_dir) ] 694 } 695 } 696 } 697 } 698} else { 699 group("minify_sksl") { 700 } 701 group("minify_sksl_tests") { 702 } 703} 704 705# `Compile SkSL Tests` relies on skslc and the precompiled modules. 706if (skia_compile_sksl_tests) { 707 # Build skslc. 708 skia_executable("skslc") { 709 defines = [ 710 "SKSL_STANDALONE", 711 "SK_DISABLE_TRACING", 712 "SK_COMPILE_WITH_GN", 713 ] 714 sources = skslc_deps 715 sources += [ 716 "tools/skslc/Main.cpp", 717 "tools/skslc/ProcessWorklist.cpp", 718 "tools/skslc/ProcessWorklist.h", 719 ] 720 libs = [] 721 if (is_win) { 722 sources += [ "src/utils/SkGetExecutablePath_win.cpp" ] 723 } else if (is_mac || is_ios) { 724 sources += [ "src/utils/SkGetExecutablePath_mac.cpp" ] 725 } else if (is_linux || is_android) { 726 sources += [ "src/utils/SkGetExecutablePath_linux.cpp" ] 727 } 728 if (is_win) { 729 sources += skia_ports_windows_sources 730 } else { 731 sources += [ "src/ports/SkOSFile_posix.cpp" ] 732 libs += [ "dl" ] 733 } 734 sources += skia_sksl_codegen_sources 735 sources += skia_sksl_core_sources 736 sources += skia_sksl_hlsl_sources 737 sources += skia_sksl_pipeline_sources 738 sources += skia_sksl_tracing_sources 739 sources += skia_sksl_validate_spirv_sources 740 sources += skia_sksl_validate_wgsl_sources 741 include_dirs = [ "." ] 742 deps = [ 743 ":run_sksllex", 744 "//third_party/externals/dawn/src/tint/api:api", 745 "//third_party/externals/spirv-tools:spvtools", 746 "//third_party/externals/spirv-tools:spvtools_val", 747 "//third_party/spirv-cross:spirv_cross", 748 ] 749 } 750 751 skslc_path = "$root_out_dir/" 752 if (host_toolchain != default_toolchain_name) { 753 skslc_path += "$host_toolchain/" 754 } 755 skslc_path += "skslc" 756 if (host_os == "win") { 757 skslc_path += ".exe" 758 } 759 760 # Build the test files using skslc. 761 import("gn/sksl_tests.gni") 762 template("compile_sksl") { 763 # Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings. 764 action("compile_sksl_${target_name}") { 765 script = "gn/compile_sksl_tests.py" 766 deps = [ 767 ":sksl_modules", 768 ":skslc(//gn/toolchain:$host_toolchain)", 769 ] 770 sources = [] 771 outputs = [] 772 response_file_contents = [] 773 args = [ 774 # Comments are the variable name in compile_sksl_tests.py 775 rebase_path(skslc_path), # skslc 776 invoker.lang, # lang 777 invoker.settings, # settings 778 rebase_path("resources"), # input_root_dir 779 rebase_path("tests"), # output_root_dir 780 "{{response_file_name}}", # input_file 781 ] 782 783 testsDir = get_path_info("tests/sksl/", "abspath") 784 resourcesDir = get_path_info("resources/sksl/", "abspath") 785 786 foreach(partialPath, invoker.sources) { 787 dst = testsDir + partialPath 788 src = resourcesDir + partialPath 789 790 dir = get_path_info(dst, "dir") 791 name = get_path_info(dst, "name") 792 ext = get_path_info(dst, "extension") 793 response_file_contents += [ rebase_path(src) ] 794 sources += [ src ] 795 796 foreach(outExtension, invoker.outExtensions) { 797 # SPIR-V uses separate extensions for .vert and .compute shaders. 798 if (ext == "vert" && outExtension == ".asm.frag") { 799 outExtension = ".asm.vert" 800 } else if (ext == "compute" && outExtension == ".asm.frag") { 801 outExtension = ".asm.comp" 802 } 803 outputs += 804 [ target_out_dir + "/" + 805 rebase_path(dir + "/" + name + outExtension, target_out_dir) ] 806 } 807 } 808 } 809 } 810 compile_sksl("glsl_tests") { 811 sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources 812 outExtensions = [ ".glsl" ] 813 lang = "--glsl" 814 settings = "--settings" 815 } 816 compile_sksl("glsl_nosettings_tests") { 817 sources = sksl_glsl_settings_tests_sources 818 outExtensions = [ "StandaloneSettings.glsl" ] 819 lang = "--glsl" 820 settings = "--nosettings" 821 } 822 compile_sksl("metal_tests") { 823 sources = sksl_metal_tests_sources 824 outExtensions = [ ".metal" ] 825 lang = "--metal" 826 settings = "--settings" 827 } 828 compile_sksl("hlsl_tests") { 829 sources = sksl_hlsl_tests_sources 830 outExtensions = [ ".hlsl" ] 831 lang = "--hlsl" 832 settings = "--settings" 833 } 834 compile_sksl("skrp_tests") { 835 sources = sksl_skrp_tests_sources 836 outExtensions = [ ".skrp" ] 837 lang = "--skrp" 838 settings = "--settings" 839 } 840 compile_sksl("stage_tests") { 841 sources = sksl_stage_tests_sources 842 outExtensions = [ ".stage" ] 843 lang = "--stage" 844 settings = "--settings" 845 } 846 compile_sksl("spirv_tests") { 847 sources = sksl_spirv_tests_sources 848 outExtensions = [ ".asm.frag" ] 849 lang = "--spirv" 850 settings = "--settings" 851 } 852 compile_sksl("wgsl_tests") { 853 sources = sksl_wgsl_tests_sources 854 outExtensions = [ ".wgsl" ] 855 lang = "--wgsl" 856 settings = "--settings" 857 } 858} else { 859 group("compile_sksl_glsl_tests") { 860 } 861 group("compile_sksl_glsl_nosettings_tests") { 862 } 863 group("compile_sksl_metal_tests") { 864 } 865 group("compile_sksl_hlsl_tests") { 866 } 867 group("compile_sksl_skrp_tests") { 868 } 869 group("compile_sksl_spirv_tests") { 870 } 871 group("compile_sksl_wgsl_tests") { 872 } 873} 874 875group("compile_all_sksl_tests") { 876 deps = [ 877 ":compile_sksl_glsl_nosettings_tests", 878 ":compile_sksl_glsl_tests", 879 ":compile_sksl_hlsl_tests", 880 ":compile_sksl_metal_tests", 881 ":compile_sksl_skrp_tests", 882 ":compile_sksl_spirv_tests", 883 ":compile_sksl_wgsl_tests", 884 ] 885} 886 887optional("gpu_shared") { 888 enabled = skia_enable_ganesh || skia_enable_graphite 889 890 configs = [] 891 deps = [] 892 libs = [] 893 public_defines = [] 894 public_deps = [] 895 frameworks = [] 896 897 sources = skia_shared_gpu_sources 898 sources += skia_sksl_pipeline_sources 899 sources += skia_sksl_codegen_sources 900 901 if (skia_use_dawn) { 902 public_defines += [ "SK_DAWN" ] 903 904 # When building for WASM, the WebGPU headers are provided by Emscripten. For native builds we 905 # have to depend on Dawn directly. 906 if (!skia_use_webgpu) { 907 public_deps += [ 908 "//third_party/externals/dawn/include/dawn:cpp_headers", 909 "//third_party/externals/dawn/src/dawn:cpp", 910 "//third_party/externals/dawn/src/dawn:proc", 911 ] 912 913 if (dawn_enable_d3d12 || dawn_enable_d3d11 || dawn_enable_desktop_gl || 914 dawn_enable_metal || dawn_enable_opengles || dawn_enable_vulkan) { 915 public_deps += [ "//third_party/externals/dawn/src/dawn/native" ] 916 } 917 if (dawn_enable_d3d12) { 918 libs += [ 919 "d3d12.lib", 920 "dxgi.lib", 921 "d3dcompiler.lib", 922 ] 923 } else if (dawn_enable_metal) { 924 frameworks += [ "Metal.framework" ] 925 } 926 } 927 } 928 929 if (skia_use_direct3d) { 930 sources += skia_sksl_hlsl_sources 931 deps += [ "//third_party/spirv-cross:spirv_cross" ] 932 } 933 934 if (skia_use_vulkan) { 935 public_defines += [ "SK_VULKAN" ] 936 sources += skia_shared_vk_sources 937 configs += [ ":use_skia_vulkan_headers" ] 938 if (skia_enable_vulkan_debug_layers) { 939 public_defines += [ "SK_ENABLE_VK_LAYERS" ] 940 } 941 if (skia_use_vma) { 942 sources += skia_vma_sources 943 public_deps += [ "src/gpu/vk/vulkanmemoryallocator" ] 944 } 945 } 946 947 if (skia_use_metal) { 948 public_defines += [ "SK_METAL" ] 949 sources += skia_shared_mtl_sources 950 } 951 952 if (is_android) { 953 sources += skia_shared_android_sources 954 } 955} 956 957optional("gpu") { 958 enabled = skia_enable_ganesh 959 deps = [ 960 ":gpu_shared", 961 ":minify_sksl", 962 ":run_sksllex", 963 ] 964 if (skia_generate_workarounds) { 965 deps += [ ":workaround_list" ] 966 } 967 configs = [] 968 public_defines = [] 969 public_configs = [] 970 public_deps = [] 971 972 public = skia_gpu_public 973 sources = skia_ganesh_private 974 975 libs = [] 976 frameworks = [] 977 978 if (is_android) { 979 sources += skia_gpu_android_private 980 981 # this lib is required to link against AHardwareBuffer 982 if (defined(ndk_api) && ndk_api >= 26) { 983 libs += [ "android" ] 984 } 985 } 986 987 if (skia_use_gl) { 988 public_defines += [ "SK_GL" ] 989 if (is_android) { 990 sources += [ 991 "src/gpu/ganesh/gl/egl/GrGLMakeEGLInterface.cpp", 992 "src/gpu/ganesh/gl/egl/GrGLMakeNativeInterface_egl.cpp", 993 ] 994 sources += skia_android_gl_sources 995 996 # this lib is required to link against AHardwareBuffer 997 if (defined(ndk_api) && ndk_api >= 26) { 998 libs += [ "android" ] 999 } 1000 } else if (skia_use_egl) { 1001 if (skia_use_epoxy_egl) { 1002 sources += [ "src/gpu/ganesh/gl/epoxy/GrGLMakeEpoxyEGLInterface.cpp" ] 1003 libs += [ "epoxy" ] 1004 } else { 1005 sources += [ 1006 "src/gpu/ganesh/gl/egl/GrGLMakeEGLInterface.cpp", 1007 "src/gpu/ganesh/gl/egl/GrGLMakeNativeInterface_egl.cpp", 1008 ] 1009 libs += [ "EGL" ] 1010 } 1011 } else if (skia_use_webgl) { 1012 sources += [ "src/gpu/ganesh/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ] 1013 } else if (is_linux && skia_use_x11) { 1014 sources += [ 1015 "src/gpu/ganesh/gl/glx/GrGLMakeGLXInterface.cpp", 1016 "src/gpu/ganesh/gl/glx/GrGLMakeNativeInterface_glx.cpp", 1017 ] 1018 libs += [ "GL" ] 1019 } else if (is_mac) { 1020 sources += [ "src/gpu/ganesh/gl/mac/GrGLMakeNativeInterface_mac.cpp" ] 1021 } else if (is_ios) { 1022 sources += [ "src/gpu/ganesh/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ] 1023 } else if (is_win && !skia_enable_winuwp) { 1024 sources += [ 1025 "src/gpu/ganesh/gl/win/GrGLMakeNativeInterface_win.cpp", 1026 "src/gpu/ganesh/gl/win/GrGLMakeWinInterface.cpp", 1027 ] 1028 if (target_cpu != "arm64") { 1029 libs += [ "OpenGL32.lib" ] 1030 } 1031 } else { 1032 sources += [ "src/gpu/ganesh/gl/GrGLMakeNativeInterface_none.cpp" ] 1033 } 1034 public += skia_gpu_gl_public 1035 sources += skia_gpu_gl_private 1036 } 1037 1038 if (skia_use_vulkan) { 1039 public += skia_gpu_vk_public 1040 sources += skia_gpu_vk_private 1041 configs += [ ":use_skia_vulkan_headers" ] 1042 if (is_fuchsia) { 1043 if (using_fuchsia_sdk) { 1044 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ] 1045 } else { 1046 public_deps += [ "//src/graphics/lib/vulkan" ] 1047 } 1048 } 1049 if (is_android) { 1050 sources += skia_gpu_vk_android_private 1051 } 1052 } 1053 1054 if (skia_use_direct3d) { 1055 public_defines += [ "SK_DIRECT3D" ] 1056 deps += [ "//third_party/d3d12allocator" ] 1057 sources += skia_direct3d_sources 1058 if (skia_enable_direct3d_debug_layer) { 1059 public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ] 1060 } 1061 libs += [ 1062 "d3d12.lib", 1063 "dxgi.lib", 1064 "d3dcompiler.lib", 1065 ] 1066 } 1067 1068 cflags_objcc = [] 1069 if (skia_use_metal) { 1070 public_defines += [ "SK_METAL" ] 1071 public += skia_gpu_metal_public 1072 sources += skia_gpu_metal_private 1073 sources += skia_gpu_metal_cpp 1074 if (skia_enable_metal_debug_info) { 1075 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ] 1076 } 1077 frameworks += [ "Metal.framework" ] 1078 frameworks += [ "Foundation.framework" ] 1079 if (is_ios) { 1080 frameworks += [ "UIKit.framework" ] 1081 } 1082 cflags_objcc += [ "-fobjc-arc" ] 1083 } 1084 1085 if (is_debug || skia_build_for_debugger) { 1086 public_defines += [ "SK_ENABLE_DUMP_GPU" ] 1087 } 1088} 1089 1090optional("vello") { 1091 enabled = skia_enable_vello_shaders 1092 public_defines = [ "SK_ENABLE_VELLO_SHADERS" ] 1093 public_deps = [ "//third_party/vello" ] 1094} 1095 1096optional("heif") { 1097 enabled = skia_use_libheif 1098 public_defines = [ "SK_HAS_HEIF_LIBRARY" ] 1099 1100 # This HEIF decoding functionality is a part of the Android Framework. 1101 # https://android.googlesource.com/platform/frameworks/av/+/master/media/libheif/include/HeifDecoderAPI.h 1102 # There isn't a way to compile that library outside of it, so we just link against 1103 # the library. This feature is not supported on other platforms (and we haven't 1104 # yet tried something like https://github.com/strukturag/libheif/tree/master/libheif). 1105 # The dependency for Android is set in gn_to_bp.py. 1106 deps = [] 1107 1108 sources = [ "src/codec/SkHeifCodec.cpp" ] 1109} 1110 1111optional("avif") { 1112 enabled = skia_use_libavif 1113 public_defines = [ "SK_CODEC_DECODES_AVIF" ] 1114 1115 deps = [ "//third_party/libavif" ] 1116 1117 sources = [ "src/codec/SkAvifCodec.cpp" ] 1118} 1119 1120optional("crabbyavif") { 1121 enabled = skia_use_crabbyavif 1122 public_defines = [ "SK_CODEC_DECODES_AVIF" ] 1123 1124 # AVIF decoding is provided by CrabbyAvif (a Rust library). Since skia's 1125 # standalone builds do not support Rust, it is only being enabled when 1126 # building for the Android framework. 1127 # The dependency for Android is set in gn_to_bp.py 1128 deps = [] 1129 sources = [ "src/codec/SkCrabbyAvifCodec.cpp" ] 1130} 1131 1132optional("jpeg_mpf") { 1133 enabled = skia_use_jpeg_gainmaps && 1134 (skia_use_libjpeg_turbo_encode || skia_use_libjpeg_turbo_decode) 1135 sources = [ 1136 "src/codec/SkJpegMultiPicture.cpp", 1137 "src/codec/SkJpegSegmentScan.cpp", 1138 ] 1139} 1140 1141optional("jpeg_decode") { 1142 enabled = skia_use_libjpeg_turbo_decode 1143 public_defines = [ "SK_CODEC_DECODES_JPEG" ] 1144 1145 deps = [ "//third_party/libjpeg-turbo:libjpeg" ] 1146 sources = [ 1147 "src/codec/SkJpegCodec.cpp", 1148 "src/codec/SkJpegDecoderMgr.cpp", 1149 "src/codec/SkJpegMetadataDecoderImpl.cpp", 1150 "src/codec/SkJpegSourceMgr.cpp", 1151 "src/codec/SkJpegUtility.cpp", 1152 ] 1153 if (skia_use_jpeg_gainmaps) { 1154 # Theoretically this doesn't need to be public, but this allows gn_to_bp.py to see it, and seems 1155 # to align with other codec support. See b/265939413 1156 public_defines += [ "SK_CODEC_DECODES_JPEG_GAINMAPS" ] 1157 deps += [ 1158 ":jpeg_mpf", 1159 ":xml", 1160 ] 1161 sources += skia_codec_jpeg_xmp 1162 } 1163} 1164 1165optional("jpeg_encode") { 1166 enabled = skia_use_libjpeg_turbo_encode && !skia_use_ndk_images 1167 1168 deps = [ "//third_party/libjpeg-turbo:libjpeg" ] 1169 public = skia_encode_jpeg_public 1170 sources = skia_encode_jpeg_srcs 1171 1172 if (skia_use_jpeg_gainmaps) { 1173 deps += [ ":jpeg_mpf" ] 1174 sources += [ "src/encode/SkJpegGainmapEncoder.cpp" ] 1175 } 1176} 1177 1178optional("jpegxl_decode") { 1179 enabled = skia_use_libjxl_decode 1180 public_defines = [ "SK_CODEC_DECODES_JPEGXL" ] 1181 1182 deps = [ "//third_party/libjxl" ] 1183 sources = [ "src/codec/SkJpegxlCodec.cpp" ] 1184} 1185 1186optional("ndk_images") { 1187 enabled = skia_use_ndk_images 1188 public_defines = [ "SK_ENABLE_NDK_IMAGES" ] 1189 sources = [ 1190 "src/ports/SkImageEncoder_NDK.cpp", 1191 "src/ports/SkImageGeneratorNDK.cpp", 1192 "src/ports/SkNDKConversions.cpp", 1193 ] 1194 libs = [ "jnigraphics" ] 1195} 1196 1197optional("graphite") { 1198 configs = [] 1199 libs = [] 1200 frameworks = [] 1201 public_defines = [] 1202 1203 enabled = skia_enable_graphite 1204 deps = [ 1205 ":gpu_shared", 1206 ":vello", 1207 ] 1208 public = skia_graphite_public 1209 sources = skia_graphite_sources 1210 sources += skia_sksl_graphite_modules_sources 1211 1212 if (is_android) { 1213 sources += skia_graphite_android_private 1214 } 1215 1216 if (skia_enable_vello_shaders) { 1217 sources += skia_graphite_vello_sources 1218 } 1219 1220 if (skia_use_dawn) { 1221 public += skia_graphite_dawn_public 1222 sources += skia_graphite_dawn_sources 1223 } 1224 if (skia_use_metal) { 1225 public_defines += [ "SK_METAL" ] 1226 public += skia_graphite_mtl_public 1227 sources += skia_graphite_mtl_sources 1228 if (skia_enable_metal_debug_info) { 1229 public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ] 1230 } 1231 frameworks += [ "Metal.framework" ] 1232 frameworks += [ "Foundation.framework" ] 1233 if (is_ios) { 1234 frameworks += [ "UIKit.framework" ] 1235 } 1236 } 1237 if (skia_use_vulkan) { 1238 public += skia_graphite_vk_public 1239 sources += skia_graphite_vk_sources 1240 configs += [ ":use_skia_vulkan_headers" ] 1241 } 1242 if (skia_enable_precompile) { 1243 public += skia_graphite_precompile_public 1244 sources += skia_graphite_precompile_sources 1245 } 1246} 1247 1248optional("pdf") { 1249 enabled = skia_use_zlib && skia_enable_pdf && skia_use_libjpeg_turbo_decode && 1250 skia_use_libjpeg_turbo_encode 1251 public_defines = [ "SK_SUPPORT_PDF" ] 1252 1253 deps = [ "//third_party/zlib" ] 1254 public = skia_pdf_public 1255 sources = skia_pdf_sources 1256 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ] 1257 if (skia_pdf_subset_harfbuzz) { 1258 deps += [ "//third_party/harfbuzz" ] 1259 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ] 1260 } 1261 deps += [ 1262 ":jpeg_decode", 1263 ":jpeg_encode", 1264 ] 1265} 1266 1267optional("xps") { 1268 enabled = skia_use_xps && is_win 1269 public_defines = [ "SK_SUPPORT_XPS" ] 1270 public = skia_xps_public 1271 sources = skia_xps_sources 1272} 1273 1274optional("png_decode") { 1275 enabled = skia_use_libpng_decode 1276 public_defines = [ 1277 "SK_CODEC_DECODES_ICO", 1278 "SK_CODEC_DECODES_PNG", 1279 ] 1280 1281 deps = [ "//third_party/libpng" ] 1282 sources = [ "src/codec/SkIcoCodec.cpp" ] + skia_codec_png 1283} 1284 1285optional("png_encode") { 1286 enabled = skia_use_libpng_encode && !skia_use_ndk_images 1287 public = skia_encode_png_public 1288 1289 deps = [ "//third_party/libpng" ] 1290 sources = skia_encode_png_srcs 1291} 1292 1293optional("raw") { 1294 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex 1295 public_defines = [ "SK_CODEC_DECODES_RAW" ] 1296 1297 deps = [ 1298 "//third_party/dng_sdk", 1299 "//third_party/libjpeg-turbo:libjpeg", 1300 "//third_party/piex", 1301 ] 1302 1303 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of 1304 # Skia. 1305 configs = [ "gn/portable:add_exceptions" ] 1306 1307 sources = [ "src/codec/SkRawCodec.cpp" ] 1308} 1309 1310optional("typeface_freetype") { 1311 enabled = skia_use_freetype 1312 1313 public_defines = [ "SK_TYPEFACE_FACTORY_FREETYPE" ] 1314 deps = [ "//third_party/freetype2" ] 1315 sources = skia_ports_freetype_sources 1316 sources_for_tests = [ "tests/FontScanner_FreeTypeTest.cpp" ] 1317} 1318 1319bazel_args = [] 1320if (is_mac && target_cpu == "arm64") { 1321 # TODO: Normally the target toolchain would be specified with `--platforms` but that doesn't 1322 # work. When building and running on an arm64 mac, setting `--host_platform` seems to do the 1323 # right thing but may not be the right build configuration in the long run. 1324 bazel_args += [ "--host_platform=//bazel/platform:mac_arm64_hermetic" ] 1325} 1326if (is_debug) { 1327 bazel_args += [ "--compilation_mode=dbg" ] 1328} else { 1329 bazel_args += [ "--compilation_mode=opt" ] 1330} 1331 1332if (skia_use_fontations) { 1333 action("fontations_rust_side_bazel_build") { 1334 script = "gn/bazel_build.py" 1335 sources = [ 1336 "src/ports/fontations/BUILD.bazel", 1337 "src/ports/fontations/src/ffi.rs", 1338 ] 1339 outputs = [ "$root_out_dir/libbridge_rust_side.a" ] 1340 args = 1341 [ 1342 "//src/ports/fontations:bridge_rust_side", 1343 rebase_path("//bazel-bin/src/ports/fontations/libbridge_rust_side.a", 1344 root_build_dir), 1345 ] + bazel_args 1346 } 1347 1348 # We only use Bazel to get the generated `.cc` and `.h` file and then compile 1349 # them on GN/ninja side using `skia_source_set` below. This ensures that the 1350 # same C++ stdlib and compiler is used throughout the build (in some scenarios 1351 # Bazel may end up using different ones). 1352 action("fontations_ffi_bazel_build") { 1353 script = "gn/bazel_build.py" 1354 sources = [ 1355 "src/ports/fontations/BUILD.bazel", 1356 "src/ports/fontations/src/ffi.rs", 1357 ] 1358 outputs = [ 1359 "$root_out_dir/src/ports/fontations/src/ffi.rs.h", 1360 "$root_out_dir/src/ports/fontations/src/ffi.rs.cc", 1361 ] 1362 args = [ 1363 "//src/ports/fontations:fontations_ffi", 1364 1365 # we want the header to not simply be copied into the output directory, 1366 # but in the same path as the Bazel build uses. 1367 rebase_path("//bazel-bin/src/ports/fontations/src/ffi.rs.h", 1368 root_build_dir) + "=src/ports/fontations/src/ffi.rs.h", 1369 rebase_path("//bazel-bin/src/ports/fontations/src/ffi.rs.cc", 1370 root_build_dir) + 1371 "=src/ports/fontations/src/ffi.rs.cc", 1372 ] + bazel_args 1373 } 1374 config("fontations_ffi_public_config") { 1375 include_dirs = [ 1376 # This is where `src/ports/fontations/src/ffi.rs.h` was put by Bazel 1377 "$root_out_dir", 1378 ] 1379 } 1380 config("fontations_ffi_private_config") { 1381 include_dirs = [ 1382 # This entry is needed so that `ffi.rs.cc` can resolve 1383 # `#include "src/ports/fontations/src/ffi.rs.h"` 1384 ".", 1385 ] 1386 } 1387 skia_source_set("fontations_ffi") { 1388 deps = [ 1389 ":fontations_ffi_bazel_build", 1390 ":fontations_rust_side_bazel_build", 1391 ] 1392 public = [ "${root_out_dir}/src/ports/fontations/src/ffi.rs.h" ] 1393 sources = [ "${root_out_dir}/src/ports/fontations/src/ffi.rs.cc" ] 1394 libs = [ "$root_out_dir/libbridge_rust_side.a" ] 1395 public_configs = [ ":fontations_ffi_public_config" ] 1396 configs = [ ":fontations_ffi_private_config" ] 1397 } 1398} 1399 1400optional("typeface_fontations") { 1401 public_defines = [ "SK_TYPEFACE_FACTORY_FONTATIONS" ] 1402 enabled = skia_use_fontations 1403 public_deps = [ ":fontations_ffi" ] 1404 sources = skia_ports_typeface_fontations_sources 1405 sources_for_tests = [ 1406 "tests/FontationsTest.cpp", 1407 "tests/FontationsFtCompTest.cpp", 1408 "tests/FontScanner_FontationsTest.cpp", 1409 ] 1410} 1411 1412if (skia_use_rust_png_decode || skia_use_rust_png_encode) { 1413 # We only use Bazel to get the generated `.cc` and `.h` file and then compile 1414 # them on GN/ninja side using `skia_source_set` below. This ensures that the 1415 # same C++ stdlib and compiler is used throughout the build (in some scenarios 1416 # Bazel may end up using different ones). 1417 action("rust_png_ffi_bazel_build") { 1418 script = "gn/bazel_build.py" 1419 sources = [ 1420 "experimental/rust_png/ffi/BUILD.bazel", 1421 "experimental/rust_png/ffi/FFI.h", 1422 "experimental/rust_png/ffi/FFI.rs", 1423 ] 1424 outputs = [ 1425 "$root_out_dir/librust_png_ffi_rs.a", 1426 "$root_out_dir/experimental/rust_png/ffi/FFI.rs.h", 1427 "$root_out_dir/experimental/rust_png/ffi/FFI.rs.cc", 1428 ] 1429 args = 1430 [ 1431 "//experimental/rust_png/ffi:*", 1432 1433 rebase_path("//bazel-bin/experimental/rust_png/ffi/libffi_rs.a", 1434 root_build_dir) + "=librust_png_ffi_rs.a", 1435 1436 # we want the `cxx`-generated headers to not simply be copied into 1437 # the output directory, but in the same path as the Bazel build 1438 # uses. 1439 rebase_path("//bazel-bin/experimental/rust_png/ffi/FFI.rs.h", 1440 root_build_dir) + "=experimental/rust_png/ffi/FFI.rs.h", 1441 rebase_path("//bazel-bin/experimental/rust_png/ffi/FFI.rs.cc", 1442 root_build_dir) + "=experimental/rust_png/ffi/FFI.rs.cc", 1443 ] + bazel_args 1444 } 1445 action("rust_png_cxx_core_bazel_build") { 1446 script = "gn/bazel_build.py" 1447 sources = [ 1448 "WORKSPACE.bazel", 1449 "bazel/external/cxx/BUILD.bazel", 1450 "bazel/external/cxx/BUILD.bazel.skia", 1451 ] 1452 outputs = [ 1453 "$root_out_dir/librust_png_cxx_core_lib.a", 1454 "$root_out_dir/third_party/rust/cxx/v1/cxx.h", 1455 ] 1456 args = [ 1457 "@cxx//:core-lib", 1458 1459 rebase_path("//bazel-bin/external/cxx/libcore-lib.a", 1460 root_build_dir) + "=librust_png_cxx_core_lib.a", 1461 1462 # we want the `cxx.h` header to not simply be copied into the 1463 # output directory, but in the same path as the Bazel build uses. 1464 rebase_path( 1465 "//bazel-bin/external/cxx/_virtual_includes/core-lib/third_party/rust/cxx/v1/cxx.h", 1466 root_build_dir) + "=third_party/rust/cxx/v1/cxx.h", 1467 ] + bazel_args 1468 } 1469 config("rust_png_cxx_bridge_public_config") { 1470 include_dirs = [ 1471 # This is where `experimental/rust_png/ffi/FFI.rs.h` and 1472 # `third_party/rust/cxx/v1/cxx.h` were put by Bazel 1473 "$root_out_dir", 1474 ] 1475 } 1476 config("rust_png_cxx_bridge_private_config") { 1477 include_dirs = [ 1478 # This entry is needed so that `FFI.rs.cc` can resolve 1479 # `#include "experimental/rust_png/ffi/FFI.h"` 1480 ".", 1481 ] 1482 } 1483 skia_source_set("rust_png_cxx_bridge") { 1484 deps = [ ":rust_png_ffi_bazel_build" ] 1485 public = [ "${root_out_dir}/experimental/rust_png/ffi/FFI.rs.h" ] 1486 sources = [ "${root_out_dir}/experimental/rust_png/ffi/FFI.rs.cc" ] 1487 libs = [ "$root_out_dir/librust_png_ffi_rs.a" ] 1488 public_configs = [ ":rust_png_cxx_bridge_public_config" ] 1489 configs = [ ":rust_png_cxx_bridge_private_config" ] 1490 } 1491} 1492 1493optional("rust_png_decode") { 1494 public_defines = [ "SK_USE_RUST_PNG_DECODE" ] 1495 enabled = skia_use_rust_png_decode 1496 public = skia_codec_rust_png_public # From `gn/codec.gni` 1497 sources = skia_codec_rust_png # From `gn/codec.gni` 1498 sources_for_tests = [ "tests/SkPngRustDecoderTest.cpp" ] 1499 1500 deps = [ 1501 ":rust_png_cxx_bridge", 1502 ":rust_png_cxx_core_bazel_build", 1503 ] 1504 libs = [ "$root_out_dir/librust_png_cxx_core_lib.a" ] 1505} 1506 1507optional("rust_png_encode") { 1508 public_defines = [ "SK_USE_RUST_PNG_ENCODE" ] 1509 enabled = skia_use_rust_png_encode 1510 public = skia_encode_rust_png_public # From `gn/core.gni` 1511 sources = 1512 skia_encode_rust_png_srcs + skia_encode_png_base # From `gn/core.gni` 1513 sources_for_tests = [ "tests/SkPngRustEncoderTest.cpp" ] 1514 deps = [ 1515 ":rust_png_cxx_bridge", 1516 ":rust_png_cxx_core_bazel_build", 1517 ] 1518 libs = [ "$root_out_dir/librust_png_cxx_core_lib.a" ] 1519} 1520 1521optional("webp_decode") { 1522 enabled = skia_use_libwebp_decode 1523 public_defines = [ "SK_CODEC_DECODES_WEBP" ] 1524 1525 deps = [ "//third_party/libwebp" ] 1526 sources = [ "src/codec/SkWebpCodec.cpp" ] 1527} 1528 1529optional("webp_encode") { 1530 enabled = skia_use_libwebp_encode && !skia_use_ndk_images 1531 public = skia_encode_webp_public 1532 1533 deps = [ "//third_party/libwebp" ] 1534 sources = skia_encode_webp_srcs 1535} 1536 1537optional("wuffs") { 1538 enabled = skia_use_wuffs 1539 public_defines = [ 1540 "SK_HAS_WUFFS_LIBRARY", 1541 "SK_CODEC_DECODES_GIF", 1542 ] 1543 1544 deps = [ "//third_party/wuffs" ] 1545 sources = [ "src/codec/SkWuffsCodec.cpp" ] 1546} 1547 1548optional("xml") { 1549 enabled = skia_use_expat || skia_use_jpeg_gainmaps 1550 public_defines = [ "SK_XML" ] 1551 1552 deps = [ "//third_party/expat" ] 1553 sources = skia_xml_sources + skia_codec_xmp + [ 1554 "src/svg/SkSVGCanvas.cpp", 1555 "src/svg/SkSVGDevice.cpp", 1556 ] 1557} 1558 1559if (skia_enable_ganesh && skia_generate_workarounds) { 1560 action("workaround_list") { 1561 script = "tools/build_workaround_header.py" 1562 1563 inputs = [ "src/gpu/gpu_workaround_list.txt" ] 1564 1565 # GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a 1566 # path that starts with root_out_dir and then uses ".." to back up into the src dir. 1567 output_file = 1568 rebase_path("include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h", 1569 root_out_dir) 1570 1571 outputs = [ "$root_out_dir/$output_file" ] 1572 args = [ 1573 "--output-file", 1574 "$output_file", 1575 ] 1576 1577 foreach(file, inputs) { 1578 args += [ rebase_path(file, root_build_dir) ] 1579 } 1580 } 1581} 1582 1583import("gn/codec.gni") 1584 1585skia_component("skia") { 1586 public_configs = [ ":skia_public" ] 1587 configs = skia_library_configs 1588 1589 public_deps = [ 1590 ":fontmgr_FontConfigInterface", 1591 ":fontmgr_android", 1592 ":fontmgr_android_ndk", 1593 ":fontmgr_custom_directory", 1594 ":fontmgr_custom_embedded", 1595 ":fontmgr_custom_empty", 1596 ":fontmgr_fontations_empty", 1597 ":fontmgr_fontconfig", 1598 ":fontmgr_fuchsia", 1599 ":fontmgr_mac_ct", 1600 ":fontmgr_win", 1601 ":fontmgr_win_gdi", 1602 ":gpu", 1603 ":graphite", 1604 ":jpeg_encode", 1605 ":pdf", 1606 ":png_encode", 1607 ":webp_encode", 1608 ":xps", 1609 ] 1610 1611 deps = [ 1612 ":android_utils", 1613 ":avif", 1614 ":crabbyavif", 1615 ":heif", 1616 ":hsw", 1617 ":jpeg_decode", 1618 ":jpegxl_decode", 1619 ":lasx", 1620 ":minify_sksl", 1621 ":ndk_images", 1622 ":png_decode", 1623 ":raw", 1624 ":skx", 1625 ":typeface_fontations", 1626 ":vello", 1627 ":webp_decode", 1628 ":wuffs", 1629 ":xml", 1630 "modules/skcms", 1631 ] 1632 1633 public = skia_core_public 1634 public += skia_codec_public 1635 public += skia_utils_public 1636 public += skia_effects_public 1637 public += skia_effects_imagefilter_public 1638 1639 sources = [] 1640 sources += skia_core_sources 1641 sources += skia_utils_private 1642 sources += skia_utils_chromium 1643 sources += skia_effects_sources 1644 sources += skia_colorfilters_sources 1645 sources += skia_effects_imagefilter_sources 1646 sources += skia_codec_shared 1647 sources += skia_codec_decode_bmp 1648 sources += skia_encode_srcs 1649 sources += skia_sksl_core_sources 1650 sources += skia_sksl_core_module_sources 1651 sources += skia_sksl_tracing_sources 1652 sources += skia_ports_sources 1653 sources += [ 1654 "src/android/SkAndroidFrameworkUtils.cpp", 1655 "src/android/SkAnimatedImage.cpp", 1656 "src/codec/SkAndroidCodec.cpp", 1657 "src/codec/SkAndroidCodecAdapter.cpp", 1658 "src/codec/SkSampledCodec.cpp", 1659 "src/ports/SkDiscardableMemory_none.cpp", 1660 "src/ports/SkMemory_malloc.cpp", 1661 "src/sfnt/SkOTTable_name.cpp", 1662 "src/sfnt/SkOTUtils.cpp", 1663 ] 1664 1665 defines = [] 1666 libs = [] 1667 1668 if (skia_build_for_debugger) { 1669 defines += [ "SK_BUILD_FOR_DEBUGGER" ] 1670 } 1671 1672 if (skia_use_no_jpeg_encode) { 1673 sources += skia_no_encode_jpeg_srcs 1674 } 1675 if (skia_use_no_png_encode) { 1676 sources += skia_no_encode_png_srcs 1677 } 1678 if (skia_use_no_webp_encode) { 1679 sources += skia_no_encode_webp_srcs 1680 } 1681 1682 if (is_win) { 1683 sources += skia_ports_windows_sources + [ 1684 "src/ports/SkDebug_win.cpp", 1685 "src/ports/SkImageGeneratorWIC.cpp", 1686 ] 1687 libs += [ 1688 "Ole32.lib", 1689 "OleAut32.lib", 1690 ] 1691 1692 if (!skia_enable_winuwp) { 1693 libs += [ 1694 "FontSub.lib", 1695 "User32.lib", 1696 "Usp10.lib", 1697 ] 1698 } 1699 } else { 1700 sources += [ "src/ports/SkOSFile_posix.cpp" ] 1701 if (is_ios) { 1702 sources += [ "src/ports/SkOSFile_ios.h" ] 1703 } 1704 libs += [ "dl" ] 1705 } 1706 1707 if (is_android) { 1708 deps += [ "//third_party/expat" ] 1709 if (defined(ndk) && ndk != "") { 1710 deps += [ "//third_party/cpu-features" ] 1711 } 1712 sources += [ "src/ports/SkDebug_android.cpp" ] 1713 libs += [ 1714 "EGL", 1715 "GLESv2", 1716 "log", 1717 ] 1718 } 1719 1720 if (is_linux || is_wasm) { 1721 sources += [ "src/ports/SkDebug_stdio.cpp" ] 1722 if (skia_use_egl) { 1723 libs += [ "GLESv2" ] 1724 } 1725 } 1726 1727 if (is_mac) { 1728 public += [ "include/ports/SkCFObject.h" ] 1729 sources += [ 1730 "src/ports/SkDebug_stdio.cpp", 1731 "src/ports/SkImageGeneratorCG.cpp", 1732 ] 1733 frameworks = [ 1734 "ApplicationServices.framework", 1735 "OpenGL.framework", 1736 ] 1737 } 1738 1739 if (is_ios) { 1740 public += [ "include/ports/SkCFObject.h" ] 1741 sources += [ 1742 "src/ports/SkDebug_stdio.cpp", 1743 "src/ports/SkImageGeneratorCG.cpp", 1744 ] 1745 frameworks = [ 1746 "CoreFoundation.framework", 1747 "ImageIO.framework", 1748 "MobileCoreServices.framework", 1749 ] 1750 } 1751 1752 if (is_fuchsia) { 1753 sources += [ "src/ports/SkDebug_stdio.cpp" ] 1754 } 1755 1756 if (skia_enable_spirv_validation) { 1757 deps += [ "//third_party/externals/spirv-tools:spvtools_val" ] 1758 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ] 1759 } 1760 1761 if (skia_include_multiframe_procs) { 1762 sources += [ "tools/SkSharingProc.cpp" ] 1763 } 1764 1765 # Overrides TRACE_EVENT0..2 macros (etc) to map to Perfetto's tracing macros. 1766 # Currently only supported in Android framework. 1767 if (skia_android_framework_use_perfetto) { 1768 defines += [ "SK_ANDROID_FRAMEWORK_USE_PERFETTO" ] 1769 sources += [ "src/android/SkAndroidFrameworkPerfettoStaticStorage.cpp" ] 1770 } 1771 1772 if (!skia_enable_ganesh && !skia_enable_graphite) { 1773 sources += skia_no_slug_srcs 1774 } 1775} 1776 1777# DebugCanvas used in experimental/wasm-skp-debugger 1778if (is_wasm) { 1779 skia_static_library("debugcanvas") { 1780 public_configs = [ ":skia_public" ] 1781 1782 sources = [ 1783 "tools/SkSharingProc.cpp", 1784 "tools/UrlDataManager.cpp", 1785 "tools/debugger/DebugCanvas.cpp", 1786 "tools/debugger/DebugLayerManager.cpp", 1787 "tools/debugger/DrawCommand.cpp", 1788 "tools/debugger/JsonWriteBuffer.cpp", 1789 ] 1790 } 1791} 1792 1793skia_static_library("pathkit") { 1794 check_includes = false 1795 public_configs = [ ":skia_public" ] 1796 configs = skia_library_configs 1797 1798 deps = [ ":hsw" ] 1799 1800 sources = [] 1801 sources += skia_pathops_sources 1802 sources += skia_pathops_public 1803 sources += [ 1804 "src/base/SkArenaAlloc.cpp", 1805 "src/base/SkBezierCurves.cpp", 1806 "src/base/SkContainers.cpp", 1807 "src/base/SkCubics.cpp", 1808 "src/base/SkFloatingPoint.cpp", 1809 "src/base/SkMalloc.cpp", 1810 "src/base/SkMathPriv.cpp", 1811 "src/base/SkQuads.cpp", 1812 "src/base/SkSafeMath.cpp", 1813 "src/base/SkSemaphore.cpp", 1814 "src/base/SkTDArray.cpp", 1815 "src/base/SkThreadID.cpp", 1816 "src/base/SkUTF.cpp", 1817 "src/base/SkUtils.cpp", 1818 "src/core/SkAnalyticEdge.cpp", 1819 "src/core/SkContourMeasure.cpp", 1820 "src/core/SkCubicMap.cpp", 1821 "src/core/SkEdge.cpp", 1822 "src/core/SkEdgeBuilder.cpp", 1823 "src/core/SkEdgeClipper.cpp", 1824 "src/core/SkGeometry.cpp", 1825 "src/core/SkIDChangeListener.cpp", 1826 "src/core/SkLineClipper.cpp", 1827 "src/core/SkMallocPixelRef.cpp", 1828 "src/core/SkMatrix.cpp", 1829 "src/core/SkOpts.cpp", 1830 "src/core/SkPaint.cpp", 1831 "src/core/SkPaintPriv.cpp", 1832 "src/core/SkPath.cpp", 1833 "src/core/SkPathBuilder.cpp", 1834 "src/core/SkPathEffect.cpp", 1835 "src/core/SkPathMeasure.cpp", 1836 "src/core/SkPathRef.cpp", 1837 "src/core/SkPathUtils.cpp", 1838 "src/core/SkPoint.cpp", 1839 "src/core/SkRRect.cpp", 1840 "src/core/SkReadBuffer.cpp", 1841 "src/core/SkRect.cpp", 1842 "src/core/SkStream.cpp", 1843 "src/core/SkString.cpp", 1844 "src/core/SkStringUtils.cpp", 1845 "src/core/SkStroke.cpp", 1846 "src/core/SkStrokeRec.cpp", 1847 "src/core/SkStrokerPriv.cpp", 1848 "src/effects/SkDashPathEffect.cpp", 1849 "src/effects/SkTrimPathEffect.cpp", 1850 "src/ports/SkDebug_stdio.cpp", 1851 "src/ports/SkMemory_malloc.cpp", 1852 "src/utils/SkDashPath.cpp", 1853 "src/utils/SkParse.cpp", 1854 "src/utils/SkParsePath.cpp", 1855 ] 1856} 1857 1858group("modules") { 1859 deps = [ 1860 "modules/bentleyottmann", 1861 "modules/skottie", 1862 "modules/skparagraph", 1863 "modules/skshaper", 1864 "modules/svg", 1865 ] 1866 1867 if (is_wasm) { 1868 deps += [ "modules/canvaskit" ] 1869 } 1870} 1871 1872config("use_skia_vulkan_headers") { 1873 include_dirs = [ "include/third_party/vulkan" ] 1874 defines = [ "SK_USE_INTERNAL_VULKAN_HEADERS" ] 1875} 1876 1877config("vulkan_memory_allocator") { 1878 include_dirs = [ "$skia_vulkan_memory_allocator_dir/include" ] 1879} 1880 1881# Targets guarded by skia_enable_tools may use //third_party freely. 1882if (skia_enable_tools) { 1883 skia_public_includes = [ 1884 "client_utils/android", 1885 "include/android", 1886 "include/codec", 1887 "include/config", 1888 "include/core", 1889 "include/docs", 1890 "include/effects", 1891 "include/encode", 1892 "include/gpu", 1893 "include/pathops", 1894 "include/ports", 1895 "include/svg", 1896 "include/utils", 1897 "include/utils/mac", 1898 "modules/skottie/include", 1899 "modules/skparagraph/include", 1900 "modules/skshaper/include", 1901 "modules/svg/include", 1902 ] 1903 1904 # Used by gn_to_bp.py to list our public include dirs. 1905 skia_source_set("public") { 1906 configs = [ ":skia_public" ] 1907 include_dirs = skia_public_includes 1908 } 1909 1910 config("skia.h_config") { 1911 include_dirs = [ "$target_gen_dir" ] 1912 } 1913 action("skia.h") { 1914 public_configs = [ ":skia.h_config" ] 1915 skia_h = "$target_gen_dir/skia.h" 1916 script = "gn/find_headers.py" 1917 1918 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] + 1919 [ rebase_path(skia_h, root_build_dir) ] + 1920 rebase_path(skia_public_includes) 1921 depfile = "$skia_h.deps" 1922 outputs = [ skia_h ] 1923 } 1924 1925 if (is_linux && target_cpu == "x64") { 1926 skia_executable("fiddle") { 1927 check_includes = false 1928 libs = [] 1929 sources = [ 1930 "tools/fiddle/draw.cpp", 1931 "tools/fiddle/fiddle_main.cpp", 1932 ] 1933 1934 if (skia_use_egl) { 1935 sources += [ "tools/fiddle/egl_context.cpp" ] 1936 } else { 1937 sources += [ "tools/fiddle/null_context.cpp" ] 1938 } 1939 testonly = true 1940 deps = [ 1941 ":flags", 1942 ":gpu_tool_utils", 1943 ":skia", 1944 ":skia.h", 1945 "modules/skottie", 1946 "modules/skparagraph", 1947 "modules/skshaper", 1948 "modules/svg", 1949 ] 1950 } 1951 } 1952 1953 config("cpp17") { 1954 if (is_win) { 1955 cflags_cc = [ "/std:c++17" ] 1956 } else { 1957 cflags_cc = [ "-std=c++17" ] 1958 } 1959 } 1960 1961 skia_source_set("public_headers_warnings_check") { 1962 sources = [ "tools/public_headers_warnings_check.cpp" ] 1963 configs = [ 1964 ":use_skia_vulkan_headers", 1965 ":cpp17", 1966 ] 1967 if (defined(skia_header_target_default_configs)) { 1968 configs += skia_header_target_default_configs 1969 } 1970 deps = [ 1971 ":skia", 1972 ":skia.h", 1973 "modules/skottie", 1974 "modules/skshaper", 1975 ] 1976 1977 if (skia_use_dawn) { 1978 deps += [ "//third_party/externals/dawn/include/dawn:headers" ] 1979 } 1980 } 1981 1982 template("test_lib") { 1983 config(target_name + "_config") { 1984 if (defined(invoker.public_defines)) { 1985 defines = invoker.public_defines 1986 } 1987 } 1988 skia_source_set(target_name) { 1989 forward_variables_from(invoker, "*", []) 1990 check_includes = false 1991 public_configs = [ 1992 ":" + target_name + "_config", 1993 ":skia_private", 1994 ] 1995 1996 if (!defined(deps)) { 1997 deps = [] 1998 } 1999 deps += [ ":skia" ] 2000 testonly = true 2001 } 2002 } 2003 2004 template("test_app") { 2005 if (is_ios) { 2006 ios_app_bundle(target_name) { 2007 forward_variables_from(invoker, 2008 "*", 2009 [ 2010 "output_name", 2011 "visibility", 2012 "is_shared_library", 2013 ]) 2014 testonly = true 2015 extra_configs = [ ":skia_private" ] 2016 launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard" 2017 data_sources = [ "resources" ] 2018 if ("True" == exec_script("//gn/checkdir.py", 2019 [ rebase_path("skps", root_build_dir) ], 2020 "trim string")) { 2021 data_sources += [ "skps" ] 2022 } 2023 if ("True" == exec_script("//gn/checkdir.py", 2024 [ rebase_path("mskps", root_build_dir) ], 2025 "trim string")) { 2026 data_sources += [ "mskps" ] 2027 } 2028 } 2029 } else { 2030 # !is_ios 2031 2032 if (defined(invoker.is_shared_library) && invoker.is_shared_library) { 2033 skia_shared_library("lib" + target_name) { 2034 output_dir = root_build_dir 2035 forward_variables_from(invoker, "*", [ "is_shared_library" ]) 2036 if (!defined(configs)) { 2037 configs = [] 2038 } 2039 configs += [ ":skia_private" ] 2040 testonly = true 2041 } 2042 } else { 2043 _executable = target_name 2044 skia_executable(_executable) { 2045 check_includes = false 2046 output_dir = root_build_dir 2047 forward_variables_from(invoker, "*", [ "is_shared_library" ]) 2048 if (!defined(configs)) { 2049 configs = [] 2050 } 2051 configs += [ ":skia_private" ] 2052 testonly = true 2053 } 2054 } 2055 if (is_android && skia_android_serial != "" && defined(_executable)) { 2056 action("push_" + target_name) { 2057 output_dir = root_build_dir 2058 script = "gn/push_to_android.py" 2059 deps = [ ":" + _executable ] 2060 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial" 2061 outputs = [ _stamp ] 2062 args = [ 2063 rebase_path("$root_build_dir/$_executable"), 2064 skia_android_serial, 2065 rebase_path(_stamp), 2066 ] 2067 testonly = true 2068 } 2069 } 2070 } 2071 } 2072 2073 test_lib("load_dynamic_library") { 2074 configs = [ ":skia_private" ] 2075 deps = [ ":skia" ] 2076 sources = [ "tools/library/LoadDynamicLibrary.h" ] 2077 if (is_win) { 2078 sources += [ "tools/library/LoadDynamicLibrary_win.cpp" ] 2079 } else { 2080 sources += [ "tools/library/LoadDynamicLibrary_posix.cpp" ] 2081 } 2082 } 2083 2084 test_lib("gpu_tool_utils") { 2085 public_defines = [] 2086 2087 # Bots and even devs may not have Vulkan headers, so put 2088 # include/third_party/vulkan on our path so they're always available. 2089 all_dependent_configs = [ ":use_skia_vulkan_headers" ] 2090 2091 defines = [] 2092 if (skia_enable_discrete_gpu) { 2093 defines += [ "SK_ENABLE_DISCRETE_GPU" ] 2094 } 2095 2096 deps = [ ":load_dynamic_library" ] 2097 public_deps = [] 2098 sources = [ 2099 "tools/gpu/BackendSurfaceFactory.cpp", 2100 "tools/gpu/BackendSurfaceFactory.h", 2101 "tools/gpu/BackendTextureImageFactory.cpp", 2102 "tools/gpu/BackendTextureImageFactory.h", 2103 "tools/gpu/ContextType.cpp", 2104 "tools/gpu/ContextType.h", 2105 "tools/gpu/FlushFinishTracker.cpp", 2106 "tools/gpu/FlushFinishTracker.h", 2107 "tools/gpu/GrContextFactory.cpp", 2108 "tools/gpu/GrContextFactory.h", 2109 "tools/gpu/GrTest.cpp", 2110 "tools/gpu/ManagedBackendTexture.cpp", 2111 "tools/gpu/ManagedBackendTexture.h", 2112 "tools/gpu/MemoryCache.cpp", 2113 "tools/gpu/MemoryCache.h", 2114 "tools/gpu/ProtectedUtils.cpp", 2115 "tools/gpu/ProtectedUtils.h", 2116 "tools/gpu/ProxyUtils.cpp", 2117 "tools/gpu/ProxyUtils.h", 2118 "tools/gpu/TestCanvas.cpp", 2119 "tools/gpu/TestCanvas.h", 2120 "tools/gpu/TestContext.cpp", 2121 "tools/gpu/TestOps.cpp", 2122 "tools/gpu/TestOps.h", 2123 "tools/gpu/YUVUtils.cpp", 2124 "tools/gpu/YUVUtils.h", 2125 "tools/gpu/mock/MockTestContext.cpp", 2126 "tools/text/gpu/TextBlobTools.cpp", 2127 ] 2128 2129 libs = [] 2130 frameworks = [] 2131 2132 if (skia_use_gl) { 2133 sources += [ "tools/gpu/gl/GLTestContext.cpp" ] 2134 if (is_ios) { 2135 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ] 2136 frameworks += [ "OpenGLES.framework" ] 2137 } else if (is_mac) { 2138 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ] 2139 } 2140 if (skia_use_angle) { 2141 deps += [ "//third_party/angle2" ] 2142 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ] 2143 } 2144 } 2145 2146 if (skia_use_gl && target_cpu != "wasm") { 2147 if (is_android || skia_use_egl) { 2148 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ] 2149 libs += [ "EGL" ] 2150 } else if (is_linux) { 2151 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ] 2152 libs += [ 2153 "GLU", 2154 "GL", 2155 "X11", 2156 ] 2157 } else if (is_win) { 2158 sources += [ 2159 "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp", 2160 "tools/gpu/gl/win/SkWGL.h", 2161 "tools/gpu/gl/win/SkWGL_win.cpp", 2162 ] 2163 libs += [ "Gdi32.lib" ] 2164 if (target_cpu != "arm64") { 2165 libs += [ "OpenGL32.lib" ] 2166 } 2167 } 2168 } 2169 2170 if (skia_use_vulkan) { 2171 sources += [ "tools/gpu/vk/VkTestContext.h" ] 2172 sources += [ "tools/gpu/vk/VkTestContext.cpp" ] 2173 sources += [ "tools/gpu/vk/VkTestHelper.h" ] 2174 sources += [ "tools/gpu/vk/VkTestHelper.cpp" ] 2175 sources += [ "tools/gpu/vk/VkTestMemoryAllocator.h" ] 2176 sources += [ "tools/gpu/vk/VkTestMemoryAllocator.cpp" ] 2177 sources += [ "tools/gpu/vk/VkTestUtils.h" ] 2178 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ] 2179 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ] 2180 sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ] 2181 all_dependent_configs += [ ":vulkan_memory_allocator" ] 2182 } 2183 if (skia_use_metal) { 2184 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ] 2185 } 2186 if (skia_use_direct3d) { 2187 sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ] 2188 sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ] 2189 } 2190 if (skia_use_dawn) { 2191 public_deps += [ "//third_party/externals/dawn/include/dawn:headers" ] 2192 if (is_clang) { 2193 cflags_cc = [ "-Wno-microsoft-cast" ] 2194 } 2195 } 2196 if (!skia_enable_ganesh) { 2197 sources -= [ "tools/gpu/GrTest.cpp" ] 2198 sources -= [ "tools/gpu/TestOps.cpp" ] 2199 sources -= [ "tools/gpu/TestOps.h" ] 2200 } else { 2201 sources += [ 2202 "tools/gpu/ganesh/AtlasTextOpTools.cpp", 2203 "tools/gpu/ganesh/AtlasTextOpTools.h", 2204 "tools/gpu/ganesh/GrAtlasTools.cpp", 2205 "tools/gpu/ganesh/GrAtlasTools.h", 2206 ] 2207 } 2208 if (skia_enable_graphite) { 2209 sources += [ 2210 "tools/graphite/ContextFactory.cpp", 2211 "tools/graphite/ContextFactory.h", 2212 "tools/graphite/GraphiteTestContext.cpp", 2213 "tools/graphite/GraphiteTestContext.h", 2214 "tools/graphite/GraphiteToolUtils.cpp", 2215 "tools/graphite/GraphiteToolUtils.h", 2216 "tools/graphite/ProtectedUtils_Graphite.cpp", 2217 "tools/graphite/UniqueKeyUtils.cpp", 2218 "tools/graphite/UniqueKeyUtils.h", 2219 ] 2220 if (skia_use_dawn) { 2221 sources += [ 2222 "tools/graphite/dawn/GraphiteDawnTestContext.cpp", 2223 "tools/graphite/dawn/GraphiteDawnTestContext.h", 2224 ] 2225 } 2226 if (skia_use_metal) { 2227 sources += [ 2228 "tools/graphite/mtl/GraphiteMtlTestContext.h", 2229 "tools/graphite/mtl/GraphiteMtlTestContext.mm", 2230 ] 2231 } 2232 if (skia_use_vulkan) { 2233 sources += [ 2234 "tools/graphite/vk/GraphiteVulkanTestContext.cpp", 2235 "tools/graphite/vk/GraphiteVulkanTestContext.h", 2236 ] 2237 } 2238 } 2239 2240 if (is_fuchsia && using_fuchsia_sdk) { 2241 libs += 2242 [ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ] 2243 } 2244 } # test_lib("gpu_tool_utils") 2245 2246 test_lib("flags") { 2247 sources = [ 2248 "tools/flags/CommandLineFlags.cpp", 2249 "tools/flags/CommandLineFlags.h", 2250 ] 2251 } 2252 2253 test_lib("common_flags_config") { 2254 sources = [ 2255 "tools/flags/CommonFlags.h", 2256 "tools/flags/CommonFlagsConfig.cpp", 2257 "tools/flags/CommonFlagsConfig.h", 2258 ] 2259 deps = [ ":flags" ] 2260 public_deps = [ ":gpu_tool_utils" ] 2261 } 2262 test_lib("common_flags_gpu") { 2263 sources = [ "tools/flags/CommonFlagsGanesh.cpp" ] 2264 deps = [ ":flags" ] 2265 public_deps = [ ":gpu_tool_utils" ] 2266 } 2267 test_lib("common_flags_graphite") { 2268 sources = [ "tools/flags/CommonFlagsGraphite.cpp" ] 2269 deps = [ ":flags" ] 2270 public_deps = [ ":gpu_tool_utils" ] 2271 } 2272 test_lib("common_flags_images") { 2273 sources = [ "tools/flags/CommonFlagsImages.cpp" ] 2274 deps = [ ":flags" ] 2275 } 2276 2277 test_lib("trace") { 2278 deps = [ ":flags" ] 2279 sources = [ 2280 "tools/trace/ChromeTracingTracer.cpp", 2281 "tools/trace/ChromeTracingTracer.h", 2282 "tools/trace/EventTracingPriv.cpp", 2283 "tools/trace/EventTracingPriv.h", 2284 "tools/trace/SkDebugfTracer.cpp", 2285 "tools/trace/SkDebugfTracer.h", 2286 ] 2287 if (skia_use_perfetto) { 2288 deps += [ "//third_party/perfetto" ] 2289 sources += [ 2290 "tools/trace/SkPerfettoTrace.cpp", 2291 "tools/trace/SkPerfettoTrace.h", 2292 ] 2293 defines = [ "SK_USE_PERFETTO" ] 2294 } 2295 } 2296 2297 test_lib("tool_utils") { 2298 sources = [ 2299 "tools/AndroidSkDebugToStdOut.cpp", 2300 "tools/AutoreleasePool.h", 2301 "tools/DDLPromiseImageHelper.cpp", 2302 "tools/DDLPromiseImageHelper.h", 2303 "tools/DDLTileHelper.cpp", 2304 "tools/DDLTileHelper.h", 2305 "tools/DecodeUtils.cpp", 2306 "tools/DecodeUtils.h", 2307 "tools/EncodeUtils.cpp", 2308 "tools/EncodeUtils.h", 2309 "tools/GpuToolUtils.h", 2310 "tools/LsanSuppressions.cpp", 2311 "tools/MSKPPlayer.cpp", 2312 "tools/MSKPPlayer.h", 2313 "tools/ProcStats.cpp", 2314 "tools/ProcStats.h", 2315 "tools/Resources.cpp", 2316 "tools/Resources.h", 2317 "tools/RuntimeBlendUtils.cpp", 2318 "tools/RuntimeBlendUtils.h", 2319 "tools/SkMetaData.cpp", 2320 "tools/SkMetaData.h", 2321 "tools/SkSharingProc.cpp", 2322 "tools/SkSharingProc.h", 2323 "tools/Stats.h", 2324 "tools/TestFontDataProvider.cpp", 2325 "tools/TestFontDataProvider.h", 2326 "tools/ToolUtils.cpp", 2327 "tools/ToolUtils.h", 2328 "tools/TsanSuppressions.cpp", 2329 "tools/UrlDataManager.cpp", 2330 "tools/UrlDataManager.h", 2331 "tools/debugger/DebugCanvas.cpp", 2332 "tools/debugger/DebugCanvas.h", 2333 "tools/debugger/DebugLayerManager.cpp", 2334 "tools/debugger/DebugLayerManager.h", 2335 "tools/debugger/DrawCommand.cpp", 2336 "tools/debugger/DrawCommand.h", 2337 "tools/debugger/JsonWriteBuffer.cpp", 2338 "tools/debugger/JsonWriteBuffer.h", 2339 "tools/fonts/FontToolUtils.cpp", 2340 "tools/fonts/FontToolUtils.h", 2341 "tools/fonts/RandomScalerContext.cpp", 2342 "tools/fonts/RandomScalerContext.h", 2343 "tools/fonts/TestEmptyTypeface.h", 2344 "tools/fonts/TestFontMgr.cpp", 2345 "tools/fonts/TestFontMgr.h", 2346 "tools/fonts/TestSVGTypeface.cpp", 2347 "tools/fonts/TestSVGTypeface.h", 2348 "tools/fonts/TestTypeface.cpp", 2349 "tools/fonts/TestTypeface.h", 2350 "tools/text/SkTextBlobTrace.cpp", 2351 "tools/text/SkTextBlobTrace.h", 2352 "tools/timer/TimeUtils.h", 2353 "tools/timer/Timer.cpp", 2354 "tools/timer/Timer.h", 2355 ] 2356 if (skia_enable_svg) { 2357 sources += [ 2358 "tools/SvgPathExtractor.cpp", 2359 "tools/SvgPathExtractor.h", 2360 ] 2361 } 2362 if (target_cpu != "wasm") { 2363 sources += [ "tools/CrashHandler.cpp" ] 2364 } 2365 libs = [] 2366 frameworks = [] 2367 if (is_ios) { 2368 sources += [ "tools/ios_utils.m" ] 2369 sources += [ "tools/ios_utils.h" ] 2370 sources += [ "tools/AutoreleasePool.mm" ] 2371 frameworks += [ "Foundation.framework" ] 2372 } else if (is_mac) { 2373 sources += [ "tools/AutoreleasePool.mm" ] 2374 frameworks += [ "Foundation.framework" ] 2375 } else if (is_win && !skia_enable_winuwp) { 2376 libs += [ "DbgHelp.lib" ] 2377 } 2378 2379 defines = [] 2380 if (skia_tools_require_resources) { 2381 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ] 2382 } 2383 deps = [ ":flags" ] 2384 if (skia_enable_svg) { 2385 deps += [ "modules/svg" ] 2386 } 2387 public_deps = [ ":gpu_tool_utils" ] 2388 } 2389 2390 test_lib("etc1") { 2391 sources = [ "third_party/etc1/etc1.cpp" ] 2392 } 2393 2394 import("gn/gm.gni") 2395 test_lib("gm") { 2396 sources = gm_sources 2397 if (skia_use_gl) { 2398 sources += gl_gm_sources 2399 } 2400 if (!skia_enable_ganesh) { 2401 sources -= ganesh_gm_sources 2402 } 2403 if (skia_use_fontations) { 2404 sources += fontations_gm_sources 2405 } 2406 deps = [ 2407 ":etc1", 2408 ":flags", 2409 ":skia", 2410 ":tool_utils", 2411 "modules/skottie", 2412 "modules/skottie:gm", 2413 "modules/skparagraph", 2414 "modules/skparagraph:gm", 2415 "modules/skresources", 2416 "modules/skshaper", 2417 ] 2418 if (is_skia_dev_build) { 2419 sources += [ "gm/fiddle.cpp" ] 2420 deps += [ ":skia.h" ] 2421 } 2422 public_deps = [ ":gpu_tool_utils" ] 2423 2424 if (skia_use_ffmpeg) { 2425 deps += [ "experimental/ffmpeg:video_decoder" ] 2426 sources += [ "gm/video_decoder.cpp" ] 2427 } 2428 } 2429 2430 test_lib("test") { 2431 sources = [ 2432 "tests/CtsEnforcement.cpp", 2433 "tests/Test.cpp", 2434 "tests/Test.h", 2435 "tests/TestHarness.cpp", 2436 "tests/TestHarness.h", 2437 "tests/TestUtils.cpp", 2438 "tests/TestUtils.h", 2439 ] 2440 deps = [ 2441 ":flags", 2442 ":skia", 2443 ":tool_utils", 2444 ] 2445 public_deps = [ 2446 ":gpu_tool_utils", # Test.h #includes headers from this target. 2447 ] 2448 } 2449 2450 import("gn/tests.gni") 2451 test_lib("tests") { 2452 sources = tests_sources + pathops_tests_sources 2453 frameworks = [] 2454 if (skia_use_metal) { 2455 sources += metal_tests_sources 2456 cflags_objcc = [ "-fobjc-arc" ] 2457 frameworks += [ "MetalKit.framework" ] 2458 } 2459 if (skia_use_jpeg_gainmaps) { 2460 sources += jpeg_gainmap_tests_sources 2461 } 2462 if (skia_use_gl) { 2463 sources += gl_tests_sources 2464 } 2465 if (skia_use_vulkan) { 2466 sources += skia_gpu_vk_chromium_public 2467 sources += skia_gpu_vk_chromium_private 2468 } 2469 if (skia_enable_graphite) { 2470 sources += graphite_tests_sources 2471 if (skia_use_dawn) { 2472 sources += graphite_dawn_tests_sources 2473 } 2474 if (skia_use_metal) { 2475 sources += graphite_metal_tests_sources 2476 } 2477 if (skia_use_vulkan) { 2478 sources += graphite_vulkan_tests_sources 2479 } 2480 } 2481 if (!skia_enable_ganesh) { 2482 sources -= ganesh_tests_sources 2483 } 2484 if (skia_enable_precompile) { 2485 sources += precompile_tests_sources 2486 } 2487 deps = [ 2488 ":flags", 2489 ":fontmgr_android_tests", 2490 ":fontmgr_fontconfig_tests", 2491 ":fontmgr_mac_ct_tests", 2492 ":fontscanner_tests", 2493 ":rust_png_decode_tests", 2494 ":rust_png_encode_tests", 2495 ":skia", 2496 ":test", 2497 ":tool_utils", 2498 ":typeface_fontations_tests", 2499 "modules/bentleyottmann:tests", 2500 "modules/skottie:tests", 2501 "modules/skparagraph:tests", 2502 "modules/sksg:tests", 2503 "modules/skshaper", 2504 "modules/skshaper:tests", 2505 "modules/skunicode:tests", 2506 "modules/svg:tests", 2507 "//third_party/libpng", 2508 "//third_party/libwebp", 2509 "//third_party/zlib", 2510 ] 2511 } 2512 2513 import("gn/bench.gni") 2514 test_lib("bench") { 2515 sources = bench_sources 2516 if (skia_enable_graphite) { 2517 sources += graphite_bench_sources 2518 } 2519 if (!skia_enable_ganesh) { 2520 sources -= ganesh_bench_sources 2521 } 2522 deps = [ 2523 ":flags", 2524 ":gm", 2525 ":gpu_tool_utils", 2526 ":skia", 2527 ":tool_utils", 2528 "modules/skparagraph:bench", 2529 "modules/skshaper", 2530 ] 2531 } 2532 2533 if (is_linux || is_mac || skia_enable_optimize_size) { 2534 if (skia_enable_skottie) { 2535 test_app("skottie_tool") { 2536 deps = [ "modules/skottie:tool" ] 2537 } 2538 test_app("skottie_tool_cpu") { 2539 deps = [ "modules/skottie:tool_cpu" ] 2540 } 2541 test_app("skottie_tool_gpu") { 2542 deps = [ "modules/skottie:tool_gpu" ] 2543 } 2544 test_app("skottie_preshape_tool") { 2545 deps = [ "modules/skottie:preshape_tool" ] 2546 } 2547 } 2548 if (skia_enable_svg && skia_use_expat && defined(is_skia_standalone)) { 2549 test_app("svg_tool") { 2550 deps = [ "modules/svg:tool" ] 2551 } 2552 } 2553 } 2554 2555 test_lib("hash_and_encode") { 2556 sources = [ 2557 "tools/HashAndEncode.cpp", 2558 "tools/HashAndEncode.h", 2559 ] 2560 deps = [ 2561 ":flags", 2562 ":skia", 2563 "//third_party/libpng", 2564 ] 2565 } 2566 if (target_cpu != "wasm") { 2567 test_app("convert-to-nia") { 2568 sources = [ "tools/convert-to-nia.cpp" ] 2569 deps = [ ":skia" ] 2570 } 2571 test_app("imgcvt") { 2572 sources = [ "tools/imgcvt.cpp" ] 2573 configs = [ ":use_skia_vulkan_headers" ] 2574 deps = [ 2575 ":skia", 2576 "modules/skcms", 2577 ] 2578 } 2579 test_app("dm") { 2580 sources = [ 2581 "dm/DM.cpp", 2582 "dm/DMGpuTestProcs.cpp", 2583 "dm/DMJsonWriter.cpp", 2584 "dm/DMJsonWriter.h", 2585 "dm/DMSrcSink.cpp", 2586 "dm/DMSrcSink.h", 2587 ] 2588 deps = [ 2589 ":common_flags_config", 2590 ":common_flags_gpu", 2591 ":common_flags_graphite", 2592 ":common_flags_images", 2593 ":compile_all_sksl_tests", 2594 ":flags", 2595 ":gm", 2596 ":gpu_tool_utils", 2597 ":hash_and_encode", 2598 ":skia", 2599 ":tests", 2600 ":tool_utils", 2601 ":trace", 2602 "modules/skottie", 2603 "modules/skottie:utils", 2604 "modules/skshaper", 2605 "modules/skunicode", 2606 "modules/svg", 2607 ] 2608 } 2609 test_app("filterfuzz") { 2610 sources = [ "experimental/filterfuzz/filterfuzz.cpp" ] 2611 deps = [ 2612 ":flags", 2613 ":skia", 2614 ":tool_utils", 2615 ] 2616 } 2617 2618 if (!skia_enable_optimize_size && !skia_use_fontations && 2619 !skia_enable_vello_shaders) { 2620 # optional separate library to dlopen when running CanvasStateTests. 2621 skia_shared_library("canvas_state_lib") { 2622 sources = [ 2623 "tests/CanvasStateHelpers.cpp", 2624 "tests/CanvasStateHelpers.h", 2625 ] 2626 deps = [ ":skia" ] 2627 } 2628 } 2629 } 2630 2631 if (!is_win) { 2632 test_app("blob_cache_sim") { 2633 sources = [ "tools/blob_cache_sim.cpp" ] 2634 deps = [ 2635 ":skia", 2636 ":tool_utils", 2637 ] 2638 } 2639 } 2640 2641 test_app("nanobench") { 2642 sources = [ 2643 "bench/nanobench.cpp", 2644 "bench/nanobench.h", 2645 ] 2646 deps = [ 2647 ":bench", 2648 ":common_flags_config", 2649 ":common_flags_gpu", 2650 ":common_flags_graphite", 2651 ":common_flags_images", 2652 ":flags", 2653 ":gm", 2654 ":gpu_tool_utils", 2655 ":skia", 2656 ":tool_utils", 2657 ":trace", 2658 "modules/skparagraph", 2659 "modules/skshaper", 2660 "modules/skunicode", 2661 "modules/svg", 2662 ] 2663 } 2664 2665 test_app("skpinfo") { 2666 sources = [ "tools/skpinfo.cpp" ] 2667 configs = [ ":use_skia_vulkan_headers" ] 2668 deps = [ 2669 ":flags", 2670 ":skia", 2671 ] 2672 } 2673 2674 if (skia_use_ffmpeg) { 2675 test_app("skottie2movie") { 2676 sources = [ "tools/skottie2movie.cpp" ] 2677 deps = [ 2678 ":flags", 2679 ":gpu_tool_utils", 2680 ":skia", 2681 "experimental/ffmpeg:video_encoder", 2682 "modules/skottie", 2683 "modules/skottie:utils", 2684 ] 2685 } 2686 } 2687 2688 test_app("skpbench") { 2689 sources = [ 2690 "bench/BigPath.cpp", 2691 "tools/skpbench/skpbench.cpp", 2692 ] 2693 deps = [ 2694 ":common_flags_config", 2695 ":common_flags_gpu", 2696 ":flags", 2697 ":gpu_tool_utils", 2698 ":skia", 2699 ":tool_utils", 2700 ] 2701 } 2702 2703 if (is_linux && skia_use_icu) { 2704 test_app("sktexttopdf") { 2705 sources = [ "tools/using_skia_and_harfbuzz.cpp" ] 2706 deps = [ 2707 ":skia", 2708 "modules/skshaper", 2709 ] 2710 } 2711 } 2712 2713 if (is_linux || is_mac) { 2714 test_app("create_test_font") { 2715 sources = [ "tools/fonts/create_test_font.cpp" ] 2716 deps = [ ":skia" ] 2717 assert_no_deps = [ 2718 # tool_utils requires the output of this app. 2719 ":tool_utils", 2720 ] 2721 } 2722 } 2723 2724 if (skia_use_expat) { 2725 test_app("create_test_font_color") { 2726 sources = [ "tools/fonts/create_test_font_color.cpp" ] 2727 deps = [ 2728 ":flags", 2729 ":skia", 2730 ":tool_utils", 2731 "//modules/svg", 2732 ] 2733 } 2734 } 2735 2736 test_app("get_images_from_skps") { 2737 sources = [ "tools/get_images_from_skps.cpp" ] 2738 deps = [ 2739 ":flags", 2740 ":skia", 2741 ] 2742 } 2743 2744 if (!is_ios && target_cpu != "wasm" && 2745 !((is_win || is_mac) && target_cpu == "arm64")) { 2746 test_app("skiaserve") { 2747 sources = [ 2748 "tools/skiaserve/Request.cpp", 2749 "tools/skiaserve/Response.cpp", 2750 "tools/skiaserve/skiaserve.cpp", 2751 "tools/skiaserve/urlhandlers/BreakHandler.cpp", 2752 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp", 2753 "tools/skiaserve/urlhandlers/CmdHandler.cpp", 2754 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp", 2755 "tools/skiaserve/urlhandlers/DataHandler.cpp", 2756 "tools/skiaserve/urlhandlers/DownloadHandler.cpp", 2757 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp", 2758 "tools/skiaserve/urlhandlers/ImgHandler.cpp", 2759 "tools/skiaserve/urlhandlers/InfoHandler.cpp", 2760 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp", 2761 "tools/skiaserve/urlhandlers/OpsHandler.cpp", 2762 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp", 2763 "tools/skiaserve/urlhandlers/PostHandler.cpp", 2764 "tools/skiaserve/urlhandlers/QuitHandler.cpp", 2765 "tools/skiaserve/urlhandlers/RootHandler.cpp", 2766 ] 2767 deps = [ 2768 ":flags", 2769 ":gpu_tool_utils", 2770 ":skia", 2771 ":tool_utils", 2772 "//third_party/libmicrohttpd", 2773 ] 2774 } 2775 } 2776 2777 test_app("fuzz") { 2778 sources = [ 2779 "fuzz/Fuzz.cpp", 2780 "fuzz/Fuzz.h", 2781 "fuzz/FuzzCanvas.cpp", 2782 "fuzz/FuzzCommon.cpp", 2783 "fuzz/FuzzCommon.h", 2784 "fuzz/FuzzCreateDDL.cpp", 2785 "fuzz/FuzzCubicRoots.cpp", 2786 "fuzz/FuzzDDLThreading.cpp", 2787 "fuzz/FuzzDrawFunctions.cpp", 2788 "fuzz/FuzzEncoders.cpp", 2789 "fuzz/FuzzGradients.cpp", 2790 "fuzz/FuzzMain.cpp", 2791 "fuzz/FuzzParsePath.cpp", 2792 "fuzz/FuzzPathMeasure.cpp", 2793 "fuzz/FuzzPathop.cpp", 2794 "fuzz/FuzzPolyUtils.cpp", 2795 "fuzz/FuzzQuadRoots.cpp", 2796 "fuzz/FuzzRegionOp.cpp", 2797 "fuzz/FuzzSkParagraph.cpp", 2798 "fuzz/FuzzTriangulation.cpp", 2799 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp", 2800 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp", 2801 "fuzz/oss_fuzz/FuzzCOLRv1.cpp", 2802 "fuzz/oss_fuzz/FuzzColorspace.cpp", 2803 "fuzz/oss_fuzz/FuzzImage.cpp", 2804 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp", 2805 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp", 2806 "fuzz/oss_fuzz/FuzzJSON.cpp", 2807 "fuzz/oss_fuzz/FuzzParsePath.cpp", 2808 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp", 2809 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp", 2810 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp", 2811 "fuzz/oss_fuzz/FuzzSKP.cpp", 2812 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp", 2813 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp", 2814 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp", 2815 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp", 2816 "fuzz/oss_fuzz/FuzzSKSL2WGSL.cpp", 2817 "fuzz/oss_fuzz/FuzzSVG.cpp", 2818 "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp", 2819 "fuzz/oss_fuzz/FuzzSkMeshSpecification.cpp", 2820 "fuzz/oss_fuzz/FuzzSkParagraph.cpp", 2821 "fuzz/oss_fuzz/FuzzSkRuntimeBlender.cpp", 2822 "fuzz/oss_fuzz/FuzzSkRuntimeColorFilter.cpp", 2823 "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp", 2824 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp", 2825 "tools/UrlDataManager.cpp", 2826 "tools/debugger/DebugCanvas.cpp", 2827 "tools/debugger/DebugLayerManager.cpp", 2828 "tools/debugger/DrawCommand.cpp", 2829 "tools/debugger/JsonWriteBuffer.cpp", 2830 "tools/fonts/FontToolUtils.cpp", 2831 ] 2832 if (skia_enable_graphite && skia_enable_precompile) { 2833 sources += [ "fuzz/FuzzPrecompile.cpp" ] 2834 } 2835 deps = [ 2836 ":flags", 2837 ":gpu_tool_utils", 2838 ":skia", 2839 "modules/skottie:fuzz", 2840 "modules/skparagraph", 2841 "modules/svg", 2842 ] 2843 } 2844 2845 test_app("dump_record") { 2846 sources = [ "tools/dump_record.cpp" ] 2847 deps = [ 2848 ":flags", 2849 ":skia", 2850 ] 2851 } 2852 2853 test_app("skdiff") { 2854 sources = [ 2855 "tools/skdiff/skdiff.cpp", 2856 "tools/skdiff/skdiff_html.cpp", 2857 "tools/skdiff/skdiff_main.cpp", 2858 "tools/skdiff/skdiff_utils.cpp", 2859 ] 2860 deps = [ ":skia" ] 2861 } 2862 2863 test_app("skp_parser") { 2864 sources = [ "tools/skp_parser.cpp" ] 2865 deps = [ 2866 ":skia", 2867 ":tool_utils", 2868 ] 2869 } 2870 2871 if (!is_win) { 2872 source_set("skqp_lib") { # Not a skia_source_set 2873 check_includes = false 2874 testonly = true 2875 public_configs = [ ":skia_private" ] 2876 sources = [ 2877 "tools/skqp/src/skqp.cpp", 2878 "tools/skqp/src/skqp.h", 2879 "tools/skqp/src/skqp_GpuTestProcs.cpp", 2880 ] 2881 deps = [ 2882 ":gm", 2883 ":skia", 2884 ":tests", 2885 ":tool_utils", 2886 ] 2887 } 2888 test_app("skqp") { 2889 sources = [ "tools/skqp/src/skqp_main.cpp" ] 2890 include_dirs = [ "//" ] 2891 lib_dirs = [] 2892 deps = [ ":skqp_lib" ] 2893 } 2894 } 2895 if (is_fuchsia) { 2896 # Build a package repository for skqp on Fuchsia. 2897 group("skqp_repo") { 2898 testonly = true 2899 deps = [ "//build/fuchsia/skqp:skqp_repo" ] 2900 } 2901 } 2902 if (is_android) { 2903 shared_library("libskqp_jni") { # Not a skia_shared_library 2904 configs += [ ":skia_private" ] 2905 testonly = true 2906 sources = [ "tools/skqp/src/jni_skqp.cpp" ] 2907 deps = [ 2908 ":skia", 2909 ":skqp_lib", 2910 ":tool_utils", 2911 ] 2912 libs = [ "android" ] 2913 } 2914 } 2915 if (is_android && skia_use_gl) { 2916 test_app("skottie_android") { 2917 is_shared_library = true 2918 2919 sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ] 2920 libs = [] 2921 2922 deps = [ 2923 ":skia", 2924 "modules/skottie", 2925 "modules/skshaper", 2926 "modules/skunicode", 2927 ] 2928 } 2929 2930 test_app("jetski") { 2931 is_shared_library = true 2932 2933 sources = [ 2934 "modules/jetski/src/Canvas.cpp", 2935 "modules/jetski/src/ColorFilters.cpp", 2936 "modules/jetski/src/Gradients.cpp", 2937 "modules/jetski/src/Image.cpp", 2938 "modules/jetski/src/ImageFilter.cpp", 2939 "modules/jetski/src/JetSki.cpp", 2940 "modules/jetski/src/Matrix.cpp", 2941 "modules/jetski/src/Paint.cpp", 2942 "modules/jetski/src/Path.cpp", 2943 "modules/jetski/src/PathBuilder.cpp", 2944 "modules/jetski/src/RuntimeShaderBuilder.cpp", 2945 "modules/jetski/src/Shader.cpp", 2946 "modules/jetski/src/SkottieAnimation.cpp", 2947 "modules/jetski/src/Surface.cpp", 2948 "modules/jetski/src/Surface.h", 2949 "modules/jetski/src/SurfaceThread.cpp", 2950 "modules/jetski/src/SurfaceThread.h", 2951 "modules/jetski/src/Utils.cpp", 2952 ] 2953 libs = [ 2954 "android", 2955 "jnigraphics", 2956 ] 2957 2958 deps = [ 2959 ":skia", 2960 "modules/skottie:skottie", 2961 "tools/window:window", 2962 ] 2963 } 2964 } 2965 2966 if (is_ios && skia_enable_skottie) { 2967 group("skottie_ios") { 2968 deps = [ "tools/skottie_ios_app" ] 2969 } 2970 } 2971 2972 test_lib("sk_app") { 2973 public_deps = [ 2974 ":gpu_tool_utils", 2975 ":skia", 2976 ] 2977 sources = [ 2978 "tools/sk_app/Application.h", 2979 "tools/sk_app/CommandSet.cpp", 2980 "tools/sk_app/CommandSet.h", 2981 "tools/sk_app/Window.cpp", 2982 "tools/sk_app/Window.h", 2983 ] 2984 libs = [] 2985 frameworks = [] 2986 2987 if (is_android) { 2988 sources += [ 2989 "tools/sk_app/android/Window_android.cpp", 2990 "tools/sk_app/android/Window_android.h", 2991 "tools/sk_app/android/main_android.cpp", 2992 "tools/sk_app/android/surface_glue_android.cpp", 2993 "tools/sk_app/android/surface_glue_android.h", 2994 ] 2995 libs += [ "android" ] 2996 } else if (is_linux) { 2997 sources += [ 2998 "tools/sk_app/unix/Window_unix.cpp", 2999 "tools/sk_app/unix/Window_unix.h", 3000 "tools/sk_app/unix/keysym2ucs.c", 3001 "tools/sk_app/unix/keysym2ucs.h", 3002 "tools/sk_app/unix/main_unix.cpp", 3003 ] 3004 libs += [ 3005 "GL", # Used by raster window context, so cannot be behind skia_use_gl. 3006 "X11", 3007 ] 3008 } else if (is_win) { 3009 sources += [ 3010 "tools/sk_app/win/Window_win.cpp", 3011 "tools/sk_app/win/Window_win.h", 3012 "tools/sk_app/win/main_win.cpp", 3013 ] 3014 } else if (is_mac) { 3015 sources += [ 3016 "tools/sk_app/mac/Window_mac.h", 3017 "tools/sk_app/mac/Window_mac.mm", 3018 "tools/sk_app/mac/main_mac.mm", 3019 ] 3020 frameworks += [ 3021 "QuartzCore.framework", 3022 "Cocoa.framework", 3023 "Foundation.framework", 3024 ] 3025 } else if (is_ios) { 3026 sources += [ 3027 "tools/sk_app/ios/Window_ios.h", 3028 "tools/sk_app/ios/Window_ios.mm", 3029 "tools/sk_app/ios/main_ios.mm", 3030 ] 3031 frameworks += [ "QuartzCore.framework" ] 3032 } 3033 3034 deps = [ 3035 ":tool_utils", 3036 "tools/window", 3037 ] 3038 if (is_android) { 3039 deps += [ "//third_party/native_app_glue" ] 3040 } 3041 if (skia_use_gl && skia_use_angle) { 3042 deps += [ "//third_party/angle2" ] 3043 } 3044 } 3045 3046 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) { 3047 test_app("fiddle_examples") { 3048 sources = [ 3049 "tools/fiddle/all_examples.cpp", 3050 "tools/fiddle/examples.cpp", 3051 "tools/fiddle/examples.h", 3052 ] 3053 if (is_win) { 3054 cflags = [ 3055 "/wd4756", # Overflow in constant arithmetic 3056 "/wd4305", # truncation from 'double' to 'float' 3057 ] 3058 } 3059 deps = [ 3060 ":skia", 3061 ":skia.h", 3062 "modules/skottie", 3063 "modules/skparagraph", 3064 "modules/skshaper", 3065 "modules/svg", 3066 ] 3067 } 3068 } 3069 3070 # sk_app can work without GL but viewer always runs raster through a GL window context. 3071 if (skia_use_gl) { 3072 test_app("viewer") { 3073 is_shared_library = is_android 3074 sources = [ 3075 "tools/viewer/3DSlide.cpp", 3076 "tools/viewer/AndroidShadowsSlide.cpp", 3077 "tools/viewer/AnimBlurSlide.cpp", 3078 "tools/viewer/AnimTimer.h", 3079 "tools/viewer/AnimatedImageSlide.cpp", 3080 "tools/viewer/AnimatedRectsSlide.cpp", 3081 "tools/viewer/AnimatedTextSlide.cpp", 3082 "tools/viewer/ArcSlide.cpp", 3083 "tools/viewer/AtlasSlide.cpp", 3084 "tools/viewer/AudioSlide.cpp", 3085 "tools/viewer/BisectSlide.cpp", 3086 "tools/viewer/BisectSlide.h", 3087 "tools/viewer/CameraSlide.cpp", 3088 "tools/viewer/ChartSlide.cpp", 3089 "tools/viewer/ChineseFlingSlide.cpp", 3090 "tools/viewer/ClickHandlerSlide.cpp", 3091 "tools/viewer/ClickHandlerSlide.h", 3092 "tools/viewer/ClipSlide.cpp", 3093 "tools/viewer/ClockSlide.cpp", 3094 "tools/viewer/CowboySlide.cpp", 3095 "tools/viewer/DegenerateQuadsSlide.cpp", 3096 "tools/viewer/DegenerateTwoPtRadialsSlide.cpp", 3097 "tools/viewer/FatBitsSlide.cpp", 3098 "tools/viewer/FilterBoundsSlide.cpp", 3099 "tools/viewer/FitCubicToCircleSlide.cpp", 3100 "tools/viewer/FlutterAnimateSlide.cpp", 3101 "tools/viewer/GMSlide.cpp", 3102 "tools/viewer/GMSlide.h", 3103 "tools/viewer/GlyphTransformSlide.cpp", 3104 "tools/viewer/GradientsSlide.cpp", 3105 "tools/viewer/GraphitePrimitivesSlide.cpp", 3106 "tools/viewer/ImGuiLayer.cpp", 3107 "tools/viewer/ImGuiLayer.h", 3108 "tools/viewer/ImageFilterDAGSlide.cpp", 3109 "tools/viewer/ImageSlide.cpp", 3110 "tools/viewer/ImageSlide.h", 3111 "tools/viewer/LayersSlide.cpp", 3112 "tools/viewer/MSKPSlide.cpp", 3113 "tools/viewer/MSKPSlide.h", 3114 "tools/viewer/ManyRectsSlide.cpp", 3115 "tools/viewer/MaterialShadowsSlide.cpp", 3116 "tools/viewer/MegaStrokeSlide.cpp", 3117 "tools/viewer/MeshGradientSlide.cpp", 3118 "tools/viewer/MeshSlide.cpp", 3119 "tools/viewer/MixerSlide.cpp", 3120 "tools/viewer/MotionMarkSlide.cpp", 3121 "tools/viewer/PatchSlide.cpp", 3122 "tools/viewer/PathClipSlide.cpp", 3123 "tools/viewer/PathEffectsSlide.cpp", 3124 "tools/viewer/PathLerpSlide.cpp", 3125 "tools/viewer/PathOverstrokeSlide.cpp", 3126 "tools/viewer/PathSlide.cpp", 3127 "tools/viewer/PathTessellatorsSlide.cpp", 3128 "tools/viewer/PathTextSlide.cpp", 3129 "tools/viewer/ProtectedSlide.cpp", 3130 "tools/viewer/QuadStrokerSlide.cpp", 3131 "tools/viewer/RectanizerSlide.cpp", 3132 "tools/viewer/RepeatTileSlide.cpp", 3133 "tools/viewer/SBIXSlide.cpp", 3134 "tools/viewer/SGSlide.cpp", 3135 "tools/viewer/SKPSlide.cpp", 3136 "tools/viewer/SKPSlide.h", 3137 "tools/viewer/SVGFileSlide.cpp", 3138 "tools/viewer/ShadowColorSlide.cpp", 3139 "tools/viewer/ShadowReferenceSlide.cpp", 3140 "tools/viewer/ShadowUtilsSlide.cpp", 3141 "tools/viewer/ShipSlide.cpp", 3142 "tools/viewer/SimpleStrokerSlide.cpp", 3143 "tools/viewer/SkSLDebuggerSlide.cpp", 3144 "tools/viewer/SkSLDebuggerSlide.h", 3145 "tools/viewer/SkSLSlide.cpp", 3146 "tools/viewer/SkSLSlide.h", 3147 "tools/viewer/SkottieSlide.cpp", 3148 "tools/viewer/SkottieSlide.h", 3149 "tools/viewer/Slide.h", 3150 "tools/viewer/SlideDir.cpp", 3151 "tools/viewer/SlideDir.h", 3152 "tools/viewer/SlidesSlide.cpp", 3153 "tools/viewer/StatsLayer.cpp", 3154 "tools/viewer/StatsLayer.h", 3155 "tools/viewer/StringArtSlide.cpp", 3156 "tools/viewer/StrokeVerbSlide.cpp", 3157 "tools/viewer/SvgSlide.cpp", 3158 "tools/viewer/SvgSlide.h", 3159 "tools/viewer/TextBoxSlide.cpp", 3160 "tools/viewer/TextureUploadSlide.cpp", 3161 "tools/viewer/ThinAASlide.cpp", 3162 "tools/viewer/TimingSlide.cpp", 3163 "tools/viewer/TouchGesture.cpp", 3164 "tools/viewer/TouchGesture.h", 3165 "tools/viewer/TypefaceSlide.cpp", 3166 "tools/viewer/VariableWidthStrokerSlide.cpp", 3167 "tools/viewer/Viewer.cpp", 3168 "tools/viewer/Viewer.h", 3169 "tools/viewer/XferSlide.cpp", 3170 ] 3171 libs = [] 3172 3173 deps = [ 3174 ":common_flags_config", 3175 ":common_flags_gpu", 3176 ":common_flags_graphite", 3177 ":flags", 3178 ":gm", 3179 ":gpu_tool_utils", 3180 ":sk_app", 3181 ":skia", 3182 ":tool_utils", 3183 ":trace", 3184 ":xml", 3185 "modules/audioplayer", 3186 "modules/skottie", 3187 "modules/skottie:utils", 3188 "modules/skparagraph:slides", 3189 "modules/sksg:slides", 3190 "modules/skshaper:skshaper", 3191 "modules/skunicode", 3192 "modules/svg", 3193 "//third_party/delaunator", 3194 "//third_party/imgui", 3195 ] 3196 if (skia_use_vulkan) { 3197 deps += [ 3198 "//third_party/externals/spirv-tools:spvtools", 3199 3200 #spvtools depends on this but doesn't deps it in. 3201 "//third_party/externals/spirv-tools:spvtools_val", 3202 ] 3203 } 3204 } 3205 } 3206 3207 if (skia_use_vulkan) { 3208 test_app("VulkanBasic") { 3209 # Bots and even devs may not have Vulkan headers, so put 3210 # include/third_party/vulkan on our path so they're always available. 3211 all_dependent_configs = [ 3212 ":use_skia_vulkan_headers", 3213 ":vulkan_memory_allocator", 3214 ] 3215 3216 sources = [ "example/VulkanBasic.cpp" ] 3217 sources += [ "tools/gpu/vk/VkTestMemoryAllocator.h" ] 3218 sources += [ "tools/gpu/vk/VkTestMemoryAllocator.cpp" ] 3219 sources += [ "tools/gpu/vk/VkTestUtils.h" ] 3220 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ] 3221 deps = [ 3222 ":load_dynamic_library", 3223 ":skia", 3224 ] 3225 } 3226 } 3227 3228 if (is_ios && skia_use_metal && skia_enable_ganesh) { 3229 group("minimal_ios_mtl_skia_app") { 3230 deps = [ "experimental/minimal_ios_mtl_skia_app" ] 3231 } 3232 } 3233 3234 if (is_linux || is_win || is_mac) { 3235 test_app("editor") { 3236 is_shared_library = is_android 3237 deps = [ "modules/skplaintexteditor:editor_app" ] 3238 } 3239 } 3240 3241 skia_executable("image_diff_metric") { 3242 sources = [ "tools/image_diff_metric.cpp" ] 3243 deps = [ ":skia" ] 3244 } 3245 3246 group("modules_testonly") { 3247 testonly = true 3248 deps = [] 3249 if (is_wasm) { 3250 deps += [ "modules/canvaskit:viewer_wasm" ] 3251 } 3252 } 3253 3254 if (skia_build_fuzzers) { 3255 template("libfuzzer_app") { 3256 skia_executable(target_name) { 3257 output_dir = root_build_dir 3258 check_includes = false 3259 forward_variables_from(invoker, "*", [ "is_shared_library" ]) 3260 if (!defined(configs)) { 3261 configs = [] 3262 } 3263 configs += [ ":skia_private" ] 3264 sources += [ 3265 "fuzz/Fuzz.cpp", 3266 "fuzz/FuzzCommon.cpp", 3267 ] 3268 deps += [ 3269 ":flags", 3270 ":gpu_tool_utils", 3271 ":skia", 3272 ":tool_utils", 3273 ] 3274 defines = [ 3275 "SK_BUILD_FOR_LIBFUZZER", 3276 "SK_BUILD_FOR_FUZZER", 3277 ] 3278 if (skia_use_libfuzzer_defaults) { 3279 cflags = [ "-fsanitize=fuzzer" ] 3280 ldflags = [ "-fsanitize=fuzzer" ] 3281 } 3282 testonly = true 3283 } 3284 } 3285 3286 libfuzzer_app("region_deserialize") { 3287 sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ] 3288 deps = [] 3289 } 3290 3291 libfuzzer_app("image_filter_deserialize") { 3292 sources = [ "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp" ] 3293 deps = [ "modules/svg" ] 3294 } 3295 3296 libfuzzer_app("region_set_path") { 3297 sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ] 3298 deps = [] 3299 } 3300 3301 libfuzzer_app("textblob_deserialize") { 3302 sources = [ "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp" ] 3303 deps = [ "modules/svg" ] 3304 } 3305 3306 libfuzzer_app("path_deserialize") { 3307 sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ] 3308 deps = [] 3309 } 3310 3311 libfuzzer_app("image_decode") { 3312 sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ] 3313 deps = [] 3314 } 3315 3316 libfuzzer_app("animated_image_decode") { 3317 sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ] 3318 deps = [] 3319 } 3320 3321 libfuzzer_app("api_create_ddl") { 3322 sources = [ 3323 "fuzz/FuzzCreateDDL.cpp", 3324 "fuzz/oss_fuzz/FuzzAPICreateDDL.cpp", 3325 ] 3326 deps = [ 3327 "modules/svg", 3328 "//third_party/libpng", 3329 ] 3330 } 3331 3332 libfuzzer_app("api_draw_functions") { 3333 sources = [ 3334 "fuzz/FuzzDrawFunctions.cpp", 3335 "fuzz/oss_fuzz/FuzzDrawFunctions.cpp", 3336 ] 3337 deps = [] 3338 } 3339 3340 libfuzzer_app("api_ddl_threading") { 3341 sources = [ 3342 "fuzz/FuzzDDLThreading.cpp", 3343 "fuzz/oss_fuzz/FuzzDDLThreading.cpp", 3344 ] 3345 deps = [] 3346 } 3347 3348 libfuzzer_app("api_gradients") { 3349 sources = [ 3350 "fuzz/FuzzGradients.cpp", 3351 "fuzz/oss_fuzz/FuzzGradients.cpp", 3352 ] 3353 deps = [] 3354 } 3355 3356 libfuzzer_app("api_image_filter") { 3357 sources = [ 3358 "fuzz/FuzzCanvas.cpp", 3359 "fuzz/oss_fuzz/FuzzAPIImageFilter.cpp", 3360 ] 3361 deps = [ "//third_party/libpng" ] 3362 } 3363 3364 libfuzzer_app("api_path_measure") { 3365 sources = [ 3366 "fuzz/FuzzPathMeasure.cpp", 3367 "fuzz/oss_fuzz/FuzzPathMeasure.cpp", 3368 ] 3369 deps = [] 3370 } 3371 3372 libfuzzer_app("api_pathop") { 3373 sources = [ 3374 "fuzz/FuzzPathop.cpp", 3375 "fuzz/oss_fuzz/FuzzPathop.cpp", 3376 ] 3377 deps = [] 3378 } 3379 3380 libfuzzer_app("api_triangulation") { 3381 sources = [ 3382 "fuzz/FuzzTriangulation.cpp", 3383 "fuzz/oss_fuzz/FuzzTriangulation.cpp", 3384 ] 3385 deps = [] 3386 } 3387 3388 libfuzzer_app("api_raster_n32_canvas") { 3389 sources = [ 3390 "fuzz/FuzzCanvas.cpp", 3391 "fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp", 3392 ] 3393 deps = [ 3394 "modules/svg", 3395 "//third_party/libpng", 3396 ] 3397 } 3398 3399 libfuzzer_app("api_regionop") { 3400 sources = [ 3401 "fuzz/FuzzRegionOp.cpp", 3402 "fuzz/oss_fuzz/FuzzRegionOp.cpp", 3403 ] 3404 deps = [] 3405 } 3406 3407 if (skia_enable_ganesh) { 3408 libfuzzer_app("api_mock_gpu_canvas") { 3409 sources = [ 3410 "fuzz/FuzzCanvas.cpp", 3411 "fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp", 3412 ] 3413 deps = [ 3414 "modules/svg", 3415 "//third_party/libpng", 3416 ] 3417 } 3418 } 3419 3420 if (skia_enable_graphite && skia_enable_precompile) { 3421 libfuzzer_app("api_precompile") { 3422 sources = [ 3423 "fuzz/FuzzPrecompile.cpp", 3424 "fuzz/oss_fuzz/FuzzPrecompile.cpp", 3425 ] 3426 deps = [] 3427 } 3428 } 3429 3430 libfuzzer_app("api_null_canvas") { 3431 sources = [ 3432 "fuzz/FuzzCanvas.cpp", 3433 "fuzz/oss_fuzz/FuzzNullCanvas.cpp", 3434 ] 3435 deps = [ 3436 "modules/svg", 3437 "//third_party/libpng", 3438 ] 3439 } 3440 3441 libfuzzer_app("api_skparagraph") { 3442 sources = [ 3443 "fuzz/FuzzSkParagraph.cpp", 3444 "fuzz/oss_fuzz/FuzzSkParagraph.cpp", 3445 ] 3446 deps = [ "modules/skparagraph" ] 3447 } 3448 3449 libfuzzer_app("api_svg_canvas") { 3450 sources = [ 3451 "fuzz/FuzzCanvas.cpp", 3452 "fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp", 3453 ] 3454 deps = [ 3455 "modules/svg", 3456 "//third_party/libpng", 3457 ] 3458 } 3459 3460 libfuzzer_app("png_encoder") { 3461 sources = [ 3462 "fuzz/FuzzEncoders.cpp", 3463 "fuzz/oss_fuzz/FuzzPNGEncoder.cpp", 3464 ] 3465 deps = [] 3466 } 3467 3468 libfuzzer_app("jpeg_encoder") { 3469 sources = [ 3470 "fuzz/FuzzEncoders.cpp", 3471 "fuzz/oss_fuzz/FuzzJPEGEncoder.cpp", 3472 ] 3473 deps = [] 3474 } 3475 3476 libfuzzer_app("webp_encoder") { 3477 sources = [ 3478 "fuzz/FuzzEncoders.cpp", 3479 "fuzz/oss_fuzz/FuzzWEBPEncoder.cpp", 3480 ] 3481 deps = [] 3482 } 3483 3484 libfuzzer_app("skottie_json") { 3485 sources = [ "modules/skottie/fuzz/FuzzSkottieJSON.cpp" ] 3486 deps = [ 3487 "modules/skottie:skottie", 3488 "modules/svg", 3489 ] 3490 } 3491 3492 libfuzzer_app("skjson") { 3493 sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ] 3494 deps = [] 3495 } 3496 3497 libfuzzer_app("api_polyutils") { 3498 sources = [ 3499 "fuzz/FuzzPolyUtils.cpp", 3500 "fuzz/oss_fuzz/FuzzPolyUtils.cpp", 3501 ] 3502 deps = [ ":skia" ] 3503 } 3504 3505 libfuzzer_app("android_codec") { 3506 sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ] 3507 deps = [] 3508 } 3509 3510 libfuzzer_app("image_decode_incremental") { 3511 sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ] 3512 deps = [] 3513 } 3514 3515 libfuzzer_app("sksl2glsl") { 3516 sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ] 3517 deps = [] 3518 } 3519 3520 libfuzzer_app("sksl2metal") { 3521 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ] 3522 deps = [] 3523 } 3524 3525 libfuzzer_app("sksl2pipeline") { 3526 sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ] 3527 deps = [] 3528 } 3529 3530 libfuzzer_app("sksl2spirv") { 3531 sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ] 3532 deps = [] 3533 } 3534 3535 libfuzzer_app("sksl2wgsl") { 3536 sources = [ "fuzz/oss_fuzz/FuzzSKSL2WGSL.cpp" ] 3537 deps = [] 3538 } 3539 3540 libfuzzer_app("skdescriptor_deserialize") { 3541 sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ] 3542 deps = [] 3543 } 3544 3545 libfuzzer_app("svg_dom") { 3546 sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ] 3547 deps = [ "modules/svg" ] 3548 } 3549 3550 libfuzzer_app("skruntimeblender") { 3551 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeBlender.cpp" ] 3552 deps = [] 3553 } 3554 3555 libfuzzer_app("skruntimecolorfilter") { 3556 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeColorFilter.cpp" ] 3557 deps = [] 3558 } 3559 3560 libfuzzer_app("skruntimeeffect") { 3561 sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ] 3562 deps = [] 3563 } 3564 3565 libfuzzer_app("skmeshspecification") { 3566 sources = [ "fuzz/oss_fuzz/FuzzSkMeshSpecification.cpp" ] 3567 deps = [] 3568 } 3569 3570 libfuzzer_app("skp") { 3571 sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ] 3572 deps = [] 3573 } 3574 3575 libfuzzer_app("colrv1") { 3576 sources = [ "fuzz/oss_fuzz/FuzzCOLRv1.cpp" ] 3577 deps = [] 3578 } 3579 3580 libfuzzer_app("quad_roots") { 3581 sources = [ 3582 "fuzz/FuzzQuadRoots.cpp", 3583 "fuzz/oss_fuzz/FuzzQuadRoots.cpp", 3584 ] 3585 deps = [] 3586 } 3587 3588 libfuzzer_app("cubic_roots") { 3589 sources = [ 3590 "fuzz/FuzzCubicRoots.cpp", 3591 "fuzz/oss_fuzz/FuzzCubicRoots.cpp", 3592 ] 3593 deps = [] 3594 } 3595 3596 libfuzzer_app("skcolorspace") { 3597 sources = [ "fuzz/oss_fuzz/FuzzColorspace.cpp" ] 3598 deps = [] 3599 } 3600 3601 libfuzzer_app("parse_path") { 3602 sources = [ "fuzz/oss_fuzz/FuzzParsePath.cpp" ] 3603 deps = [] 3604 } 3605 } 3606} 3607 3608if (skia_build_rust_targets) { 3609 action("rust_hello_world") { 3610 script = "gn/bazel_build.py" 3611 sources = [ "experimental/rust_cxx/hello-world.rs" ] 3612 outputs = [ "$root_out_dir/rust_hello_world" ] 3613 args = [ 3614 "//experimental/rust_cxx:rust_hello_world", 3615 "../../bazel-bin/experimental/rust_cxx/rust_hello_world", 3616 ] 3617 } 3618 3619 action("cpp_with_rust") { 3620 script = "gn/bazel_build.py" 3621 sources = [ 3622 "experimental/rust_cxx/hype-bridge.rs", 3623 "experimental/rust_cxx/main.cpp", 3624 ] 3625 outputs = [ "$root_out_dir/cpp_with_rust" ] 3626 args = [ 3627 "//experimental/rust_cxx:cpp_with_rust", 3628 "../../bazel-bin/experimental/rust_cxx/cpp_with_rust", 3629 ] 3630 } 3631} 3632