From: Mikko Rasa Date: Sun, 5 Oct 2014 23:41:14 +0000 (+0300) Subject: Collect libpath for static library dependencies from the libs themselves X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=45571f0fffaf483d07d92f56ae20f00218b7463c;p=builder.git Collect libpath for static library dependencies from the libs themselves Also fixes Binary::find_dependencies which broke in 3f0f721. --- diff --git a/source/binary.cpp b/source/binary.cpp index 079ae84..f3654f4 100644 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -36,6 +36,8 @@ void Binary::collect_build_info(BuildInfo &binfo) const binfo.update_from(obj_tool->get_build_info()); Target::collect_build_info(binfo); + + binfo.update_from(static_binfo); } void Binary::find_dependencies() @@ -43,16 +45,19 @@ void Binary::find_dependencies() if(!component) return; - list queue; + list queue; list dep_libs; set missing_libs; - queue.push_back(component); + queue.push_back(this); while(!queue.empty()) { - queue.erase(queue.begin()); + Target *tgt = queue.front(); + queue.pop_front(); BuildInfo binfo; - collect_build_info(binfo); + tgt->collect_build_info(binfo); + if(tgt!=this) + static_binfo.libpath.insert(static_binfo.libpath.end(), binfo.libpath.begin(), binfo.libpath.end()); for(BuildInfo::WordList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i) { @@ -67,8 +72,7 @@ void Binary::find_dependencies() if(StaticLibrary *stlib = dynamic_cast(real)) { dep_libs.push_back(stlib); - if(stlib->get_component()) - queue.push_back(stlib->get_component()); + queue.push_back(stlib); } else dep_libs.push_back(lib); diff --git a/source/binary.h b/source/binary.h index 7581541..d763dd5 100644 --- a/source/binary.h +++ b/source/binary.h @@ -1,6 +1,7 @@ #ifndef BINARY_H_ #define BINARY_H_ +#include "buildinfo.h" #include "filetarget.h" class Component; @@ -12,6 +13,9 @@ library. */ class Binary: public FileTarget { +private: + BuildInfo static_binfo; + protected: std::list objects; diff --git a/source/component.cpp b/source/component.cpp index c2f4386..4e7f547 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -90,15 +90,6 @@ void Component::create_build_info() if(type==LIBRARY || type==MODULE) if(build_info.libmodeget_exported_build_info(); - build_info.libpath.insert(build_info.libpath.end(), ebi.libpath.begin(), ebi.libpath.end()); - } - } } BuildInfo Component::get_build_info_for_path(const FS::Path &path) const