import("gn/android_framework_defines.gni")
import("gn/shared_sources.gni")
+if (is_fuchsia) {
+ import("//build/vulkan/config.gni")
+}
+
if (!defined(is_skia_standalone)) {
is_skia_standalone = false
}
+is_skia_dev_build = is_skia_standalone && !is_official_build
declare_args() {
skia_use_angle = false
+ skia_use_egl = false
skia_use_expat = true
skia_use_fontconfig = is_linux
skia_use_freetype = is_android || is_fuchsia || is_linux
skia_android_serial = ""
skia_enable_android_framework_defines = false
skia_enable_discrete_gpu = true
+ skia_enable_effects = true
skia_enable_gpu = true
skia_enable_pdf = true
- skia_enable_splicer =
- is_skia_standalone &&
- (is_linux || is_mac || (is_android && target_cpu == "arm64"))
- skia_enable_tools = is_skia_standalone
- skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
+ skia_enable_spirv_validation = is_skia_dev_build && is_debug
+ skia_enable_tools = is_skia_dev_build
+ skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
skia_vulkan_sdk = getenv("VULKAN_SDK")
}
declare_args() {
- skia_use_dng_sdk =
- !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
+ skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
skia_use_sfntly = skia_use_icu
if (is_android) {
skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
+ } else if (is_fuchsia) {
+ skia_use_vulkan = fuchsia_use_vulkan
} else {
skia_use_vulkan = skia_vulkan_sdk != ""
}
}
+declare_args() {
+ if (skia_use_vulkan) {
+ if (is_fuchsia) {
+ skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
+ } else if (is_linux || is_win) {
+ skia_vulkan_headers = "$skia_vulkan_sdk/include"
+ } else {
+ # When buliding on Android we get the header via the NDK
+ skia_vulkan_headers = ""
+ }
+ } else {
+ skia_vulkan_headers = "third_party/vulkan"
+ }
+}
# Our tools require static linking (they use non-exported symbols).
skia_enable_tools = skia_enable_tools && !is_component_build
"include/config",
"include/core",
"include/effects",
+ "include/encode",
"include/gpu",
"include/gpu/gl",
- "include/images",
"include/pathops",
"include/ports",
"include/svg",
"include/utils",
"include/utils/mac",
- "include/xml",
]
# Skia public API, generally provided by :skia.
config("skia_public") {
include_dirs = skia_public_includes
+ if (skia_vulkan_headers != "") {
+ include_dirs += [ skia_vulkan_headers ]
+ }
defines = []
if (is_component_build) {
defines += [ "SKIA_DLL" ]
"src/effects",
"src/effects/gradients",
"src/fonts",
- "src/gpu",
"src/image",
"src/images",
"src/lazy",
"src/sksl",
"src/utils",
"src/utils/win",
+ "src/xml",
"third_party/etc1",
"third_party/gif",
- "third_party/ktx",
]
- defines = [
- "SK_GAMMA_APPLY_TO_A8",
- "SK_INTERNAL",
- ]
+ defines = [ "SK_GAMMA_APPLY_TO_A8" ]
if (is_android) {
defines += [
"SK_GAMMA_EXPONENT=1.4",
libs = []
lib_dirs = []
if (skia_use_vulkan) {
- if (skia_vulkan_sdk != "" && !is_android) {
+ if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
if (is_win) {
- include_dirs += [ "$skia_vulkan_sdk/Include/" ]
- lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
+ lib_dirs += [
+ "$skia_vulkan_sdk/Bin",
+ "$skia_vulkan_sdk/Lib",
+ ]
} else {
- include_dirs += [ "$skia_vulkan_sdk/include/" ]
lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
}
}
- if (is_win) {
- libs += [ "vulkan-1.lib" ]
- } else {
- libs += [ "vulkan" ]
- }
+ }
+ if (skia_enable_gpu) {
+ include_dirs += [ "src/gpu" ]
}
if (skia_use_angle) {
defines += [ "SK_ANGLE" ]
}
}
+optional("effects") {
+ enabled = skia_enable_effects
+ sources =
+ skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
+ sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
+}
+
optional("fontmgr_android") {
enabled = fontmgr_android_enabled
deps = [
+ ":typeface_freetype",
"//third_party/expat",
- "//third_party/freetype2",
]
sources = [
"src/ports/SkFontMgr_android.cpp",
enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
deps = [
- "//third_party/freetype2",
+ ":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",
]
}
enabled = skia_use_freetype && skia_use_fontconfig
deps = [
+ ":typeface_freetype",
"//third_party:fontconfig",
- "//third_party/freetype2",
]
sources = [
"src/ports/SkFontConfigInterface.cpp",
enabled = is_fuchsia && skia_use_freetype
deps = [
- "//third_party/freetype2",
+ ":typeface_freetype",
]
sources = [
"src/ports/SkFontMgr_custom.cpp",
+ "src/ports/SkFontMgr_custom_empty.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
]
}
enabled = skia_enable_gpu
public_defines = []
- sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
+ sources = skia_gpu_sources + skia_sksl_sources +
+ [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
# These paths need to be absolute to match the ones produced by shared_sources.gni.
sources -= get_path_info([
libs = []
if (is_android) {
sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
+ } else if (skia_use_egl) {
+ sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
+ libs += [ "EGL" ]
} else if (is_linux) {
sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
+ libs += [
+ "GL",
+ "GLU",
+ ]
} else if (is_mac) {
sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
} else if (is_ios) {
public_defines += [ "SK_ENABLE_VK_LAYERS" ]
}
}
+ if (skia_enable_spirv_validation) {
+ deps = [
+ "//third_party/spirv-tools",
+ ]
+ public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
+ }
}
optional("jpeg") {
"src/codec/SkJpegCodec.cpp",
"src/codec/SkJpegDecoderMgr.cpp",
"src/codec/SkJpegUtility.cpp",
- "src/images/SkJPEGImageEncoder.cpp",
"src/images/SkJPEGWriteUtility.cpp",
+ "src/images/SkJpegEncoder.cpp",
]
}
sources = [
"src/codec/SkIcoCodec.cpp",
"src/codec/SkPngCodec.cpp",
- "src/images/SkPNGImageEncoder.cpp",
+ "src/images/SkPngEncoder.cpp",
]
}
]
}
-optional("splicer") {
- enabled = skia_enable_splicer
- public_defines = [ "SK_RASTER_PIPELINE_HAS_JIT" ]
-
- sources = [
- "src/splicer/SkSplicer.cpp",
- ]
-}
-
optional("typeface_freetype") {
enabled = skia_use_freetype
sources = [
"src/codec/SkWebpAdapterCodec.cpp",
"src/codec/SkWebpCodec.cpp",
- "src/images/SkWEBPImageEncoder.cpp",
+ "src/images/SkWebpEncoder.cpp",
]
}
"//third_party/expat",
]
sources = [
+ "src/svg/SkSVGCanvas.cpp",
+ "src/svg/SkSVGDevice.cpp",
"src/xml/SkDOM.cpp",
"src/xml/SkXMLParser.cpp",
"src/xml/SkXMLWriter.cpp",
":armv7",
":avx",
":crc32",
+ ":effects",
":fontmgr_android",
":fontmgr_custom",
":fontmgr_fontconfig",
":pdf",
":png",
":raw",
- ":splicer",
":sse2",
":sse41",
":sse42",
":ssse3",
- ":typeface_freetype",
":webp",
":xml",
]
sources = []
sources += skia_core_sources
- sources += skia_effects_sources
- sources += skia_sksl_sources
sources += skia_utils_sources
sources += skia_xps_sources
sources += [
"src/codec/SkWbmpCodec.cpp",
"src/images/SkImageEncoder.cpp",
"src/ports/SkDiscardableMemory_none.cpp",
- "src/ports/SkGlobalInitialization_default.cpp",
"src/ports/SkImageGenerator_skia.cpp",
"src/ports/SkMemory_malloc.cpp",
"src/ports/SkOSFile_stdio.cpp",
"src/sfnt/SkOTTable_name.cpp",
"src/sfnt/SkOTUtils.cpp",
- "src/svg/SkSVGCanvas.cpp",
- "src/svg/SkSVGDevice.cpp",
"src/utils/mac/SkStream_mac.cpp",
"third_party/etc1/etc1.cpp",
"third_party/gif/SkGifImageReader.cpp",
- "third_party/ktx/ktx.cpp",
]
libs = []
if (is_android) {
deps += [ "//third_party/expat" ]
+ if (defined(ndk) && ndk != "") {
+ deps += [ "//third_party/cpu-features" ]
+ }
sources += [ "src/ports/SkDebug_android.cpp" ]
libs += [
"EGL",
}
if (is_linux) {
- libs += [
- "GL",
- "GLU",
- "X11",
- ]
sources += [ "src/ports/SkDebug_stdio.cpp" ]
}
"src/ports/SkImageGeneratorCG.cpp",
]
libs += [
+ # AppKit symbols NSFontWeightXXX may be dlsym'ed.
+ "AppKit.framework",
"ApplicationServices.framework",
"OpenGL.framework",
]
"CoreText.framework",
"ImageIO.framework",
"MobileCoreServices.framework",
+
+ # UIKit symbols UIFontWeightXXX may be dlsym'ed.
+ "UIKit.framework",
]
}
skia_h = "$target_gen_dir/skia.h"
script = "gn/find_headers.py"
args = [ rebase_path(skia_h, root_build_dir) ] +
- rebase_path(skia_public_includes)
+ rebase_path(skia_public_includes) +
+ [ rebase_path("third_party/vulkan") ]
depfile = "$skia_h.deps"
outputs = [
skia_h,
"tools/fiddle/draw.cpp",
"tools/fiddle/fiddle_main.cpp",
]
+ testonly = true
deps = [
+ ":flags",
":skia",
":skia.h",
]
]
libs = []
- if (is_android) {
+ if (is_android || skia_use_egl) {
sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
} else if (is_ios) {
sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
libs += [ "OpenGLES.framework" ]
} else if (is_linux) {
sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
+ libs += [ "X11" ]
} else if (is_mac) {
sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
} else if (is_win) {
}
if (skia_use_vulkan) {
sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
+ if (is_win) {
+ libs += [ "vulkan-1.lib" ]
+ } else {
+ libs += [ "vulkan" ]
+ }
}
}
}
"tools/timer",
]
sources = [
- "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
"tools/AndroidSkDebugToStdOut.cpp",
"tools/CrashHandler.cpp",
"tools/LsanSuppressions.cpp",
"tools/sk_tool_utils_font.cpp",
"tools/timer/Timer.cpp",
]
+ libs = []
+ if (is_ios) {
+ sources += [ "tools/ios_utils.m" ]
+ libs += [ "Foundation.framework" ]
+ }
deps = [
":common_flags",
":flags",
deps = [
":experimental_svg_model",
":flags",
- ":gpu_tool_utils",
":skia",
":tool_utils",
"//third_party/libpng",
"//third_party/zlib",
]
+ public_deps = [
+ ":gpu_tool_utils", # Test.h #includes headers from this target.
+ ]
}
import("gn/bench.gni")
"src/views/unix/SkOSWindow_Unix.cpp",
"src/views/unix/keysym2ucs.c",
]
+ libs += [
+ "GL",
+ "X11",
+ ]
} else if (is_mac) {
sources += [
"src/views/mac/SkEventNotifier.mm",
]
deps = [
":experimental_svg_model",
+ ":flags",
":gm",
":tool_utils",
":views",
]
}
+ test_app("ok") {
+ sources = [
+ "tools/ok.cpp",
+ "tools/ok_dsts.cpp",
+ "tools/ok_srcs.cpp",
+ "tools/ok_test.cpp",
+ "tools/ok_vias.cpp",
+ ]
+ deps = [
+ ":gm",
+ ":skia",
+ ":tests",
+ ":tool_utils",
+ ]
+ }
+
if (!is_debug) { # I've benchmarked debug code once too many times...
test_app("monobench") {
sources = [
]
}
+ test_app("skpinfo") {
+ sources = [
+ "tools/skpinfo.cpp",
+ ]
+ deps = [
+ ":flags",
+ ":skia",
+ ]
+ }
+
if (is_linux || is_win || is_mac) {
test_app("SampleApp") {
sources = [
]
}
+ test_app("create_flutter_test_images") {
+ sources = [
+ "tools/create_flutter_test_images.cpp",
+ ]
+ deps = [
+ ":skia",
+ ":tool_utils",
+ ]
+ }
+
test_app("get_images_from_skps") {
sources = [
"tools/get_images_from_skps.cpp",
test_app("fuzz") {
sources = [
"fuzz/FilterFuzz.cpp",
+ "fuzz/FuzzCanvas.cpp",
"fuzz/FuzzDrawFunctions.cpp",
"fuzz/FuzzGradients.cpp",
"fuzz/FuzzParsePath.cpp",
]
deps = [
":flags",
+ ":gpu_tool_utils",
":skia",
":tool_utils",
]
"tools/viewer/sk_app/CommandSet.cpp",
"tools/viewer/sk_app/GLWindowContext.cpp",
"tools/viewer/sk_app/Window.cpp",
- "tools/viewer/sk_app/WindowContext.cpp",
]
libs = []
"tools/viewer/sk_app/android/main_android.cpp",
"tools/viewer/sk_app/android/surface_glue_android.cpp",
]
+ libs += [ "android" ]
} else if (is_linux) {
sources += [
"tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
if (is_android) {
sources +=
[ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
- libs += [ "android" ]
} else if (is_linux) {
sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
libs += [ "X11-xcb" ]
":skia",
":tool_utils",
":views",
+ "//third_party/imgui",
"//third_party/jsoncpp",
]
if (is_android) {
}
}
- if (is_android) {
+ if (is_android && defined(ndk) && ndk != "") {
copy("gdbserver") {
sources = [
"$ndk/$ndk_gdbserver",
"$root_out_dir/gdbserver",
]
}
- if (ndk_simpleperf != "") {
- copy("simpleperf") {
- sources = [
- "$ndk/$ndk_simpleperf",
- "$ndk/simpleperf/simpleperf_report.py",
- ]
- outputs = [
- "$root_out_dir/{{source_file_part}}",
- ]
- }
- }
}
if (skia_enable_gpu) {
test_app("skslc") {
+ defines = [ "SKSL_STANDALONE" ]
sources = [
"src/sksl/SkSLMain.cpp",
]
- deps = [
- ":flags",
- ":skia",
- ]
+ sources += skia_sksl_sources
+ include_dirs = [ "src/sksl" ]
}
}
}