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