1 # Copyright 2013 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/buildflag_header.gni")
6 import("//build/config/compiler/compiler.gni")
7 import("//build/config/features.gni")
8 import("//build/config/freetype/freetype.gni")
9 import("//build/config/rust.gni")
10 import("//build/config/sanitizers/sanitizers.gni")
11 import("//build/rust/rust_static_library.gni")
12 import("//gpu/vulkan/features.gni")
13 import("//testing/test.gni")
14 import("//third_party/skia/gn/shared_sources.gni")
15 import("//third_party/skia/modules/skcms/skcms.gni")
16 import("features.gni")
18 if (current_cpu == "arm") {
19 import("//build/config/arm.gni")
21 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
22 import("//build/config/mips.gni")
25 buildflag_header("buildflags") {
26 header = "buildflags.h"
28 "SKIA_SUPPORT_SKOTTIE=$skia_support_skottie",
29 "SKIA_USE_DAWN=$skia_use_dawn",
30 "SKIA_USE_METAL=$skia_use_metal",
34 if (use_typeface_fontations) {
35 source_set("path_bridge") {
36 sources = [ "//third_party/skia/src/ports/fontations/src/skpath_bridge.h" ]
39 rust_static_library("bridge_rust_side") {
41 crate_root = "//third_party/skia/src/ports/fontations/src/ffi.rs"
42 sources = [ "//third_party/skia/src/ports/fontations/src/ffi.rs" ]
43 cxx_bindings = [ "//third_party/skia/src/ports/fontations/src/ffi.rs" ]
46 "//third_party/rust/font_types/v0_4:lib",
47 "//third_party/rust/read_fonts/v0_11:lib",
48 "//third_party/rust/skrifa/v0_10:lib",
50 configs -= [ "//build/config/compiler:chromium_code" ]
53 "//build/config/compiler:no_chromium_code",
58 # External-facing config for dependent code.
59 config("skia_config") {
62 "SK_UNTIL_CRBUG_1187654_IS_FIXED",
63 "SK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\"",
64 "SK_WIN_FONTMGR_NO_SIMULATIONS",
65 "SK_DISABLE_LEGACY_SKSURFACE_METHODS",
66 "SK_DISABLE_LEGACY_GRAPHITE_IMAGE_FACTORIES",
67 "SK_DISABLE_LEGACY_GRAPHITE_IMAGE_METHODS",
68 "SK_DISABLE_LEGACY_SKSURFACE_FACTORIES",
69 "SK_DISABLE_LEGACY_SKSURFACE_FLUSH",
70 "SK_DISABLE_LEGACY_SKSURFACE_AS_IMAGE",
71 "SK_DISABLE_LEGACY_SKSURFACE_DISPLAYLIST",
72 "SK_DISABLE_LEGACY_IMAGE_SUBSET_METHODS",
73 "SK_DISABLE_LEGACY_IMAGE_COLORSPACE_METHODS",
74 "SK_DISABLE_LEGACY_IMAGE_RELEASE_PROCS",
75 "SK_DISABLE_LEGACY_GL_BACKEND_SURFACE",
76 "SK_DISABLE_LEGACY_INIT_DECODERS",
77 "SK_DISABLE_LEGACY_GRDIRECTCONTEXT_FLUSH",
78 "SK_DISABLE_LEGACY_GRDIRECTCONTEXT_BOOLS",
79 "SK_DISABLE_LEGACY_GL_GRDIRECTCONTEXT_FACTORIES",
80 "SK_DISABLE_LEGACY_PNG_WRITEBUFFER",
81 "SK_SLUG_DISABLE_LEGACY_DESERIALIZE",
82 "SK_DISABLE_LEGACY_VK_GRDIRECTCONTEXT_FACTORIES",
87 "$root_gen_dir/third_party/skia",
91 # TODO(kjlubick) make these not necessary
93 "SK_CODEC_DECODES_JPEG",
98 include_dirs += [ "//third_party/wuffs/src/release/c" ]
100 # Decoder sources are only added when use_blink == true, but SkCodec.cpp is
101 # always present. SK_DISABLE_LEGACY_INIT_DECODERS ensures that SkCodec.cpp
102 # is not attempting to reference inexistent codec code.
103 defines += [ "SK_DISABLE_LEGACY_INIT_DECODERS" ]
106 if (is_component_build) {
107 defines += [ "SKIA_DLL" ]
109 defines += [ "SKCMS_API=__declspec(dllexport)" ]
111 defines += [ "SKCMS_API=__attribute__((visibility(\"default\")))" ]
117 "SK_BUILD_FOR_ANDROID",
123 defines += [ "SK_BUILD_FOR_MAC" ]
126 defines += [ "SK_BUILD_FOR_IOS" ]
130 defines += [ "GR_GL_FUNCTION_TYPE=__stdcall" ]
133 if (skia_support_gpu) {
134 workaround_header = "gpu/config/gpu_driver_bug_workaround_autogen.h"
138 "SK_GPU_WORKAROUNDS_HEADER=\"$workaround_header\"",
141 defines += [ "SK_GL" ]
144 defines += [ "SK_VULKAN=1" ]
145 include_dirs += [ "//third_party/vulkan/include" ]
147 "//third_party/vulkan-deps/vulkan-headers/src:vulkan_headers_config",
152 defines += [ "SK_GRAPHITE" ]
154 defines += [ "SK_DAWN" ]
155 configs += [ "//third_party/dawn/include/dawn:public" ]
157 if (skia_use_metal) {
158 defines += [ "SK_METAL" ]
163 # Internal-facing config for Skia library code.
164 config("skia_library_config") {
165 # Turn on SK_API to export Skia's public API
168 "SKIA_IMPLEMENTATION=1",
171 if (use_blink && !use_system_freetype) {
172 defines += [ "SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR) * 0x01000000) | ((FREETYPE_MINOR) * 0x00010000) | ((FREETYPE_PATCH) * 0x00000100))" ]
175 defines += [ "SK_TYPEFACE_FACTORY_FREETYPE" ]
178 defines += [ "SK_TYPEFACE_FACTORY_DIRECTWRITE" ]
181 defines += [ "SK_TYPEFACE_FACTORY_CORETEXT" ]
184 if (current_cpu == "arm") {
186 defines += [ "SK_ARM_HAS_NEON" ]
187 } else if (arm_optionally_use_neon) {
188 defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ]
192 # Settings for text blitting, chosen to approximate the system browser.
193 if (is_linux || is_chromeos) {
195 "SK_GAMMA_EXPONENT=1.2",
196 "SK_GAMMA_CONTRAST=0.2",
198 } else if (is_android) {
200 "SK_GAMMA_APPLY_TO_A8",
201 "SK_GAMMA_EXPONENT=1.4",
202 "SK_GAMMA_CONTRAST=0.0",
207 "SK_GAMMA_CONTRAST=0.5",
212 "SK_GAMMA_CONTRAST=0.0",
218 # Android devices are typically more memory constrained, so default to a
219 # smaller glyph cache (it may be overriden at runtime when the renderer
220 # starts up, depending on the actual device memory).
221 "SK_DEFAULT_FONT_CACHE_LIMIT=1048576", # 1024 * 1024
224 defines += [ "SK_DEFAULT_FONT_CACHE_LIMIT=20971520" ] # 20 * 1024 * 1024
229 # On windows, GDI handles are a scarse system-wide resource so we have to
230 # keep the glyph cache, which holds up to 4 GDI handles per entry, to a
231 # fairly small size. http://crbug.com/314387
232 "SK_DEFAULT_FONT_CACHE_COUNT_LIMIT=256",
237 # Split out into separate target so that path_bridge can depend on the public
238 # headers only and we can avoid a cyclic dependency when building the C++ native
239 # code for the Fontations rust backend.
240 source_set("skia_core_public_headers") {
241 public = skia_core_public
244 source_set("skcms") {
246 if (!is_win || is_clang) {
253 # LLVM automatically sets the equivalent of GCC's -mfp16-format=ieee on ARM
254 # builds by default, while GCC itself does not. We need it to enable support
255 # for half-precision floating point data types used by SKCMS on ARM.
256 if ((is_linux || is_chromeos) && !is_clang && current_cpu == "arm") {
257 cflags += [ "-mfp16-format=ieee" ]
260 public = [ "//third_party/skia/modules/skcms/skcms.h" ]
261 include_dirs = [ "//third_party/skia/modules/skcms" ]
262 sources = rebase_path(skcms_sources, ".", "//third_party/skia/modules/skcms")
268 "ext/benchmarking_canvas.h",
271 "ext/event_tracer_impl.h",
272 "ext/image_operations.h",
273 "ext/legacy_display_globals.h",
274 "ext/opacity_filter_canvas.h",
275 "ext/recursive_gaussian_convolution.h",
276 "ext/rgba_to_yuva.h",
277 "ext/skcolorspace_primaries.h",
278 "ext/skcolorspace_trfn.h",
279 "ext/skia_memory_dump_provider.h",
280 "ext/skia_trace_memory_dump_impl.h",
281 "ext/skia_utils_base.h",
285 "config/SkUserConfig.h",
286 "config/sk_ref_cnt_ext_debug.h",
287 "config/sk_ref_cnt_ext_release.h",
288 "ext/SkDiscardableMemory_chrome.cc",
289 "ext/SkDiscardableMemory_chrome.h",
290 "ext/SkMemory_new_handler.cpp",
291 "ext/benchmarking_canvas.cc",
294 "ext/event_tracer_impl.cc",
295 "ext/google_logging.cc",
296 "ext/image_operations.cc",
297 "ext/legacy_display_globals.cc",
298 "ext/opacity_filter_canvas.cc",
299 "ext/recursive_gaussian_convolution.cc",
300 "ext/rgba_to_yuva.cc",
301 "ext/skcolorspace_primaries.cc",
302 "ext/skcolorspace_trfn.cc",
303 "ext/skia_histogram.cc",
304 "ext/skia_histogram.h",
305 "ext/skia_memory_dump_provider.cc",
306 "ext/skia_trace_memory_dump_impl.cc",
307 "ext/skia_utils_base.cc",
310 public += [ "ext/fontmgr_default.h" ]
311 sources += [ "ext/fontmgr_default.cc" ]
314 sources += [ "ext/fontmgr_default_android.cc" ]
316 if (is_linux || is_chromeos || is_tizen) {
317 sources += [ "ext/fontmgr_default_linux.cc" ]
320 public += [ "ext/skia_utils_ios.h" ]
321 sources += [ "ext/skia_utils_ios.mm" ]
324 public += [ "ext/skia_utils_mac.h" ]
325 sources += [ "ext/skia_utils_mac.mm" ]
328 public += [ "ext/skia_utils_win.h" ]
330 "ext/fontmgr_default_win.cc",
331 "ext/skia_utils_win.cc",
336 public += [ "ext/platform_canvas.h" ]
337 sources += [ "ext/platform_canvas.cc" ]
339 if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
341 "ext/convolver_SSE2.cc",
342 "ext/convolver_SSE2.h",
344 } else if (current_cpu == "mipsel" && mips_dsp_rev >= 2) {
346 "ext/convolver_mips_dspr2.cc",
347 "ext/convolver_mips_dspr2.h",
349 } else if (current_cpu == "arm" || current_cpu == "arm64") {
352 "ext/convolver_neon.cc",
353 "ext/convolver_neon.h",
360 # Select the right BitmapPlatformDevice.
361 "ext/raster_handle_allocator_win.cc",
365 # skia_core_public is included via public_deps instead as the path_bridge
366 # target needs it as well.
367 public += skia_utils_public
368 public += skia_effects_public
369 public += skia_effects_imagefilter_public
370 public += skia_utils_chromium
371 public += skia_discardable_memory_chromium
372 public += skia_encode_public
373 public += skia_encode_png_public
374 public += skia_encode_webp_public
376 # The imported Skia gni source paths are made absolute by gn.
378 sources += skia_sksl_sources
379 sources += skia_codec_core
380 sources += skia_utils_private
381 sources += skia_xps_sources
382 sources += skia_encode_srcs
383 sources += skia_encode_png_srcs
384 sources += skia_encode_webp_srcs
386 "//third_party/skia/src/fonts/SkFontMgr_indirect.cpp",
387 "//third_party/skia/src/fonts/SkRemotableFontMgr.cpp",
388 "//third_party/skia/src/ports/SkGlobalInitialization_default.cpp",
389 "//third_party/skia/src/ports/SkImageGenerator_none.cpp",
390 "//third_party/skia/src/ports/SkOSFile_stdio.cpp",
391 "//third_party/skia/src/sfnt/SkOTTable_name.cpp",
392 "//third_party/skia/src/sfnt/SkOTUtils.cpp",
395 sources -= [ "//third_party/skia/src/ports/SkImageGenerator_none.cpp" ]
396 sources += skia_codec_decode_bmp
397 sources += skia_encode_jpeg_srcs
398 public += skia_encode_jpeg_public
400 "//third_party/skia/src/codec/SkEncodedInfo.cpp",
401 "//third_party/skia/src/codec/SkIcoCodec.cpp",
402 "//third_party/skia/src/codec/SkJpegCodec.cpp",
403 "//third_party/skia/src/codec/SkJpegDecoderMgr.cpp",
404 "//third_party/skia/src/codec/SkJpegMultiPicture.cpp",
405 "//third_party/skia/src/codec/SkJpegSegmentScan.cpp",
406 "//third_party/skia/src/codec/SkJpegSourceMgr.cpp",
407 "//third_party/skia/src/codec/SkJpegUtility.cpp",
408 "//third_party/skia/src/codec/SkParseEncodedOrigin.cpp",
409 "//third_party/skia/src/codec/SkPngCodec.cpp",
410 "//third_party/skia/src/codec/SkWebpCodec.cpp",
411 "//third_party/skia/src/codec/SkWuffsCodec.cpp",
412 "//third_party/skia/src/ports/SkImageGenerator_skia.cpp",
414 deps += [ "//third_party/wuffs" ]
416 sources += skia_no_encode_jpeg_srcs
419 if (skia_support_xmp) {
420 sources += skia_xml_sources
421 sources += skia_codec_xmp
422 sources += skia_codec_jpeg_xmp
423 deps += [ "//third_party/expat" ]
424 defines += [ "SK_CODEC_DECODES_JPEG_GAINMAPS" ]
427 # Remove unused util sources.
428 sources -= [ "//third_party/skia/src/utils/SkParsePath.cpp" ]
431 libs = [ "fontsub.lib" ]
434 # need separate win section to handle chromes auto gn filter
435 # (build/config/BUILDCONFIG.gn)
439 "//third_party/skia/src/utils/win/SkWGL_win.cpp",
445 # FreeType is needed everywhere where blink is used, on Linux and Android as main
446 # font backend, on Windows and Mac as fallback backend for Variations.
448 # See SK_TYPEFACE_FACTORY_FREETYPE
450 "//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
451 "//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
455 if (use_typeface_fontations) {
457 "//third_party/skia/src/ports/SkTypeface_fontations.cpp",
458 "//third_party/skia/src/ports/SkTypeface_fontations_priv.h",
467 # See SK_TYPEFACE_FACTORY_DIRECTWRITE
469 "//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
470 "//third_party/skia/src/ports/SkOSFile_win.cpp",
471 "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
472 "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
473 "//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
476 sources += [ "//third_party/skia/src/ports/SkOSFile_posix.cpp" ]
480 # See SK_TYPEFACE_FACTORY_CORETEXT
482 "//third_party/skia/include/ports/SkFontMgr_mac_ct.h",
483 "//third_party/skia/src/ports/SkFontMgr_mac_ct.cpp",
484 "//third_party/skia/src/ports/SkFontMgr_mac_ct_factory.cpp",
485 "//third_party/skia/src/ports/SkScalerContext_mac_ct.cpp",
486 "//third_party/skia/src/ports/SkScalerContext_mac_ct.h",
487 "//third_party/skia/src/ports/SkTypeface_mac_ct.cpp",
488 "//third_party/skia/src/ports/SkTypeface_mac_ct.h",
492 if (is_linux || is_tizen || is_chromeos) {
494 "//third_party/skia/src/ports/SkFontConfigInterface.cpp",
495 "//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp",
496 "//third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp",
497 "//third_party/skia/src/ports/SkFontMgr_FontConfigInterface.cpp",
501 if (is_linux || is_tizen || is_chromeos || is_android) {
503 # Retain the files for the SkFontMgr_Android on linux to emulate android
504 # fonts. See content/zygote/zygote_main_linux.cc
505 # Note that this requires expat.
506 "//third_party/skia/src/ports/SkFontMgr_android.cpp",
507 "//third_party/skia/src/ports/SkFontMgr_android_parser.cpp",
511 if (is_win || (is_apple && use_blink)) {
513 # Add the FreeType custom font manager as a fallback backend for variable fonts.
514 "//third_party/skia/src/ports/SkFontMgr_custom.cpp",
515 "//third_party/skia/src/ports/SkFontMgr_custom_empty.cpp",
521 "//third_party/skia/src/ports/SkFontMgr_custom.cpp",
522 "//third_party/skia/src/ports/SkFontMgr_fuchsia.cpp",
523 "ext/fontmgr_default_fuchsia.cc",
526 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts:fuchsia.fonts_hlcpp",
527 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.io:fuchsia.io_hlcpp",
528 "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
529 "//third_party/fuchsia-sdk/sdk/pkg/zx",
530 "//third_party/icu:icuuc",
534 configs -= [ "//build/config/compiler:chromium_code" ]
537 ":skia_library_config",
538 "//build/config/compiler:no_chromium_code",
540 all_dependent_configs = [ ":skia_config" ]
546 "//base/third_party/dynamic_annotations",
547 "//third_party/libpng",
548 "//third_party/libwebp",
549 "//third_party/libwebp:libwebp_webp",
553 ":skia_core_and_effects",
554 ":skia_core_public_headers",
559 "//build/config/freetype",
560 "//third_party:jpeg",
564 if (is_linux || is_chromeos) {
566 "//third_party/expat",
567 "//third_party/fontconfig",
568 "//third_party/icu:icuuc",
574 "//third_party/cpu_features:ndk_compat",
575 "//third_party/expat",
580 deps += [ "//third_party/expat" ]
584 configs -= [ "//build/config/compiler:default_optimization" ]
585 configs += [ "//build/config/compiler:optimize_max" ]
590 frameworks += [ "ImageIO.framework" ]
592 if (is_apple && skia_support_gpu) {
594 "CoreFoundation.framework",
595 "CoreGraphics.framework",
596 "CoreText.framework",
597 "Foundation.framework",
600 frameworks += [ "AppKit.framework" ]
603 frameworks += [ "IOSurface.framework" ]
608 deps += [ "//third_party/expat" ]
611 if (skia_support_gpu) {
612 public += skia_gpu_public
613 public += skia_gpu_chromium_public
614 sources += skia_ganesh_private
615 sources += skia_null_gpu_sources
616 sources += skia_sksl_gpu_sources
617 sources += skia_shared_gpu_sources
619 public += skia_gpu_gl_public
620 sources += skia_gpu_gl_private
623 public += skia_gpu_vk_public
624 public += skia_gpu_vk_chromium_public
625 sources += skia_gpu_vk_private
626 sources += skia_shared_vk_sources
627 sources += skia_gpu_vk_chromium_private
630 public_deps += [ ":skia_graphite_public" ]
631 deps += [ ":skia_graphite_private" ]
633 if (skia_use_metal) {
634 deps += [ ":skia_ganesh_metal" ]
636 deps += [ "//gpu/config:workaround_list" ]
638 sources += skia_no_slug_srcs
641 if (skia_support_pdf) {
643 "//third_party:freetype_harfbuzz",
644 "//third_party/zlib",
646 public += skia_pdf_public
647 sources += skia_pdf_sources
649 # Blink includes Skia's JPEG decoder
650 sources += skia_pdf_jpeginfo_lib
652 sources += skia_pdf_jpeginfo_none
655 sources += [ "//third_party/skia/src/pdf/SkDocument_PDF_None.cpp" ]
658 if (skia_support_skottie) {
659 import("//third_party/skia/modules/skottie/skottie.gni")
660 import("//third_party/skia/modules/skresources/skresources.gni")
661 import("//third_party/skia/modules/sksg/sksg.gni")
662 import("//third_party/skia/modules/skshaper/skshaper.gni")
663 public += skia_skottie_public
664 sources += skia_skottie_sources
665 sources += skia_skresources_sources
666 sources += skia_sksg_sources
667 sources += skia_shaper_primitive_sources
671 # Template for things that are logically part of :skia, but need to be split out
672 # so custom compile flags can be applied.
674 # These are all opted out of check_includes, due to (logically) being part of
676 template("skia_source_set") {
677 source_set(target_name) {
678 forward_variables_from(invoker, "*")
680 check_includes = false
683 configs -= [ "//build/config/compiler:default_optimization" ]
684 configs += [ "//build/config/compiler:optimize_max" ]
687 configs -= [ "//build/config/compiler:chromium_code" ]
690 ":skia_library_config",
691 "//build/config/compiler:no_chromium_code",
693 public_configs = [ ":skia_config" ]
696 # Do not compile with ARC because Skia code is not compatible with being
698 configs -= [ "//build/config/compiler:enable_arc" ]
701 # Android, the only user of mismatched sample files (for now), gets a small
702 # binary size decrease by using AFDO to optimize for size in these
703 # source_sets. However, that also comes at a relatively big performance
705 if (using_mismatched_sample_profile && !is_tizen) {
706 configs -= [ "//build/config/compiler:afdo_optimize_size" ]
710 "/wd5041", # out-of-line definition for constexpr static data member is
711 # not needed and is deprecated in C++17
717 # Split out for targeted removal of the afdo_optimize_size config on Android.
718 skia_source_set("skia_core_and_effects") {
720 sources = skia_core_sources
721 sources += skia_colorfilters_sources
722 sources += skia_effects_sources
723 sources += skia_effects_imagefilter_sources
724 if (skia_support_gpu) {
725 deps = [ "//gpu/config:workaround_list" ]
728 # Note: This is needed as files in this target include GrDawnTypes.h, which
729 # includes Dawn headers that are generated by the below target. Normally it
730 # would be enough for the target that has GrDawnTypes.h in it to just have
731 # cpp_headers in its public deps. However, that file is in
732 # sk_gpu_dawn_public, which we add to the "skia" target, which depends on
733 # skia_core_and_effects rather than the other way around.
734 public_deps = [ "//third_party/dawn/include/dawn:cpp_headers" ]
736 visibility = [ ":skia" ]
739 # Bits that involve special vector-y hardware.
740 if (current_cpu == "x86" || current_cpu == "x64") {
741 skia_source_set("skia_opts_hsw") {
742 sources = skia_opts.hsw_sources
753 cflags = [ "/arch:AVX2" ]
755 visibility = [ ":skia_opts" ]
759 skia_source_set("skia_opts") {
765 if (current_cpu == "x86" || current_cpu == "x64") {
766 deps += [ ":skia_opts_hsw" ]
767 } else if (current_cpu == "arm") {
768 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
769 # ARM), the compiler doesn't like that.
771 cflags += [ "-fomit-frame-pointer" ]
774 if (arm_version >= 7) {
775 if (arm_use_neon || arm_optionally_use_neon) {
776 # Root build config sets -mfpu=$arm_fpu, which we expect to be neon
779 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
780 cflags += [ "-mfpu=neon" ]
784 } else if (current_cpu == "arm64") {
785 # Conditional and empty body needed to avoid assert() below.
786 } else if (current_cpu == "mipsel") {
787 cflags += [ "-fomit-frame-pointer" ]
788 } else if (current_cpu == "mips64el") {
789 cflags += [ "-fomit-frame-pointer" ]
790 } else if (current_cpu == "ppc64") {
791 # Conditional and empty body needed to avoid assert() below.
792 } else if (current_cpu == "s390x") {
793 # Conditional and empty body needed to avoid assert() below.
794 } else if (current_cpu == "riscv64") {
795 # Conditional and empty body needed to avoid assert() below.
797 assert(false, "Unknown cpu target")
800 visibility = [ ":skia" ]
803 # Split out Graphite sources because of conflicting file names with Ganesh.
804 # Split into separate private and public source sets because we want to allow
805 # shared GPU code in ":skia" to include private Graphite headers, but want to
806 # limit external code to only depend on public headers. Only define these source
807 # sets when skia_support_gpu is true so that on iOS non-Blink builds, headers in
808 # these source sets are considered unknown and skipped by gn check.
809 if (skia_support_gpu) {
810 skia_source_set("skia_graphite_public") {
811 public = skia_graphite_public
813 public += skia_graphite_dawn_public
815 "//third_party/dawn/include/dawn:cpp_headers",
816 "//third_party/dawn/src/dawn:cpp",
817 "//third_party/dawn/src/dawn:proc",
820 if (skia_use_metal) {
821 public += skia_graphite_mtl_public
822 frameworks = [ "Metal.framework" ]
824 deps = [ "//gpu/config:workaround_list" ]
827 # If a source set contains only sources and no public files, then dependents can
828 # include any file from sources.
829 skia_source_set("skia_graphite_private") {
830 sources = skia_graphite_sources
832 sources += skia_shared_dawn_sources
833 sources += skia_graphite_dawn_sources
835 if (skia_use_metal) {
836 sources += skia_shared_mtl_sources
837 sources += skia_graphite_mtl_sources
839 deps = [ "//gpu/config:workaround_list" ]
841 deps += [ "//third_party/dawn/include/dawn:cpp_headers" ]
843 visibility = [ ":skia" ]
846 if (skia_use_metal) {
847 # Split out Ganesh Metal sources, because they require ARC.
848 skia_source_set("skia_ganesh_metal") {
849 sources = skia_gpu_metal_public
850 sources += skia_gpu_metal_private
852 "-Wno-unguarded-availability",
855 deps = [ "//gpu/config:workaround_list" ]
857 # Needed due to include chain containing webgpu_cpp.h via GrDawnTypes.h.
858 public_deps = [ "//third_party/dawn/include/dawn:cpp_headers" ]
860 visibility = [ ":skia" ]
867 copy("copy_fuchsia_fonts_manifest") {
868 sources = [ "ext/data/test_fonts/fuchsia_test_fonts_manifest.json" ]
869 outputs = [ "$root_out_dir/test_fonts/all.font_manifest.json" ]
873 bundle_data("test_fonts_bundle_data") {
874 public_deps = [ "//third_party/test_fonts" ]
877 "$root_out_dir/test_fonts/Ahem.ttf",
878 "ext/data/test_fonts/ChromiumAATTest.ttf",
881 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
885 group("test_fonts_resources") {
891 deps += [ ":test_fonts_bundle_data" ]
892 data_deps += [ ":test_fonts_bundle_data" ]
894 deps += [ "//third_party/test_fonts" ]
895 data_deps += [ "//third_party/test_fonts" ]
899 deps += [ ":copy_fuchsia_fonts_manifest" ]
900 data_deps += [ ":copy_fuchsia_fonts_manifest" ]
904 # Fuchsia components that use the test fonts must include
905 # "//build/config/fuchsia/test/test_fonts.shard.test-cml" in their
906 # `additional_manifest_fragments`.
907 source_set("test_fonts") {
910 deps = [ ":test_fonts_resources" ]
915 "ext/test_fonts_fuchsia.h",
918 "ext/test_fonts_fuchsia.cc",
919 "ext/test_fonts_fuchsia_cfv2.cc",
922 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts:fuchsia.fonts_hlcpp",
927 "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
931 public = [ "ext/test_fonts.h" ]
932 sources = [ "ext/test_fonts_mac.mm" ]
937 test("skia_unittests") {
939 "ext/convolver_unittest.cc",
940 "ext/image_operations_unittest.cc",
941 "ext/platform_canvas_unittest.cc",
942 "ext/recursive_gaussian_convolution_unittest.cc",
943 "ext/skcolorspace_primaries_unittest.cc",
944 "ext/skcolorspace_trfn_unittest.cc",
945 "ext/skia_memory_dump_provider_unittest.cc",
946 "ext/skia_utils_base_unittest.cc",
949 sources += [ "ext/skia_utils_ios_unittest.mm" ]
952 sources += [ "ext/skia_utils_mac_unittest.mm" ]
956 sources -= [ "ext/platform_canvas_unittest.cc" ]
964 "//base/test:test_support",
965 "//mojo/core/test:run_all_unittests",
971 data_deps = [ "//testing/buildbot/filters:skia_unittests_filters" ]
974 sources += [ "public/mojom/test/mojom_traits_unittest.cc" ]
976 "//mojo/public/cpp/bindings",
977 "//mojo/public/cpp/test_support:test_utils",
978 "//skia/public/mojom",
983 sources += [ "ext/fontmgr_fuchsia_unittest.cc" ]
985 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts:fuchsia.fonts_hlcpp",
987 additional_manifest_fragments =
988 [ "//build/config/fuchsia/test/test_fonts.shard.test-cml" ]
991 if (skia_support_skottie) {
992 sources += [ "ext/skottie_unittest.cc" ]
997 executable("image_operations_bench") {
998 sources = [ "ext/image_operations_bench.cc" ]
1003 "//build/win:default_exe_manifest",
1007 executable("filter_fuzz_stub") {
1009 sources = [ "tools/filter_fuzz_stub/filter_fuzz_stub.cc" ]
1014 "//base/test:test_support",
1015 "//build/win:default_exe_manifest",
1021 deps = [ "//skia/tools/fuzzers" ]