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