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