Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: tools/gn/config_values.cc

Issue 1342183003: Allow GN configs to have sub-configs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/config_values.h ('k') | tools/gn/config_values_extractors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/config_values.cc
diff --git a/tools/gn/config_values.cc b/tools/gn/config_values.cc
index 53466dfd79180b8c211b9d9202a1db73b9166f36..d87ed84b80aa04d3aab2637de57f112f6a5b760a 100644
--- a/tools/gn/config_values.cc
+++ b/tools/gn/config_values.cc
@@ -4,8 +4,42 @@
#include "tools/gn/config_values.h"
+namespace {
+
+template<typename T>
+void VectorAppend(std::vector<T>* append_to,
+ const std::vector<T>& append_this) {
+ if (append_this.empty())
+ return;
+ append_to->insert(append_to->end(),append_this.begin(), append_this.end());
+}
+
+} // namespace
+
ConfigValues::ConfigValues() {
}
ConfigValues::~ConfigValues() {
}
+
+void ConfigValues::AppendValues(const ConfigValues& append) {
+ VectorAppend(&cflags_, append.cflags_);
+ VectorAppend(&cflags_c_, append.cflags_c_);
+ VectorAppend(&cflags_cc_, append.cflags_cc_);
+ VectorAppend(&cflags_objc_, append.cflags_objc_);
+ VectorAppend(&cflags_objcc_, append.cflags_objcc_);
+ VectorAppend(&defines_, append.defines_);
+ VectorAppend(&include_dirs_, append.include_dirs_);
+ VectorAppend(&ldflags_, append.ldflags_);
+ VectorAppend(&lib_dirs_, append.lib_dirs_);
+ VectorAppend(&libs_, append.libs_);
+
+ // Only append precompiled header if there isn't one. It might be nice to
+ // throw an error if there are conflicting precompiled headers, but that
+ // requires piping through some context of the actual configs involved, and
+ // conflicts here should be very unusual. Instead, use the first value.
+ if (!append.precompiled_header_.empty() && !precompiled_header_.empty())
+ precompiled_header_ = append.precompiled_header_;
+ if (!append.precompiled_source_.is_null() && !precompiled_source_.is_null())
+ precompiled_source_ = append.precompiled_source_;
+}
« no previous file with comments | « tools/gn/config_values.h ('k') | tools/gn/config_values_extractors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698