mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 06:16:30 +03:00
752 lines
20 KiB
Plaintext
752 lines
20 KiB
Plaintext
|
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
||
|
# Use of this source code is governed by a BSD-style license that can be
|
||
|
# found in the LICENSE file.
|
||
|
|
||
|
import("//build/config/features.gni")
|
||
|
import("//build/config/freetype/freetype.gni")
|
||
|
import("//build/config/sanitizers/sanitizers.gni")
|
||
|
import("//printing/features/features.gni")
|
||
|
import("//testing/test.gni")
|
||
|
import("//third_party/skia/gn/shared_sources.gni")
|
||
|
|
||
|
if (current_cpu == "arm") {
|
||
|
import("//build/config/arm.gni")
|
||
|
}
|
||
|
if (current_cpu == "mipsel" || current_cpu == "mips64el") {
|
||
|
import("//build/config/mips.gni")
|
||
|
}
|
||
|
|
||
|
skia_support_gpu = !is_ios
|
||
|
skia_support_pdf = !is_ios && (enable_basic_printing || enable_print_preview)
|
||
|
|
||
|
declare_args() {
|
||
|
skia_whitelist_serialized_typefaces = false
|
||
|
}
|
||
|
|
||
|
# External-facing config for dependent code.
|
||
|
config("skia_config") {
|
||
|
include_dirs = [
|
||
|
"config",
|
||
|
"ext",
|
||
|
"//third_party/skia/include/c",
|
||
|
"//third_party/skia/include/config",
|
||
|
"//third_party/skia/include/core",
|
||
|
"//third_party/skia/include/effects",
|
||
|
"//third_party/skia/include/encode",
|
||
|
"//third_party/skia/include/gpu",
|
||
|
"//third_party/skia/include/images",
|
||
|
"//third_party/skia/include/lazy",
|
||
|
"//third_party/skia/include/pathops",
|
||
|
"//third_party/skia/include/pdf",
|
||
|
"//third_party/skia/include/pipe",
|
||
|
"//third_party/skia/include/ports",
|
||
|
"//third_party/skia/include/utils",
|
||
|
"//third_party/skia/third_party/vulkan",
|
||
|
]
|
||
|
|
||
|
defines = skia_for_chromium_defines
|
||
|
defines += [
|
||
|
"SK_HAS_PNG_LIBRARY",
|
||
|
"SK_HAS_WEBP_LIBRARY",
|
||
|
]
|
||
|
|
||
|
if (!is_ios) {
|
||
|
defines += [ "SK_HAS_JPEG_LIBRARY" ]
|
||
|
}
|
||
|
|
||
|
if (is_component_build) {
|
||
|
defines += [
|
||
|
"SKIA_DLL",
|
||
|
"GR_GL_IGNORE_ES3_MSAA=0",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (skia_support_gpu) {
|
||
|
include_dirs += [
|
||
|
"//third_party/skia/src/gpu",
|
||
|
"//third_party/skia/src/sksl",
|
||
|
]
|
||
|
defines += [ "SK_SUPPORT_GPU=1" ]
|
||
|
} else {
|
||
|
defines += [ "SK_SUPPORT_GPU=0" ]
|
||
|
}
|
||
|
|
||
|
if (is_android) {
|
||
|
defines += [
|
||
|
"SK_BUILD_FOR_ANDROID",
|
||
|
"USE_CHROMIUM_SKIA",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_mac) {
|
||
|
defines += [ "SK_BUILD_FOR_MAC" ]
|
||
|
}
|
||
|
|
||
|
if (is_win) {
|
||
|
defines += [ "GR_GL_FUNCTION_TYPE=__stdcall" ]
|
||
|
}
|
||
|
|
||
|
if (skia_whitelist_serialized_typefaces) {
|
||
|
defines += [ "SK_WHITELIST_SERIALIZED_TYPEFACES" ]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# Internal-facing config for Skia library code.
|
||
|
config("skia_library_config") {
|
||
|
# These include directories are only included for Skia code and are not
|
||
|
# exported to dependents.
|
||
|
include_dirs = [
|
||
|
"//third_party/skia/include/codec",
|
||
|
"//third_party/skia/include/private",
|
||
|
"//third_party/skia/include/client/android",
|
||
|
"//third_party/skia/src/codec",
|
||
|
"//third_party/skia/src/core",
|
||
|
"//third_party/skia/src/image",
|
||
|
"//third_party/skia/src/images",
|
||
|
"//third_party/skia/src/opts",
|
||
|
"//third_party/skia/src/pdf",
|
||
|
"//third_party/skia/src/ports",
|
||
|
"//third_party/skia/src/shaders",
|
||
|
"//third_party/skia/src/shaders/gradients",
|
||
|
"//third_party/skia/src/sfnt",
|
||
|
"//third_party/skia/src/utils",
|
||
|
"//third_party/skia/src/lazy",
|
||
|
"//third_party/skia/third_party/gif",
|
||
|
]
|
||
|
if (is_mac || is_ios) {
|
||
|
include_dirs += [ "//third_party/skia/include/utils/mac" ]
|
||
|
}
|
||
|
if (is_mac) {
|
||
|
include_dirs += [ "//third_party/skia/include/utils/ios" ]
|
||
|
}
|
||
|
|
||
|
# TODO: remove after Skia shader relocation (https://skia-review.googlesource.com/c/17927)
|
||
|
include_dirs += [ "//third_party/skia/src/effects/gradients" ]
|
||
|
|
||
|
defines = []
|
||
|
|
||
|
if (!is_ios && !use_system_freetype) {
|
||
|
defines += [ "SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR) * 0x01000000) | ((FREETYPE_MINOR) * 0x00010000) | ((FREETYPE_PATCH) * 0x00000100))" ]
|
||
|
}
|
||
|
|
||
|
if (is_component_build) {
|
||
|
defines += [ "SKIA_IMPLEMENTATION=1" ]
|
||
|
}
|
||
|
|
||
|
if (current_cpu == "arm") {
|
||
|
if (arm_use_neon) {
|
||
|
defines += [ "SK_ARM_HAS_NEON" ]
|
||
|
} else if (arm_optionally_use_neon) {
|
||
|
defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# Settings for text blitting, chosen to approximate the system browser.
|
||
|
if (is_linux) {
|
||
|
defines += [
|
||
|
"SK_GAMMA_EXPONENT=1.2",
|
||
|
"SK_GAMMA_CONTRAST=0.2",
|
||
|
]
|
||
|
} else if (is_android) {
|
||
|
defines += [
|
||
|
"SK_GAMMA_APPLY_TO_A8",
|
||
|
"SK_GAMMA_EXPONENT=1.4",
|
||
|
"SK_GAMMA_CONTRAST=0.0",
|
||
|
]
|
||
|
} else if (is_win) {
|
||
|
defines += [
|
||
|
"SK_GAMMA_SRGB",
|
||
|
"SK_GAMMA_CONTRAST=0.5",
|
||
|
]
|
||
|
} else if (is_mac) {
|
||
|
defines += [
|
||
|
"SK_GAMMA_SRGB",
|
||
|
"SK_GAMMA_CONTRAST=0.0",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_android) {
|
||
|
defines += [
|
||
|
# Android devices are typically more memory constrained, so default to a
|
||
|
# smaller glyph cache (it may be overriden at runtime when the renderer
|
||
|
# starts up, depending on the actual device memory).
|
||
|
"SK_DEFAULT_FONT_CACHE_LIMIT=1048576", # 1024 * 1024
|
||
|
]
|
||
|
} else {
|
||
|
defines += [ "SK_DEFAULT_FONT_CACHE_LIMIT=20971520" ] # 20 * 1024 * 1024
|
||
|
}
|
||
|
|
||
|
if (is_win) {
|
||
|
include_dirs += [
|
||
|
"//third_party/skia/include/utils/win",
|
||
|
"//third_party/skia/src/utils/win",
|
||
|
]
|
||
|
|
||
|
defines += [
|
||
|
# On windows, GDI handles are a scarse system-wide resource so we have to
|
||
|
# keep the glyph cache, which holds up to 4 GDI handles per entry, to a
|
||
|
# fairly small size. http://crbug.com/314387
|
||
|
"SK_DEFAULT_FONT_CACHE_COUNT_LIMIT=256",
|
||
|
]
|
||
|
|
||
|
cflags = [
|
||
|
"/wd4244", # conversion from 'type1( __int64)' to 'type2 (unsigned int)'
|
||
|
"/wd4267", # conversion from 'size_t' (64 bit) to 'type'(32 bit).
|
||
|
"/wd4341", # signed value is out of range for enum constant.
|
||
|
"/wd4345", # Object is default-initialized if initialization is omitted.
|
||
|
"/wd4390", # ';'empty statement found in looping;is it what was intended?
|
||
|
"/wd4554", # 'operator' : check operator precedence for possible error
|
||
|
"/wd4748", # compiler will disable optimizations if a function has inline
|
||
|
# assembly code contains flow control(jmp or jcc) statements.
|
||
|
|
||
|
"/wd4800", # forcing value to bool 'true/false'(assigning int to bool).
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
component("skia") {
|
||
|
sources = [
|
||
|
# Chrome sources.
|
||
|
"config/SkUserConfig.h",
|
||
|
"config/sk_ref_cnt_ext_debug.h",
|
||
|
"config/sk_ref_cnt_ext_release.h",
|
||
|
"ext/SkDiscardableMemory_chrome.cc",
|
||
|
"ext/SkDiscardableMemory_chrome.h",
|
||
|
"ext/SkMemory_new_handler.cpp",
|
||
|
"ext/analysis_canvas.cc",
|
||
|
"ext/analysis_canvas.h",
|
||
|
"ext/benchmarking_canvas.cc",
|
||
|
"ext/benchmarking_canvas.h",
|
||
|
"ext/convolver.cc",
|
||
|
"ext/convolver.h",
|
||
|
"ext/event_tracer_impl.cc",
|
||
|
"ext/event_tracer_impl.h",
|
||
|
"ext/fontmgr_default_android.cc",
|
||
|
"ext/fontmgr_default_android.h",
|
||
|
"ext/fontmgr_default_linux.cc",
|
||
|
"ext/fontmgr_default_linux.h",
|
||
|
"ext/fontmgr_default_win.cc",
|
||
|
"ext/fontmgr_default_win.h",
|
||
|
"ext/google_logging.cc",
|
||
|
"ext/image_operations.cc",
|
||
|
"ext/image_operations.h",
|
||
|
"ext/opacity_filter_canvas.cc",
|
||
|
"ext/opacity_filter_canvas.h",
|
||
|
"ext/recursive_gaussian_convolution.cc",
|
||
|
"ext/recursive_gaussian_convolution.h",
|
||
|
"ext/skia_histogram.cc",
|
||
|
"ext/skia_histogram.h",
|
||
|
"ext/skia_memory_dump_provider.cc",
|
||
|
"ext/skia_memory_dump_provider.h",
|
||
|
"ext/skia_trace_memory_dump_impl.cc",
|
||
|
"ext/skia_trace_memory_dump_impl.h",
|
||
|
"ext/skia_utils_base.cc",
|
||
|
"ext/skia_utils_base.h",
|
||
|
"ext/skia_utils_ios.h",
|
||
|
"ext/skia_utils_ios.mm",
|
||
|
"ext/skia_utils_mac.h",
|
||
|
"ext/skia_utils_mac.mm",
|
||
|
"ext/skia_utils_win.cc",
|
||
|
"ext/skia_utils_win.h",
|
||
|
]
|
||
|
|
||
|
if (!is_ios) {
|
||
|
sources += [
|
||
|
"ext/platform_canvas.cc",
|
||
|
"ext/platform_canvas.h",
|
||
|
]
|
||
|
}
|
||
|
if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
|
||
|
sources += [
|
||
|
"ext/convolver_SSE2.cc",
|
||
|
"ext/convolver_SSE2.h",
|
||
|
]
|
||
|
} else if (current_cpu == "mipsel" && mips_dsp_rev >= 2) {
|
||
|
sources += [
|
||
|
"ext/convolver_mips_dspr2.cc",
|
||
|
"ext/convolver_mips_dspr2.h",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
# The imported Skia gni source paths are made absolute by gn.
|
||
|
sources += skia_core_sources
|
||
|
defines = skia_core_defines
|
||
|
sources += skia_effects_sources
|
||
|
sources += skia_utils_sources
|
||
|
sources += skia_xps_sources
|
||
|
sources += [
|
||
|
"//third_party/skia/src/fonts/SkFontMgr_indirect.cpp",
|
||
|
"//third_party/skia/src/fonts/SkRemotableFontMgr.cpp",
|
||
|
"//third_party/skia/src/images/SkImageEncoder.cpp",
|
||
|
"//third_party/skia/src/images/SkPngEncoder.cpp",
|
||
|
"//third_party/skia/src/images/SkWebpEncoder.cpp",
|
||
|
"//third_party/skia/src/ports/SkGlobalInitialization_default.cpp",
|
||
|
"//third_party/skia/src/ports/SkImageGenerator_none.cpp",
|
||
|
"//third_party/skia/src/ports/SkOSFile_stdio.cpp",
|
||
|
"//third_party/skia/src/sfnt/SkOTTable_name.cpp",
|
||
|
"//third_party/skia/src/sfnt/SkOTUtils.cpp",
|
||
|
]
|
||
|
if (!is_ios) {
|
||
|
sources += [
|
||
|
"//third_party/skia/src/images/SkJPEGWriteUtility.cpp",
|
||
|
"//third_party/skia/src/images/SkJpegEncoder.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
# This and skia_opts are really the same conceptual target so share headers.
|
||
|
allow_circular_includes_from = [ ":skia_opts" ]
|
||
|
|
||
|
if (current_cpu == "arm") {
|
||
|
sources += [ "//third_party/skia/src/core/SkUtilsArm.cpp" ]
|
||
|
}
|
||
|
|
||
|
# GPU
|
||
|
if (skia_support_gpu) {
|
||
|
sources += skia_gpu_sources
|
||
|
sources += skia_null_gpu_sources
|
||
|
sources += skia_sksl_sources
|
||
|
}
|
||
|
|
||
|
# Remove unused util sources.
|
||
|
sources -= [
|
||
|
"//third_party/skia/src/utils/SkCamera.cpp",
|
||
|
"//third_party/skia/src/utils/SkDumpCanvas.cpp",
|
||
|
"//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
|
||
|
"//third_party/skia/src/utils/SkInterpolator.cpp",
|
||
|
"//third_party/skia/src/utils/SkOSPath.cpp",
|
||
|
"//third_party/skia/src/utils/SkParsePath.cpp",
|
||
|
]
|
||
|
|
||
|
if (is_win) {
|
||
|
sources -= [
|
||
|
# Keeping _win.cpp
|
||
|
"//third_party/skia/src/utils/SkThreadUtils_pthread.cpp",
|
||
|
]
|
||
|
libs = [ "fontsub.lib" ]
|
||
|
} else {
|
||
|
sources -= [
|
||
|
# Keeping _pthread.cpp
|
||
|
"//third_party/skia/src/utils/SkThreadUtils_win.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
# need separate win section to handle chromes auto gn filter
|
||
|
# (build/config/BUILDCONFIG.gn)
|
||
|
if (is_win) {
|
||
|
sources -= [
|
||
|
#windows
|
||
|
"//third_party/skia/src/utils/win/SkWGL_win.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
# Select Skia ports.
|
||
|
|
||
|
# FreeType is needed everywhere (except on iOS), on Linux and Android as main
|
||
|
# font backend, on Windows and Mac as fallback backend for Variations.
|
||
|
if (!is_ios) {
|
||
|
sources += [
|
||
|
"//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_win) {
|
||
|
sources += [
|
||
|
"//third_party/skia/src/ports/SkFontHost_win.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
|
||
|
"//third_party/skia/src/ports/SkOSFile_win.cpp",
|
||
|
"//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
|
||
|
"//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
|
||
|
"//third_party/skia/src/ports/SkTLS_win.cpp",
|
||
|
"//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
|
||
|
]
|
||
|
} else {
|
||
|
sources += [
|
||
|
"//third_party/skia/src/ports/SkOSFile_posix.cpp",
|
||
|
"//third_party/skia/src/ports/SkTLS_pthread.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_mac || is_ios) {
|
||
|
set_sources_assignment_filter([])
|
||
|
sources += [
|
||
|
"//third_party/skia/src/ports/SkFontHost_mac.cpp",
|
||
|
"//third_party/skia/src/utils/mac/SkStream_mac.cpp",
|
||
|
]
|
||
|
set_sources_assignment_filter(sources_assignment_filter)
|
||
|
}
|
||
|
|
||
|
if (is_linux) {
|
||
|
sources += [
|
||
|
"//third_party/skia/src/ports/SkFontConfigInterface.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontMgr_FontConfigInterface.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_linux || is_android) {
|
||
|
sources += [
|
||
|
# Retain the files for the SkFontMgr_Android on linux to emulate android
|
||
|
# fonts. See content/zygote/zygote_main_linux.cc
|
||
|
# Note that this requires expat.
|
||
|
"//third_party/skia/src/ports/SkFontMgr_android.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontMgr_android_parser.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_win || is_mac) {
|
||
|
sources += [
|
||
|
# Add the FreeType custom font manager as a fallback backend for variable fonts.
|
||
|
"//third_party/skia/src/ports/SkFontMgr_custom.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontMgr_custom_empty.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_fuchsia) {
|
||
|
sources += [
|
||
|
"//third_party/skia/src/ports/SkFontMgr_custom.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontMgr_custom_empty.cpp",
|
||
|
"//third_party/skia/src/ports/SkFontMgr_custom_empty_factory.cpp",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_win) {
|
||
|
sources += [
|
||
|
# Select the right BitmapPlatformDevice.
|
||
|
"ext/raster_handle_allocator_win.cc",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_clang && !is_nacl) {
|
||
|
# Skia won't compile with some of the more strict clang warnings.
|
||
|
# e.g. it does:
|
||
|
# SkASSERT(!"sk_out_of_memory");
|
||
|
configs -= [ "//build/config/clang:extra_warnings" ]
|
||
|
}
|
||
|
|
||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||
|
configs += [
|
||
|
":skia_config",
|
||
|
":skia_library_config",
|
||
|
"//build/config/compiler:no_chromium_code",
|
||
|
]
|
||
|
public_configs = [ ":skia_config" ]
|
||
|
|
||
|
deps = [
|
||
|
":skia_opts",
|
||
|
"//base",
|
||
|
"//base/third_party/dynamic_annotations",
|
||
|
"//third_party/libpng",
|
||
|
"//third_party/libwebp",
|
||
|
]
|
||
|
|
||
|
if (!is_ios) {
|
||
|
deps += [
|
||
|
"//build/config/freetype",
|
||
|
"//third_party:jpeg",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_linux) {
|
||
|
deps += [
|
||
|
"//third_party/expat",
|
||
|
"//third_party/fontconfig",
|
||
|
"//third_party/icu:icuuc",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_android) {
|
||
|
deps += [
|
||
|
"//third_party/android_tools:cpu_features",
|
||
|
"//third_party/expat",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (skia_support_pdf) {
|
||
|
deps += [
|
||
|
"//third_party/sfntly",
|
||
|
"//third_party/zlib",
|
||
|
]
|
||
|
sources += skia_pdf_sources
|
||
|
} else {
|
||
|
sources += [ "//third_party/skia/src/pdf/SkDocument_PDF_None.cpp" ]
|
||
|
}
|
||
|
|
||
|
if (!is_debug) {
|
||
|
configs -= [ "//build/config/compiler:default_optimization" ]
|
||
|
configs += [ "//build/config/compiler:optimize_max" ]
|
||
|
}
|
||
|
|
||
|
if (is_mac) {
|
||
|
libs = [
|
||
|
"AppKit.framework",
|
||
|
"CoreFoundation.framework",
|
||
|
"CoreGraphics.framework",
|
||
|
"CoreText.framework",
|
||
|
"Foundation.framework",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
if (is_ios) {
|
||
|
libs = [ "ImageIO.framework" ]
|
||
|
set_sources_assignment_filter([])
|
||
|
sources += [ "//third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp" ]
|
||
|
set_sources_assignment_filter(sources_assignment_filter)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# Separated out so it can be compiled with different flags for SSE.
|
||
|
if (current_cpu == "arm64") {
|
||
|
source_set("skia_opts_crc32") {
|
||
|
sources = skia_opts.crc32_sources
|
||
|
cflags = [ "-march=armv8-a+crc" ]
|
||
|
visibility = [ ":skia_opts" ]
|
||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||
|
configs += [
|
||
|
":skia_config",
|
||
|
":skia_library_config",
|
||
|
"//build/config/compiler:no_chromium_code",
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
if (current_cpu == "x86" || current_cpu == "x64") {
|
||
|
source_set("skia_opts_sse3") {
|
||
|
sources = skia_opts.ssse3_sources
|
||
|
if (!is_win || is_clang) {
|
||
|
cflags = [ "-mssse3" ]
|
||
|
}
|
||
|
if (is_win) {
|
||
|
defines = [ "SK_CPU_SSE_LEVEL=31" ]
|
||
|
}
|
||
|
visibility = [ ":skia_opts" ]
|
||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||
|
configs += [
|
||
|
":skia_config",
|
||
|
":skia_library_config",
|
||
|
"//build/config/compiler:no_chromium_code",
|
||
|
]
|
||
|
}
|
||
|
source_set("skia_opts_sse41") {
|
||
|
sources = skia_opts.sse41_sources
|
||
|
if (!is_win || is_clang) {
|
||
|
cflags = [ "-msse4.1" ]
|
||
|
}
|
||
|
if (is_win) {
|
||
|
defines = [ "SK_CPU_SSE_LEVEL=41" ]
|
||
|
}
|
||
|
visibility = [ ":skia_opts" ]
|
||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||
|
configs += [
|
||
|
":skia_config",
|
||
|
":skia_library_config",
|
||
|
"//build/config/compiler:no_chromium_code",
|
||
|
]
|
||
|
}
|
||
|
source_set("skia_opts_sse42") {
|
||
|
sources = skia_opts.sse42_sources
|
||
|
if (!is_win || is_clang) {
|
||
|
cflags = [ "-msse4.2" ]
|
||
|
}
|
||
|
if (is_win) {
|
||
|
defines = [ "SK_CPU_SSE_LEVEL=42" ]
|
||
|
}
|
||
|
visibility = [ ":skia_opts" ]
|
||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||
|
configs += [
|
||
|
":skia_config",
|
||
|
":skia_library_config",
|
||
|
"//build/config/compiler:no_chromium_code",
|
||
|
]
|
||
|
}
|
||
|
source_set("skia_opts_avx") {
|
||
|
sources = skia_opts.avx_sources
|
||
|
if (!is_win) {
|
||
|
cflags = [ "-mavx" ]
|
||
|
}
|
||
|
if (is_win) {
|
||
|
cflags = [ "/arch:AVX" ]
|
||
|
}
|
||
|
visibility = [ ":skia_opts" ]
|
||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||
|
configs += [
|
||
|
":skia_config",
|
||
|
":skia_library_config",
|
||
|
"//build/config/compiler:no_chromium_code",
|
||
|
]
|
||
|
}
|
||
|
source_set("skia_opts_hsw") {
|
||
|
# SyzyAsan doesn't support the AVX2 and F16C instructions.
|
||
|
if (!is_syzyasan) {
|
||
|
sources = skia_opts.hsw_sources
|
||
|
} else {
|
||
|
sources = [
|
||
|
"ext/SkOpts_hsw_stub.cc",
|
||
|
]
|
||
|
}
|
||
|
if (!is_win) {
|
||
|
cflags = [
|
||
|
"-mavx2",
|
||
|
"-mbmi",
|
||
|
"-mbmi2",
|
||
|
"-mf16c",
|
||
|
"-mfma",
|
||
|
]
|
||
|
}
|
||
|
if (is_win && !is_syzyasan) {
|
||
|
cflags = [ "/arch:AVX2" ]
|
||
|
}
|
||
|
visibility = [ ":skia_opts" ]
|
||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||
|
configs += [
|
||
|
":skia_config",
|
||
|
":skia_library_config",
|
||
|
"//build/config/compiler:no_chromium_code",
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
source_set("skia_opts") {
|
||
|
cflags = []
|
||
|
defines = []
|
||
|
|
||
|
deps = [
|
||
|
"//base",
|
||
|
]
|
||
|
|
||
|
if (current_cpu == "x86" || current_cpu == "x64") {
|
||
|
sources = skia_opts.sse2_sources
|
||
|
deps += [
|
||
|
":skia_opts_avx",
|
||
|
":skia_opts_hsw",
|
||
|
":skia_opts_sse3",
|
||
|
":skia_opts_sse41",
|
||
|
":skia_opts_sse42",
|
||
|
]
|
||
|
} else if (current_cpu == "arm") {
|
||
|
# The assembly uses the frame pointer register (r7 in Thumb/r11 in
|
||
|
# ARM), the compiler doesn't like that.
|
||
|
if (!is_ios) {
|
||
|
cflags += [ "-fomit-frame-pointer" ]
|
||
|
}
|
||
|
|
||
|
if (arm_version >= 7) {
|
||
|
sources = skia_opts.armv7_sources
|
||
|
if (arm_use_neon || arm_optionally_use_neon) {
|
||
|
sources += skia_opts.neon_sources
|
||
|
|
||
|
# Root build config sets -mfpu=$arm_fpu, which we expect to be neon
|
||
|
# when running this.
|
||
|
if (!arm_use_neon) {
|
||
|
configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
|
||
|
cflags += [ "-mfpu=neon" ]
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
sources = skia_opts.none_sources
|
||
|
}
|
||
|
} else if (current_cpu == "arm64") {
|
||
|
sources = skia_opts.arm64_sources
|
||
|
deps += [ ":skia_opts_crc32" ]
|
||
|
} else if (current_cpu == "mipsel") {
|
||
|
cflags += [ "-fomit-frame-pointer" ]
|
||
|
|
||
|
if (mips_dsp_rev >= 1) {
|
||
|
sources = skia_opts.mips_dsp_sources
|
||
|
} else {
|
||
|
sources = skia_opts.none_sources
|
||
|
}
|
||
|
} else if (current_cpu == "mips64el") {
|
||
|
cflags += [ "-fomit-frame-pointer" ]
|
||
|
sources = skia_opts.none_sources
|
||
|
} else if (current_cpu == "ppc64") {
|
||
|
sources = skia_opts.none_sources
|
||
|
} else if (current_cpu == "s390x") {
|
||
|
sources = skia_opts.none_sources
|
||
|
} else {
|
||
|
assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp")
|
||
|
}
|
||
|
|
||
|
if (!is_debug) {
|
||
|
configs -= [ "//build/config/compiler:default_optimization" ]
|
||
|
configs += [ "//build/config/compiler:optimize_max" ]
|
||
|
}
|
||
|
|
||
|
configs -= [ "//build/config/compiler:chromium_code" ]
|
||
|
configs += [
|
||
|
":skia_config",
|
||
|
":skia_library_config",
|
||
|
"//build/config/compiler:no_chromium_code",
|
||
|
]
|
||
|
|
||
|
visibility = [ ":skia" ]
|
||
|
}
|
||
|
|
||
|
test("skia_unittests") {
|
||
|
sources = [
|
||
|
"ext/analysis_canvas_unittest.cc",
|
||
|
"ext/convolver_unittest.cc",
|
||
|
"ext/image_operations_unittest.cc",
|
||
|
"ext/platform_canvas_unittest.cc",
|
||
|
"ext/recursive_gaussian_convolution_unittest.cc",
|
||
|
"ext/skia_memory_dump_provider_unittest.cc",
|
||
|
"ext/skia_utils_base_unittest.cc",
|
||
|
"ext/skia_utils_ios_unittest.mm",
|
||
|
"ext/skia_utils_mac_unittest.mm",
|
||
|
]
|
||
|
|
||
|
if (!is_win) {
|
||
|
sources -= [ "ext/platform_canvas_unittest.cc" ]
|
||
|
}
|
||
|
|
||
|
deps = [
|
||
|
":skia",
|
||
|
"//base",
|
||
|
"//base/test:test_support",
|
||
|
"//mojo/edk/test:run_all_unittests",
|
||
|
"//testing/gtest",
|
||
|
"//ui/gfx",
|
||
|
"//ui/gfx/geometry",
|
||
|
]
|
||
|
|
||
|
if (!is_ios) {
|
||
|
sources += [ "public/interfaces/test/struct_traits_unittest.cc" ]
|
||
|
deps += [
|
||
|
# TODO: Fix this test to not depend on cc.
|
||
|
"//cc:test_support",
|
||
|
"//mojo/public/cpp/bindings",
|
||
|
"//skia/public/interfaces:test_interfaces",
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (!is_ios) {
|
||
|
executable("image_operations_bench") {
|
||
|
sources = [
|
||
|
"ext/image_operations_bench.cc",
|
||
|
]
|
||
|
|
||
|
deps = [
|
||
|
":skia",
|
||
|
"//base",
|
||
|
"//build/config:exe_and_shlib_deps",
|
||
|
"//build/win:default_exe_manifest",
|
||
|
]
|
||
|
}
|
||
|
|
||
|
executable("filter_fuzz_stub") {
|
||
|
testonly = true
|
||
|
sources = [
|
||
|
"tools/filter_fuzz_stub/filter_fuzz_stub.cc",
|
||
|
]
|
||
|
|
||
|
deps = [
|
||
|
":skia",
|
||
|
"//base",
|
||
|
"//base/test:test_support",
|
||
|
"//build/config:exe_and_shlib_deps",
|
||
|
"//build/win:default_exe_manifest",
|
||
|
]
|
||
|
}
|
||
|
}
|