summaryrefslogtreecommitdiff
path: root/chromium/third_party/skia/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia/BUILD.gn')
-rw-r--r--chromium/third_party/skia/BUILD.gn297
1 files changed, 197 insertions, 100 deletions
diff --git a/chromium/third_party/skia/BUILD.gn b/chromium/third_party/skia/BUILD.gn
index 38f7e6e0fe0..1a0e55b8273 100644
--- a/chromium/third_party/skia/BUILD.gn
+++ b/chromium/third_party/skia/BUILD.gn
@@ -41,9 +41,6 @@ config("skia_public") {
if (!skia_enable_gpu) {
defines += [ "SK_SUPPORT_GPU=0" ]
}
- if (skia_enable_atlas_text) {
- defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
- }
if (is_fuchsia) {
defines += fuchsia_defines
}
@@ -203,7 +200,7 @@ opts("avx") {
} else {
cflags = [ "-mavx" ]
if (is_mac && is_debug) {
- cflags += [ "-O1" ] # Work around skia:9709
+ cflags += [ "-fno-stack-check" ] # Work around skia:9709
}
}
}
@@ -216,7 +213,20 @@ opts("hsw") {
} else {
cflags = [ "-march=haswell" ]
if (is_mac && is_debug) {
- cflags += [ "-O1" ] # Work around skia:9709
+ cflags += [ "-fno-stack-check" ] # Work around skia:9709
+ }
+ }
+}
+
+opts("skx") {
+ enabled = is_x86
+ sources = skia_opts.skx_sources
+ if (is_win) {
+ cflags = [ "/arch:AVX512" ]
+ } else {
+ cflags = [ "-march=skylake-avx512" ]
+ if (is_mac && is_debug) {
+ cflags += [ "-fno-stack-check" ] # Work around skia:9709
}
}
}
@@ -256,6 +266,7 @@ template("optional") {
forward_variables_from(invoker,
"*",
[
+ "public",
"public_defines",
"public_deps",
"deps",
@@ -275,9 +286,21 @@ template("optional") {
optional("android_utils") {
enabled = skia_enable_android_utils
- public = [ "client_utils/android/FrontBufferedStream.h" ]
+ public = [
+ "client_utils/android/BRDAllocator.h",
+ "client_utils/android/BitmapRegionDecoder.h",
+ "client_utils/android/FrontBufferedStream.h",
+ ]
public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
- sources = [ "client_utils/android/FrontBufferedStream.cpp" ]
+ sources = [
+ "client_utils/android/BitmapRegionDecoder.cpp",
+ "client_utils/android/FrontBufferedStream.cpp",
+ ]
+}
+
+source_set("fontmgr_factory") {
+ configs += skia_library_configs
+ sources = [ skia_fontmgr_factory ]
}
optional("fontmgr_android") {
@@ -287,57 +310,84 @@ optional("fontmgr_android") {
":typeface_freetype",
"//third_party/expat",
]
+ public = [ "include/ports/SkFontMgr_android.h" ]
sources = [
"src/ports/SkFontMgr_android.cpp",
- "src/ports/SkFontMgr_android_factory.cpp",
"src/ports/SkFontMgr_android_parser.cpp",
+ "src/ports/SkFontMgr_android_parser.h",
]
}
optional("fontmgr_custom") {
- enabled = skia_enable_fontmgr_custom
+ enabled =
+ skia_enable_fontmgr_custom_directory ||
+ skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
deps = [ ":typeface_freetype" ]
- sources = [
- "src/ports/SkFontMgr_custom.cpp",
- "src/ports/SkFontMgr_custom.h",
- "src/ports/SkFontMgr_custom_directory.cpp",
- "src/ports/SkFontMgr_custom_directory_factory.cpp",
- "src/ports/SkFontMgr_custom_embedded.cpp",
- "src/ports/SkFontMgr_custom_empty.cpp",
+ public = [ "src/ports/SkFontMgr_custom.h" ]
+ sources = [ "src/ports/SkFontMgr_custom.cpp" ]
+}
+
+optional("fontmgr_custom_directory") {
+ enabled = skia_enable_fontmgr_custom_directory
+
+ deps = [
+ ":fontmgr_custom",
+ ":typeface_freetype",
]
+ public = [ "include/ports/SkFontMgr_directory.h" ]
+ sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
+}
+
+optional("fontmgr_custom_embedded") {
+ enabled = skia_enable_fontmgr_custom_embedded
+
+ deps = [
+ ":fontmgr_custom",
+ ":typeface_freetype",
+ ]
+ sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
}
optional("fontmgr_custom_empty") {
enabled = skia_enable_fontmgr_custom_empty
- deps = [ ":typeface_freetype" ]
- sources = [
- "src/ports/SkFontMgr_custom.cpp",
- "src/ports/SkFontMgr_custom_empty.cpp",
- "src/ports/SkFontMgr_custom_empty_factory.cpp",
+ deps = [
+ ":fontmgr_custom",
+ ":typeface_freetype",
]
+ public = [ "include/ports/SkFontMgr_empty.h" ]
+ sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
}
-optional("fontmgr_empty") {
- enabled = skia_enable_fontmgr_empty
- sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
+optional("fontmgr_fontconfig") {
+ enabled = skia_enable_fontmgr_fontconfig
+
+ deps = [
+ ":typeface_freetype",
+ "//third_party:fontconfig",
+ ]
+ public = [ "include/ports/SkFontMgr_fontconfig.h" ]
+ sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
}
-optional("fontmgr_fontconfig") {
- enabled = skia_use_freetype && skia_use_fontconfig
+optional("fontmgr_FontConfigInterface") {
+ enabled = skia_enable_fontmgr_FontConfigInterface
deps = [
":typeface_freetype",
"//third_party:fontconfig",
]
+ public = [
+ "include/ports/SkFontConfigInterface.h",
+ "include/ports/SkFontMgr_FontConfigInterface.h",
+ ]
sources = [
"src/ports/SkFontConfigInterface.cpp",
"src/ports/SkFontConfigInterface_direct.cpp",
"src/ports/SkFontConfigInterface_direct_factory.cpp",
+ "src/ports/SkFontConfigTypeface.h",
"src/ports/SkFontMgr_FontConfigInterface.cpp",
- "src/ports/SkFontMgr_fontconfig.cpp",
- "src/ports/SkFontMgr_fontconfig_factory.cpp",
]
}
@@ -351,43 +401,52 @@ optional("fontmgr_fuchsia") {
} else {
deps = [ "//sdk/fidl/fuchsia.fonts" ]
}
+ public = [ "src/ports/SkFontMgr_fuchsia.h" ]
+ sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
+}
+
+optional("fontmgr_mac_ct") {
+ enabled = skia_use_fonthost_mac
+
+ public = [
+ "include/ports/SkFontMgr_mac_ct.h",
+ "include/ports/SkTypeface_mac.h",
+ ]
sources = [
- "src/ports/SkFontMgr_fuchsia.cpp",
- "src/ports/SkFontMgr_fuchsia.h",
+ "src/ports/SkFontMgr_mac_ct.cpp",
+ "src/ports/SkScalerContext_mac_ct.cpp",
+ "src/ports/SkScalerContext_mac_ct.h",
+ "src/ports/SkTypeface_mac_ct.cpp",
+ "src/ports/SkTypeface_mac_ct.h",
]
-}
-optional("fontmgr_wasm") {
- enabled = target_cpu == "wasm"
- deps = []
+ if (is_mac) {
+ libs = [
+ # AppKit symbols NSFontWeightXXX may be dlsym'ed.
+ "AppKit.framework",
+ "ApplicationServices.framework",
+ ]
+ }
- # custom_embedded has the source for both embedding a font in the binary
- # (only used for the all-included build) and reading in a font from
- # raw bytes passed over the wire (a typical way to load fonts).
- if (!skia_enable_fontmgr_empty) {
- deps += [ ":typeface_freetype" ]
- sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
-
- # If we haven't opted for no fonts (empty) or fonts, but not the
- # built-in one (custom), then, we need to provide the mechanism for
- # using the built-in font.
- if (!skia_enable_fontmgr_custom) {
- sources += [
- "src/ports/SkFontMgr_custom.cpp",
- "src/ports/SkFontMgr_custom.h",
- "src/ports/SkFontMgr_custom_embedded_factory.cpp",
- ]
- }
+ if (is_ios) {
+ libs = [
+ "CoreFoundation.framework",
+ "CoreGraphics.framework",
+ "CoreText.framework",
+
+ # UIKit symbols UIFontWeightXXX may be dlsym'ed.
+ "UIKit.framework",
+ ]
}
}
optional("fontmgr_win") {
enabled = skia_enable_fontmgr_win
+ public = [ "include/ports/SkTypeface_win.h" ]
sources = [
"src/fonts/SkFontMgr_indirect.cpp",
"src/ports/SkFontMgr_win_dw.cpp",
- "src/ports/SkFontMgr_win_dw_factory.cpp",
"src/ports/SkScalerContext_win_dw.cpp",
"src/ports/SkTypeface_win_dw.cpp",
]
@@ -396,6 +455,7 @@ optional("fontmgr_win") {
optional("fontmgr_win_gdi") {
enabled = skia_enable_fontmgr_win_gdi
+ public = [ "include/ports/SkTypeface_win.h" ]
sources = [ "src/ports/SkFontHost_win.cpp" ]
libs = [ "Gdi32.lib" ]
}
@@ -432,6 +492,7 @@ if (skia_lex) {
args = [
rebase_path(sksllex_path),
rebase_path("bin/clang-format"),
+ rebase_path("bin/fetch-clang-format"),
rebase_path("src"),
]
}
@@ -498,6 +559,7 @@ if (skia_compile_processors) {
args = [
rebase_path(skslc_path),
rebase_path("bin/clang-format"),
+ rebase_path("bin/fetch-clang-format"),
]
args += rebase_path(skia_gpu_processor_sources)
}
@@ -632,10 +694,6 @@ optional("gpu") {
cflags_objcc += [ "-fobjc-arc" ]
}
- if (skia_enable_atlas_text) {
- sources += skia_atlas_text_sources
- }
-
if (is_debug) {
public_defines += [ "SK_ENABLE_DUMP_GPU" ]
}
@@ -803,7 +861,31 @@ optional("webp_encode") {
optional("wuffs") {
enabled = skia_use_wuffs
- public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
+ public_defines = [
+ "SK_HAS_WUFFS_LIBRARY",
+ # SK_FAVOR_WUFFS_V_0_3_OVER_V_0_2 is temporary, used during a multiple step
+ # transition (perhaps a month or two in mid 2020), distributed across
+ # multiple repositories:
+ #
+ # 1. Let Skia work with either Wuffs v0.3 or v0.2. The default everywhere
+ # remains at v0.2, but users may now opt in to v0.3.
+ # 2a. Update users' Skia version (automatic if they update regularly).
+ # 2b. Update users to the latest Wuffs rev, which provides both versions.
+ # 3a. Have users opt in to v0.3.
+ # 3b. Update Skia's default configuration (and those who copy it) to v0.3.
+ # 4. Flip Skia-uses-Wuffs-v0.3 from opt-in to opt-out.
+ # 5. Remove the option for Skia to work wih Wuffs v0.2, which will remove
+ # this SK_FAVOR_WUFFS_V_0_3_OVER_V_0_2 macro as well as many #ifdef's
+ # in SkWuffsCodec.cpp.
+ #
+ # Steps 2a and 2b can occur concurrently. Similarly for 3a and 3b.
+ #
+ # "Users" means software that uses Skia+Wuffs, such as Chromium or Flutter.
+ #
+ # Uncommenting the next line (as well as changing "0.2" to "0.3" in
+ # "etc/wuffs-v0.2.c" in third_party/wuffs/BUILD.gn) is step 3b.
+ # "SK_FAVOR_WUFFS_V_0_3_OVER_V_0_2",
+ ]
deps = [ "//third_party/wuffs" ]
sources = [ "src/codec/SkWuffsCodec.cpp" ]
@@ -860,6 +942,16 @@ component("skia") {
configs += skia_library_configs
public_deps = [
+ ":fontmgr_FontConfigInterface",
+ ":fontmgr_android",
+ ":fontmgr_custom_directory",
+ ":fontmgr_custom_embedded",
+ ":fontmgr_custom_empty",
+ ":fontmgr_fontconfig",
+ ":fontmgr_fuchsia",
+ ":fontmgr_mac_ct",
+ ":fontmgr_win",
+ ":fontmgr_win_gdi",
":gpu",
":pdf",
":skcms",
@@ -873,15 +965,7 @@ component("skia") {
":avx",
":compile_processors",
":crc32",
- ":fontmgr_android",
- ":fontmgr_custom",
- ":fontmgr_custom_empty",
- ":fontmgr_empty",
- ":fontmgr_fontconfig",
- ":fontmgr_fuchsia",
- ":fontmgr_wasm",
- ":fontmgr_win",
- ":fontmgr_win_gdi",
+ ":fontmgr_factory",
":gif",
":heif",
":hsw",
@@ -893,6 +977,7 @@ component("skia") {
":raw",
":sksl_interpreter",
":skvm_jit",
+ ":skx",
":sse2",
":sse41",
":sse42",
@@ -922,8 +1007,6 @@ component("skia") {
sources += [
"src/android/SkAndroidFrameworkUtils.cpp",
"src/android/SkAnimatedImage.cpp",
- "src/android/SkBitmapRegionCodec.cpp",
- "src/android/SkBitmapRegionDecoder.cpp",
"src/codec/SkAndroidCodec.cpp",
"src/codec/SkAndroidCodecAdapter.cpp",
"src/codec/SkBmpBaseCodec.cpp",
@@ -999,10 +1082,6 @@ component("skia") {
}
}
- if (skia_use_fonthost_mac) {
- sources += [ "src/ports/SkFontHost_mac.cpp" ]
- }
-
if (is_mac) {
sources += [
"src/ports/SkDebug_stdio.cpp",
@@ -1010,8 +1089,6 @@ component("skia") {
"src/ports/SkImageGeneratorCG.cpp",
]
libs += [
- # AppKit symbols NSFontWeightXXX may be dlsym'ed.
- "AppKit.framework",
"ApplicationServices.framework",
"OpenGL.framework",
]
@@ -1020,19 +1097,13 @@ component("skia") {
if (is_ios) {
sources += [
"src/ports/SkDebug_stdio.cpp",
- "src/ports/SkFontHost_mac.cpp",
"src/ports/SkImageEncoder_CG.cpp",
"src/ports/SkImageGeneratorCG.cpp",
]
libs += [
"CoreFoundation.framework",
- "CoreGraphics.framework",
- "CoreText.framework",
"ImageIO.framework",
"MobileCoreServices.framework",
-
- # UIKit symbols UIFontWeightXXX may be dlsym'ed.
- "UIKit.framework",
]
}
@@ -1063,8 +1134,6 @@ if (target_cpu == "wasm") {
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
]
-
- deps = [ ":fontmgr_wasm" ]
}
}
@@ -1117,6 +1186,7 @@ static_library("pathkit") {
"src/core/SkPathRef.cpp",
"src/core/SkPoint.cpp",
"src/core/SkRRect.cpp",
+ "src/core/SkReadBuffer.cpp",
"src/core/SkRect.cpp",
"src/core/SkSemaphore.cpp",
"src/core/SkStream.cpp",
@@ -1142,11 +1212,9 @@ group("modules") {
deps = [
"modules/particles",
"modules/skottie",
+ "modules/skparagraph",
"modules/skshaper",
]
- if (target_cpu == "wasm") {
- deps += [ "modules/skparagraph" ]
- }
}
# Targets guarded by skia_enable_tools may use //third_party freely.
@@ -1154,7 +1222,6 @@ if (skia_enable_tools) {
skia_public_includes = [
"client_utils/android",
"include/android",
- "include/atlastext",
"include/c",
"include/codec",
"include/config",
@@ -1223,10 +1290,21 @@ if (skia_enable_tools) {
include_dirs = [ "include/third_party/vulkan" ]
}
+ config("cpp14") {
+ if (is_win) {
+ cflags_cc = [ "/std:c++14" ]
+ } else {
+ cflags_cc = [ "-std=c++14" ]
+ }
+ }
+
source_set("public_headers_warnings_check") {
sources = [ "tools/public_headers_warnings_check.cpp" ]
configs -= [ "//gn:warnings_except_public_headers" ]
- configs += [ ":our_vulkan_headers" ]
+ configs += [
+ ":our_vulkan_headers",
+ ":cpp14",
+ ]
deps = [
":skia",
":skia.h",
@@ -1350,10 +1428,8 @@ if (skia_enable_tools) {
libs = []
if (skia_use_gl) {
- sources += [
- "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
- "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
- ]
+ sources +=
+ [ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
if (is_ios) {
sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
libs += [ "OpenGLES.framework" ]
@@ -1389,8 +1465,14 @@ if (skia_enable_tools) {
}
if (skia_use_vulkan) {
+ sources += [ "tools/gpu/vk/VkTestContext.h" ]
sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
+ sources += [ "tools/gpu/vk/VkTestHelper.h" ]
+ sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
+ sources += [ "tools/gpu/vk/VkTestUtils.h" ]
sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
+ sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
+ sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
}
if (skia_use_metal) {
sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
@@ -1402,7 +1484,9 @@ if (skia_enable_tools) {
if (skia_use_dawn) {
public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
- cflags_cc = [ "-Wno-microsoft-cast" ]
+ if (is_clang) {
+ cflags_cc = [ "-Wno-microsoft-cast" ]
+ }
}
if (is_fuchsia && using_fuchsia_sdk) {
@@ -1527,6 +1611,8 @@ if (skia_enable_tools) {
":tool_utils",
"modules/skottie",
"modules/skottie:gm",
+ "modules/skparagraph",
+ "modules/skparagraph:gm",
"modules/skshaper",
]
if (is_skia_dev_build) {
@@ -1561,7 +1647,7 @@ if (skia_enable_tools) {
if (!skia_enable_fontmgr_android) {
sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
}
- if (!(skia_use_freetype && skia_use_fontconfig)) {
+ if (!skia_enable_fontmgr_fontconfig) {
sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
}
deps = [
@@ -1570,6 +1656,7 @@ if (skia_enable_tools) {
":skia",
":skvm_builders",
":tool_utils",
+ "experimental/skrive:tests",
"modules/skottie:tests",
"modules/skparagraph:tests",
"modules/sksg:tests",
@@ -1711,6 +1798,10 @@ if (skia_enable_tools) {
}
}
if (target_cpu != "wasm") {
+ test_app("convert-to-nia") {
+ sources = [ "tools/convert-to-nia.cpp" ]
+ deps = [ ":skia" ]
+ }
test_app("imgcvt") {
sources = [ "tools/imgcvt.cpp" ]
deps = [
@@ -1806,7 +1897,7 @@ if (skia_enable_tools) {
":skia",
":tool_utils",
":trace",
- "modules/skparagraph:bench",
+ "modules/skparagraph",
"modules/skshaper",
]
}
@@ -1941,6 +2032,7 @@ if (skia_enable_tools) {
"fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
"fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
"fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
+ "fuzz/oss_fuzz/FuzzSVG.cpp",
"fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
"fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
"tools/UrlDataManager.cpp",
@@ -2066,10 +2158,7 @@ if (skia_enable_tools) {
test_app("skottie_android") {
is_shared_library = true
- sources = [
- "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
- "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
- ]
+ sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
libs = []
deps = [
@@ -2193,6 +2282,10 @@ if (skia_enable_tools) {
}
}
+ if (skia_use_direct3d) {
+ sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
+ }
+
if (skia_use_dawn) {
sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
if (is_linux) {
@@ -2256,6 +2349,7 @@ if (skia_enable_tools) {
"tools/viewer/ParticlesSlide.cpp",
"tools/viewer/SKPSlide.cpp",
"tools/viewer/SampleSlide.cpp",
+ "tools/viewer/SkRiveSlide.cpp",
"tools/viewer/SkSLSlide.cpp",
"tools/viewer/SkottieSlide.cpp",
"tools/viewer/SlideDir.cpp",
@@ -2278,6 +2372,7 @@ if (skia_enable_tools) {
":skia",
":tool_utils",
":trace",
+ "experimental/skrive",
"modules/particles",
"modules/skottie",
"modules/skottie:utils",
@@ -2288,6 +2383,9 @@ if (skia_enable_tools) {
deps += [ ":experimental_xform" ]
sources += [ "gm/xform.cpp" ]
}
+ if (skia_use_vulkan) {
+ deps += [ "//third_party/spirv-tools:spvtools" ]
+ }
}
}
@@ -2306,8 +2404,7 @@ if (skia_enable_tools) {
}
}
- if (skia_use_gl && (is_linux || is_mac || is_ios) &&
- target_cpu != "mips64el" && target_cpu != "loongson3a") {
+ if (skia_use_gl && (is_linux || is_mac || is_ios)) {
test_app("SkiaSDLExample") {
sources = [ "example/SkiaSDLExample.cpp" ]
libs = []