Separate general defaults from Skia defaults

In the build there are some defaults which actually apply to every
use of a built-in target type, but there are some (particularaly
warnings) which apply only to targets controlled by Skia. Currently
these unwanted defaults are magically known to exist and removed
wherever they are not wanted. Instead, create 'skia_' prefixed target
templates and apply these defaults to those instead.

Change-Id: I3a2afb53c7205a2e2748d1cfad46319f2e93d3b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385516
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Ben Wagner 2021-03-16 14:29:20 -04:00 committed by Skia Commit-Bot
parent e67bd1371e
commit 3d9ab7e7ec
16 changed files with 266 additions and 145 deletions

125
BUILD.gn
View File

@ -111,16 +111,20 @@ skia_library_configs = [
# Use for CPU-specific Skia code that needs particular compiler flags.
template("opts") {
visibility = [ ":*" ]
if (invoker.enabled) {
source_set(target_name) {
skia_source_set(target_name) {
visibility = [ ":*" ]
check_includes = false
configs = skia_library_configs
forward_variables_from(invoker, "*")
configs += skia_library_configs
if (defined(invoker.configs)) {
configs += invoker.configs
}
}
} else {
# If not enabled, a phony empty target that swallows all otherwise unused variables.
source_set(target_name) {
skia_source_set(target_name) {
visibility = [ ":*" ]
check_includes = false
forward_variables_from(invoker,
"*",
@ -239,7 +243,6 @@ opts("skx") {
# Any feature of Skia that requires third-party code should be optional and use this template.
template("optional") {
visibility = [ ":*" ]
if (invoker.enabled) {
config(target_name + "_public") {
if (defined(invoker.public_defines)) {
@ -252,34 +255,44 @@ template("optional") {
include_dirs = invoker.public_include_dirs
}
}
source_set(target_name) {
skia_source_set(target_name) {
visibility = [ ":*" ]
check_includes = false
configs = skia_library_configs
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker,
"*",
[
"configs",
"public_defines",
"sources_for_tests",
"sources_when_disabled",
"configs_to_remove",
])
all_dependent_configs = [ ":" + target_name + "_public" ]
configs += skia_library_configs
if (defined(invoker.configs_to_remove)) {
configs -= invoker.configs_to_remove
if (defined(invoker.configs)) {
configs += invoker.configs
}
all_dependent_configs = [ ":" + target_name + "_public" ]
}
if (defined(invoker.sources_for_tests) && skia_enable_tools) {
source_set(target_name + "_tests") {
skia_source_set(target_name + "_tests") {
visibility = [ ":*" ]
check_includes = false
configs = skia_library_configs
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker,
"*",
[
"configs",
"public_defines",
"sources",
"sources_for_tests",
"sources_when_disabled",
"configs_to_remove",
])
if (defined(invoker.configs)) {
configs += invoker.configs
}
testonly = true
sources = invoker.sources_for_tests
if (!defined(deps)) {
@ -287,17 +300,18 @@ template("optional") {
}
deps += [ ":test" ]
all_dependent_configs = [ ":" + target_name + "_public" ]
configs += skia_library_configs
if (defined(invoker.configs_to_remove)) {
configs -= invoker.configs_to_remove
}
}
}
} else {
source_set(target_name) {
skia_source_set(target_name) {
visibility = [ ":*" ]
configs = skia_library_configs
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker,
"*",
[
"configs",
"public",
"public_defines",
"public_deps",
@ -307,15 +321,17 @@ template("optional") {
"sources",
"sources_for_tests",
"sources_when_disabled",
"configs_to_remove",
])
if (defined(invoker.configs)) {
configs += invoker.configs
}
if (defined(invoker.sources_when_disabled)) {
sources = invoker.sources_when_disabled
}
configs += skia_library_configs
}
if (defined(invoker.sources_for_tests)) {
source_set(target_name + "_tests") {
skia_source_set(target_name + "_tests") {
visibility = [ ":*" ]
}
}
}
@ -545,7 +561,7 @@ optional("fontmgr_win_gdi") {
}
if (skia_lex) {
executable("sksllex") {
skia_executable("sksllex") {
sources = [
"src/sksl/lex/Main.cpp",
"src/sksl/lex/NFA.cpp",
@ -586,7 +602,7 @@ if (skia_lex) {
# `Compile Processors` and `Compile SkSL Tests` both rely on skslc.
if (skia_compile_processors || skia_compile_sksl_tests) {
executable("skslc") {
skia_executable("skslc") {
defines = [
"SKSL_STANDALONE",
"SK_DISABLE_TRACING",
@ -1118,13 +1134,13 @@ optional("raw") {
# SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
# Skia.
configs_to_remove = [ "//gn:no_exceptions" ]
configs = [ "gn/portable:add_exceptions" ]
sources = [ "src/codec/SkRawCodec.cpp" ]
}
import("third_party/skcms/skcms.gni")
source_set("skcms") {
skia_source_set("skcms") {
cflags = []
if (!is_win || is_clang) {
cflags += [
@ -1219,9 +1235,9 @@ if (skia_enable_gpu && skia_generate_workarounds) {
}
}
component("skia") {
skia_component("skia") {
public_configs = [ ":skia_public" ]
configs += skia_library_configs
configs = skia_library_configs
public_deps = [
":fontmgr_FontConfigInterface",
@ -1527,8 +1543,8 @@ if (skia_enable_tools) {
]
# Used by gn_to_bp.py to list our public include dirs.
source_set("public") {
configs += [ ":skia_public" ]
skia_source_set("public") {
configs = [ ":skia_public" ]
include_dirs = skia_public_includes
}
@ -1548,7 +1564,7 @@ if (skia_enable_tools) {
}
if (target_cpu == "x64") {
executable("fiddle") {
skia_executable("fiddle") {
check_includes = false
libs = []
sources = [
@ -1584,13 +1600,15 @@ if (skia_enable_tools) {
}
}
source_set("public_headers_warnings_check") {
skia_source_set("public_headers_warnings_check") {
sources = [ "tools/public_headers_warnings_check.cpp" ]
configs -= [ "//gn:warnings_except_public_headers" ]
configs += [
configs = [
":our_vulkan_headers",
":cpp14",
]
if (defined(skia_header_target_default_configs)) {
configs += skia_header_target_default_configs
}
deps = [
":skia",
":skia.h",
@ -1609,7 +1627,7 @@ if (skia_enable_tools) {
defines = invoker.public_defines
}
}
source_set(target_name) {
skia_source_set(target_name) {
forward_variables_from(invoker, "*", [])
check_includes = false
public_configs = [
@ -1648,24 +1666,32 @@ if (skia_enable_tools) {
} else {
# !is_ios
output_dir = root_build_dir
if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
shared_library("lib" + target_name) {
skia_shared_library("lib" + target_name) {
output_dir = root_build_dir
forward_variables_from(invoker, "*", [ "is_shared_library" ])
if (!defined(configs)) {
configs = []
}
configs += [ ":skia_private" ]
testonly = true
}
} else {
_executable = target_name
executable(_executable) {
skia_executable(_executable) {
check_includes = false
output_dir = root_build_dir
forward_variables_from(invoker, "*", [ "is_shared_library" ])
if (!defined(configs)) {
configs = []
}
configs += [ ":skia_private" ]
testonly = true
}
}
if (is_android && skia_android_serial != "" && defined(_executable)) {
action("push_" + target_name) {
output_dir = root_build_dir
script = "gn/push_to_android.py"
deps = [ ":" + _executable ]
_stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
@ -2118,7 +2144,7 @@ if (skia_enable_tools) {
}
# optional separate library to dlopen when running CanvasStateTests.
shared_library("canvas_state_lib") {
skia_shared_library("canvas_state_lib") {
sources = [
"tests/CanvasStateHelpers.cpp",
"tests/CanvasStateHelpers.h",
@ -2359,12 +2385,9 @@ if (skia_enable_tools) {
}
if (!is_win) {
source_set("skqp_lib") {
source_set("skqp_lib") { # Not a skia_source_set
check_includes = false
testonly = true
if (!is_official_build) {
configs -= [ "//gn:warnings" ]
}
public_configs = [ ":skia_private" ]
defines =
[ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
@ -2403,11 +2426,8 @@ if (skia_enable_tools) {
}
}
if (is_android) {
shared_library("libskqp_app") {
shared_library("libskqp_app") { # Not a skia_shared_library
configs += [ ":skia_private" ]
if (!is_official_build) {
configs -= [ "//gn:warnings" ]
}
testonly = true
sources = [ "tools/skqp/src/jni_skqp.cpp" ]
deps = [
@ -2803,7 +2823,7 @@ if (skia_enable_tools) {
}
}
executable("cpu_modules") {
skia_executable("cpu_modules") {
sources = [ "tools/cpu_modules.cpp" ]
deps = [
":skia",
@ -2818,7 +2838,7 @@ if (skia_enable_tools) {
}
}
executable("image_diff_metric") {
skia_executable("image_diff_metric") {
sources = [ "tools/image_diff_metric.cpp" ]
deps = [ ":skia" ]
}
@ -2833,10 +2853,13 @@ if (skia_enable_tools) {
if (skia_build_fuzzers) {
template("libfuzzer_app") {
output_dir = root_build_dir
executable(target_name) {
skia_executable(target_name) {
output_dir = root_build_dir
check_includes = false
forward_variables_from(invoker, "*", [ "is_shared_library" ])
if (!defined(configs)) {
configs = []
}
configs += [ ":skia_private" ]
sources += [
"fuzz/Fuzz.cpp",
@ -3218,7 +3241,7 @@ if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
}
}
executable("skia_c_api_example") {
skia_executable("skia_c_api_example") {
sources = [ "experimental/c-api-example/skia-c-example.c" ]
include_dirs = [ "." ]
deps = [ ":skia" ]

View File

@ -172,29 +172,23 @@ template("component") {
# Default configs
default_configs = [
"//gn:default",
"//gn:no_exceptions",
"//gn:no_rtti",
"//gn/skia:default",
"//gn/skia:no_exceptions",
"//gn/skia:no_rtti",
]
if (!is_debug) {
default_configs += [
"//gn:optimize",
"//gn:NDEBUG",
"//gn/skia:optimize",
"//gn/skia:NDEBUG",
]
}
if (!is_official_build) {
default_configs += [
"//gn:debug_symbols",
"//gn:warnings",
]
default_configs += [ "//gn/skia:debug_symbols" ]
}
default_configs += [
"//gn:warnings_except_public_headers",
"//gn:extra_flags",
]
default_configs += [ "//gn/skia:extra_flags" ]
set_defaults("executable") {
configs = [ "//gn:executable" ] + default_configs
configs = [ "//gn/skia:executable" ] + default_configs
}
set_defaults("source_set") {
@ -216,6 +210,17 @@ set_defaults("component") {
}
}
skia_target_default_configs = []
if (!is_official_build) {
skia_target_default_configs += [ "//gn/skia:warnings" ]
}
skia_header_target_default_configs = []
if (!is_official_build) {
skia_header_target_default_configs +=
[ "//gn/skia:warnings_for_public_headers" ]
}
if (is_win) {
# Windows tool chain
set_default_toolchain("//gn/toolchain:msvc")

20
gn/portable/BUILD.gn Normal file
View File

@ -0,0 +1,20 @@
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
config("add_exceptions") {
if (is_win) {
cflags_cc = [ "/EHsc" ]
} else {
cflags_cc = [ "-fexceptions" ]
}
}
config("add_rtti") {
if (is_win) {
cflags_cc = [ "/GR" ]
} else {
cflags_cc = [ "-frtti" ]
}
}

View File

@ -145,3 +145,67 @@ declare_args() {
# Our tools require static linking (they use non-exported symbols), and the GPU backend.
skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
# Skia's targets may be built inside other gn build systems.
# Skia builds other project's build targets inside its build.
# This is easier if the built-in target types remain generic.
# Place Skia target specific configs in skia_target_default_configs.
# These will be applied by the 'skia_*' templates.
# In the Skia build these configs apply many warnings as errors.
# Other projects may optionally set these configs as they see fit.
template("skia_target") {
target(invoker._skia_target_type, target_name) {
# set_defaults(invoker._skia_target_type) might not exist or set configs
if (!defined(configs)) {
configs = []
}
# Explicit configs instead of set_defaults("skia_target")
# Allows template("skia_*") below to avoid the configs dance.
if (defined(skia_target_default_configs)) {
configs += skia_target_default_configs
}
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
}
}
template("skia_executable") {
skia_target(target_name) {
assert(!defined(configs), "No set_defaults(skia_target)")
_skia_target_type = "executable"
forward_variables_from(invoker, "*")
}
}
template("skia_source_set") {
skia_target(target_name) {
assert(!defined(configs), "No set_defaults(skia_target)")
_skia_target_type = "source_set"
forward_variables_from(invoker, "*")
}
}
template("skia_static_library") {
skia_target(target_name) {
assert(!defined(configs), "No set_defaults(skia_target)")
_skia_target_type = "static_library"
forward_variables_from(invoker, "*")
}
}
template("skia_shared_library") {
skia_target(target_name) {
assert(!defined(configs), "No set_defaults(skia_target)")
_skia_target_type = "shared_library"
forward_variables_from(invoker, "*")
}
}
template("skia_component") {
skia_target(target_name) {
assert(!defined(configs), "No set_defaults(skia_target)")
_skia_target_type = "component"
forward_variables_from(invoker, "*")
}
}

View File

@ -31,7 +31,8 @@ if (is_ios && xcode_sysroot == "") {
sdk = "iphonesimulator"
}
}
xcode_sysroot = exec_script("find_xcode_sysroot.py", [ sdk ], "trim string")
xcode_sysroot =
exec_script("../find_xcode_sysroot.py", [ sdk ], "trim string")
}
# If building for mac on a mac then lookup all the system includes so that goma and the clang
@ -40,7 +41,7 @@ if (is_ios && xcode_sysroot == "") {
# find needed include paths.
if (is_mac && host_os == "mac" && xcode_sysroot == "") {
xcode_sysroot =
exec_script("find_xcode_sysroot.py", [ "macosx" ], "trim string")
exec_script("../find_xcode_sysroot.py", [ "macosx" ], "trim string")
}
config("default") {
@ -52,14 +53,6 @@ config("default") {
ldflags = []
libs = []
if (werror) {
if (is_win) {
cflags += [ "/WX" ]
} else {
cflags += [ "-Werror" ]
}
}
# Disable warnings about unknown attributes.
# (These unknown attribute warnings are on by default, so we don't make
# disabling them part of :warnings, as some targets remove :warnings.)
@ -293,7 +286,7 @@ config("default") {
sanitizers = "memory"
}
_suppressions = rebase_path("../tools/xsan.supp")
_suppressions = rebase_path("../../tools/xsan.supp")
cflags += [
"-fsanitize=$sanitizers",
@ -351,6 +344,15 @@ config("warnings") {
cflags_cc = []
cflags_objc = []
cflags_objcc = []
if (werror) {
if (is_win) {
cflags += [ "/WX" ]
} else {
cflags += [ "-Werror" ]
}
}
if (is_win) {
cflags += [
"/W3", # Turn on lots of warnings.
@ -380,6 +382,11 @@ config("warnings") {
# deprecated in C++17. They are superseded by std::invoke_result and std::invoke_result_t.
"/wd4996",
]
if (is_clang) {
cflags += [
"-Wno-unused-parameter", # Re-enabled for header sources
]
}
} else {
cflags += [
"-Wall",
@ -392,6 +399,7 @@ config("warnings") {
"-Wno-deprecated-declarations",
"-Wno-maybe-uninitialized",
"-Wno-psabi",
"-Wno-unused-parameter", # Re-enabled for header sources
]
cflags_cc += [
"-Wnon-virtual-dtor",
@ -430,7 +438,7 @@ config("warnings") {
cflags += [
"-Wno-cast-align",
"-Wno-cast-qual",
"-Wno-conversion",
"-Wno-conversion", # -Wsign-conversion re-enabled for header sources
"-Wno-disabled-macro-expansion",
"-Wno-documentation",
"-Wno-documentation-unknown-command",
@ -463,10 +471,6 @@ config("warnings") {
"-Wno-weak-vtables",
]
# Turn back on after -Wno-conversion.
# This only affects public headers... see :warnings_except_public_headers.
cflags += [ "-Wsign-conversion" ]
# We are unlikely to want to fix these.
cflags += [
"-Wno-covered-switch-default",
@ -527,11 +531,11 @@ config("warnings") {
]
}
}
config("warnings_except_public_headers") {
if (!is_win || is_clang) {
config("warnings_for_public_headers") {
if (is_clang) {
cflags = [
"-Wno-sign-conversion",
"-Wno-unused-parameter",
"-Wsign-conversion",
"-Wunused-parameter",
]
}
}

View File

@ -11,13 +11,13 @@ if (skia_enable_skottie) {
include_dirs = [ "include" ]
}
component("skottie") {
skia_component("skottie") {
check_includes = false
import("skottie.gni")
public_configs = [ ":public_config" ]
public = skia_skottie_public
sources = skia_skottie_sources
configs += [ "../../:skia_private" ]
configs = [ "../../:skia_private" ]
deps = [
"../..:skia",
"../skresources",
@ -30,12 +30,12 @@ if (skia_enable_skottie) {
config("utils_config") {
include_dirs = [ "utils" ]
}
source_set("utils") {
skia_source_set("utils") {
check_includes = false
testonly = true
public_configs = [ ":utils_config" ]
configs += [ "../../:skia_private" ]
configs = [ "../../:skia_private" ]
sources = [ "utils/SkottieUtils.cpp" ]
deps = [
@ -45,10 +45,10 @@ if (skia_enable_skottie) {
}
if (skia_enable_tools) {
source_set("tests") {
skia_source_set("tests") {
testonly = true
configs += [
configs = [
"../..:skia_private",
"../..:tests_config",
]
@ -68,11 +68,11 @@ if (skia_enable_skottie) {
]
}
source_set("fuzz") {
skia_source_set("fuzz") {
check_includes = false
testonly = true
configs += [ "../..:skia_private" ]
configs = [ "../..:skia_private" ]
include_dirs = [
"../../tools",
"../../tools/flags",
@ -94,11 +94,11 @@ if (skia_enable_skottie) {
public_deps = [ ":skottie" ]
}
source_set("tool") {
skia_source_set("tool") {
check_includes = false
testonly = true
configs += [ "../..:skia_private" ]
configs = [ "../..:skia_private" ]
sources = [ "src/SkottieTool.cpp" ]
deps = [
@ -113,14 +113,14 @@ if (skia_enable_skottie) {
]
}
source_set("gm") {
skia_source_set("gm") {
check_includes = false
testonly = true
# would be nice to have a gm_config
include_dirs = [ "../../gm" ]
configs += [ "../..:skia_private" ]
configs = [ "../..:skia_private" ]
sources = [
"gm/ExternalProperties.cpp",
"gm/SkottieGM.cpp",

View File

@ -19,7 +19,7 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_use_icu &&
]
}
component("skparagraph") {
skia_component("skparagraph") {
import("skparagraph.gni")
public_configs = [ ":public_config" ]
public = skparagraph_public
@ -35,10 +35,10 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_use_icu &&
}
if (defined(is_skia_standalone) && skia_enable_tools) {
source_set("utils") {
skia_source_set("utils") {
import("skparagraph.gni")
public_configs = [ ":utils_config" ]
configs += [ "../../:skia_private" ]
configs = [ "../../:skia_private" ]
sources = skparagraph_utils
deps = [
"../..:skia",
@ -46,7 +46,7 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_use_icu &&
]
}
source_set("gm") {
skia_source_set("gm") {
if (paragraph_gms_enabled) {
testonly = true
sources = [ "gm/simple_gm.cpp" ]
@ -61,7 +61,7 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_use_icu &&
}
}
source_set("tests") {
skia_source_set("tests") {
if (paragraph_tests_enabled) {
testonly = true
sources = [ "tests/SkParagraphTest.cpp" ]
@ -76,7 +76,7 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_use_icu &&
}
}
source_set("bench") {
skia_source_set("bench") {
if (paragraph_bench_enabled) {
testonly = true
sources = [ "bench/ParagraphBench.cpp" ]
@ -90,7 +90,7 @@ if (skia_enable_skparagraph && skia_enable_skshaper && skia_use_icu &&
}
}
source_set("samples") {
skia_source_set("samples") {
testonly = true
sources = [ "samples/SampleParagraph.cpp" ]
deps = [

View File

@ -5,7 +5,7 @@
import("../../gn/skia.gni")
if (skia_use_icu && skia_use_harfbuzz) {
source_set("editor_lib") {
skia_source_set("editor_lib") {
include_dirs = [ "../.." ]
public = [
"include/editor.h",
@ -20,7 +20,7 @@ if (skia_use_icu && skia_use_harfbuzz) {
deps = [ ":shape" ]
}
source_set("shape") {
skia_source_set("shape") {
include_dirs = [ "../.." ]
public = [ "src/shape.h" ]
sources = [ "src/shape.cpp" ]
@ -31,15 +31,15 @@ if (skia_use_icu && skia_use_harfbuzz) {
]
}
source_set("word_boundaries") {
skia_source_set("word_boundaries") {
include_dirs = [ "../.." ]
public = [ "src/word_boundaries.h" ]
sources = [ "src/word_boundaries.cpp" ]
configs += [ "../../third_party/icu/config:no_cxx" ]
configs = [ "../../third_party/icu/config:no_cxx" ]
deps = [ "//third_party/icu" ]
}
source_set("editor_app") {
skia_source_set("editor_app") {
testonly = true
sources = [ "app/editor_application.cpp" ]
public_deps = [ "../..:sk_app" ]

View File

@ -9,20 +9,20 @@ config("public_config") {
include_dirs = [ "include" ]
}
component("sksg") {
skia_component("sksg") {
check_includes = false
import("sksg.gni")
public_configs = [ ":public_config" ]
sources = skia_sksg_sources
configs += [ "../../:skia_private" ]
configs = [ "../../:skia_private" ]
deps = [ "../..:skia" ]
}
if (defined(is_skia_standalone) && skia_enable_tools) {
source_set("tests") {
skia_source_set("tests") {
testonly = true
configs += [ "../..:skia_private" ]
configs = [ "../..:skia_private" ]
sources = [ "tests/SGTest.cpp" ]
deps = [
":sksg",
@ -31,11 +31,11 @@ if (defined(is_skia_standalone) && skia_enable_tools) {
]
}
source_set("samples") {
skia_source_set("samples") {
if (target_cpu != "wasm") { # TODO: clean up wasm test
testonly = true
configs += [
configs = [
"../..:skia_private",
"../..:samples_config", # TODO: refactor to make this nicer
]

View File

@ -11,13 +11,13 @@ if (skia_enable_svg) {
include_dirs = [ "include" ]
}
component("svg") {
skia_component("svg") {
check_includes = false
import("svg.gni")
public_configs = [ ":public_config" ]
public = skia_svg_public
sources = skia_svg_sources
configs += [ "../../:skia_private" ]
configs = [ "../../:skia_private" ]
deps = [
"../..:skia",
"../skresources",
@ -27,11 +27,11 @@ if (skia_enable_svg) {
if (skia_enable_tools) {
if (defined(is_skia_standalone)) {
source_set("tool") {
skia_source_set("tool") {
check_includes = false
testonly = true
configs += [ "../..:skia_private" ]
configs = [ "../..:skia_private" ]
sources = [ "utils/SvgTool.cpp" ]
deps = [
@ -43,10 +43,10 @@ if (skia_enable_svg) {
}
}
source_set("tests") {
skia_source_set("tests") {
testonly = true
configs += [ "../..:skia_private" ]
configs = [ "../..:skia_private" ]
sources = [ "tests/Text.cpp" ]
deps = [

View File

@ -12,9 +12,9 @@ import("../third_party.gni")
third_party("dng_sdk") {
public_include_dirs = [ "../externals/dng_sdk/source" ]
configs -= [
"//gn:no_exceptions",
"//gn:no_rtti",
configs = [
"//gn/portable:add_exceptions",
"//gn/portable:add_rtti",
]
public_defines = [ "qDNGBigEndian=0" ]

View File

@ -71,7 +71,7 @@ if (skia_use_system_icu) {
"U_DISABLE_RENAMING",
"SK_USING_THIRD_PARTY_ICU",
]
configs -= [ "//gn:no_rtti" ]
configs = [ "//gn/portable:add_rtti" ]
defines = [
# http://userguide.icu-project.org/howtouseicu
"U_COMMON_IMPLEMENTATION",

View File

@ -33,7 +33,7 @@ if (skia_use_system_libwebp) {
"../externals/libwebp/src",
"../externals/libwebp",
]
configs += [ ":libwebp_defines" ]
configs = [ ":libwebp_defines" ]
sources = [
"../externals/libwebp/src/dsp/alpha_processing_sse41.c",
"../externals/libwebp/src/dsp/dec_sse41.c",
@ -59,7 +59,7 @@ if (skia_use_system_libwebp) {
deps += [ "//third_party/cpu-features" ]
}
configs += [ ":libwebp_defines" ]
configs = [ ":libwebp_defines" ]
sources = [
"../externals/libwebp/src/dec/alpha_dec.c",
"../externals/libwebp/src/dec/buffer_dec.c",

View File

@ -11,7 +11,7 @@ config("oboe_lib") {
}
third_party("oboe") {
configs += [ ":oboe_lib" ]
configs = [ ":oboe_lib" ]
public_include_dirs = [
"../externals/oboe/include",

View File

@ -67,7 +67,27 @@ template("third_party") {
target(_mode, target_name) {
if (enabled) {
forward_variables_from(invoker, "*", [ "public_include_dirs" ])
# set_defaults(_mode) might not exist or set configs
if (!defined(configs)) {
configs = []
}
if (is_debug) {
configs += [ "//gn/skia:optimize" ]
}
if (sanitize == "ASAN") {
configs += [ "//gn/skia:recover_pointer_overflow" ]
}
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker,
"*",
[
"public_include_dirs",
"configs",
])
if (defined(invoker.configs)) {
configs += invoker.configs
}
public_configs = [ ":" + target_name + "_public" ]
# Warnings are just noise if we're not maintaining the code.
@ -80,22 +100,6 @@ template("third_party") {
}
}
set_defaults("third_party") {
configs = default_configs
if (!is_official_build) {
# Official builds don't have warnings to begin with.
configs -= [ "//gn:warnings" ]
}
if (is_debug) {
configs += [ "//gn:optimize" ]
}
if (sanitize == "ASAN") {
configs += [ "//gn:recover_pointer_overflow" ]
}
}
template("system") {
config(target_name + "_public") {
forward_variables_from(invoker, "*", [])

View File

@ -155,6 +155,7 @@ if (skia_use_system_zlib) {
public_include_dirs = [ "../externals/zlib" ]
defines = [ "ZLIB_IMPLEMENTATION" ]
deps = []
configs = []
sources = [
"../externals/zlib/adler32.c",