GN: refactor third_party/gni
This fixes the build on Linux (dep on third_party:zlib -> third_party/zlib).
I've moved declare_args() {} back to each .gn file... seems like args want
to be as local as possible in GN land.
Additionally, refactor all the common third_party config and warning flag
changes into a template, third_party. This lets it all live together in a
.gni: at head unwanted_configs can be in a .gni (it's just a variable) but
config("no_warnings") (and thus third_party_configs) cannot, as configs
cannot be part of .gni files.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2163653002
Review-Url: https://codereview.chromium.org/2163653002
diff --git a/third_party/third_party.gni b/third_party/third_party.gni
index 813ee38..ede698c 100644
--- a/third_party/third_party.gni
+++ b/third_party/third_party.gni
@@ -3,13 +3,19 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-declare_args() {
-}
+template("third_party") {
+ source_set(target_name) {
+ forward_variables_from(invoker, "*")
-# Chrome's GN environment sets up a bunch of default configs we don't need/want here.
-unwanted_configs = [
- "//build/config/clang:extra_warnings",
- "//build/config/clang:find_bad_constructs",
- "//build/config/compiler:chromium_code",
- "//build/config:feature_flags",
-]
+ # Warnings are just noise if we're not maintaining the code.
+ cflags = [ "-w" ]
+
+ # Chrome's GN environment sets up a bunch of default configs we don't need/want here.
+ configs -= [
+ "//build/config/clang:extra_warnings",
+ "//build/config/clang:find_bad_constructs",
+ "//build/config/compiler:chromium_code",
+ "//build/config:feature_flags",
+ ]
+ }
+}