From dcaf06c2bba4e02a312cd6af24ddc96410e7be4e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 27 Apr 2012 21:03:11 +0300 Subject: [PATCH] Make BuildInfo able to handle chained dependencies --- source/buildinfo.cpp | 11 +++++++---- source/buildinfo.h | 9 ++++++++- source/component.cpp | 11 +++-------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/source/buildinfo.cpp b/source/buildinfo.cpp index e9dcec0..61e3162 100644 --- a/source/buildinfo.cpp +++ b/source/buildinfo.cpp @@ -23,14 +23,17 @@ void unique(StringList &l) } -void BuildInfo::update_from(const BuildInfo &bi) +void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level) { cflags.insert(cflags.end(), bi.cflags.begin(), bi.cflags.end()); defines.insert(defines.end(), bi.defines.begin(), bi.defines.end()); incpath.insert(incpath.end(), bi.incpath.begin(), bi.incpath.end()); - ldflags.insert(ldflags.end(), bi.ldflags.begin(), bi.ldflags.end()); - libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end()); - libs.insert(libs.end(), bi.libs.begin(), bi.libs.end()); + if(level!=CHAINED) + { + ldflags.insert(ldflags.end(), bi.ldflags.begin(), bi.ldflags.end()); + libpath.insert(libpath.end(), bi.libpath.begin(), bi.libpath.end()); + libs.insert(libs.end(), bi.libs.begin(), bi.libs.end()); + } warnings.insert(warnings.end(), bi.warnings.begin(), bi.warnings.end()); } diff --git a/source/buildinfo.h b/source/buildinfo.h index 0d7b64a..c7c89ac 100644 --- a/source/buildinfo.h +++ b/source/buildinfo.h @@ -27,6 +27,13 @@ public: void warning(const std::string &); }; + enum UpdateLevel + { + LOCAL, + DEPENDENCY, + CHAINED + }; + StringList cflags; StringList defines; StringList incpath; @@ -36,7 +43,7 @@ public: StringList warnings; /** Adds another BuildInfo to the end of this one. */ - void update_from(const BuildInfo &); + void update_from(const BuildInfo &, UpdateLevel = LOCAL); /** Makes sure there are no duplicate entries in the lists. For warnings, contradicting flags are eliminated and the last one stays in effect. */ diff --git a/source/component.cpp b/source/component.cpp index bb1efe4..7db9880 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -48,15 +48,10 @@ void Component::create_build_info() PackageList all_reqs = direct_reqs; for(PackageList::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i) { + BuildInfo::UpdateLevel level = BuildInfo::CHAINED; if(find(direct_reqs.begin(), direct_reqs.end(), *i)!=direct_reqs.end()) - build_info.update_from((*i)->get_exported_binfo()); - else - { - const BuildInfo &ebi = (*i)->get_exported_binfo(); - build_info.cflags.insert(build_info.cflags.end(), ebi.cflags.begin(), ebi.cflags.end()); - build_info.incpath.insert(build_info.incpath.end(), ebi.incpath.begin(), ebi.incpath.end()); - build_info.defines.insert(build_info.defines.end(), ebi.defines.begin(), ebi.defines.end()); - } + level = BuildInfo::DEPENDENCY; + build_info.update_from((*i)->get_exported_binfo(), level); const PackageList &reqs = (*i)->get_requires(); for(PackageList::const_iterator j=reqs.begin(); j!=reqs.end(); ++j) -- 2.45.2