X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinary.cpp;h=448292cf051a5899412ba89329888053312276cc;hb=8f8f10fe41bbb68866e8fb05f8cbab0b325dc7da;hp=6efe77a6475b5ce74fc18d9c2435910b3734f5a8;hpb=3f0f7216789aeedba206308c452623351e406e75;p=builder.git diff --git a/source/binary.cpp b/source/binary.cpp index 6efe77a..448292c 100644 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -29,22 +29,40 @@ Binary::Binary(Builder &b, const Component &c, const string &p, const list::const_iterator i=objects.begin(); i!=objects.end(); ++i) + if(const Tool *obj_tool = (*i)->get_tool()) + binfo.update_from(obj_tool->get_build_info()); + + Target::collect_build_info(binfo); + + binfo.update_from(static_binfo); +} + void Binary::find_dependencies() { if(!component) return; - list queue; + list queue; list dep_libs; set missing_libs; - queue.push_back(component); - while(!queue.empty()) + queue.push_back(this); + for(list::iterator j=queue.begin(); j!=queue.end(); ++j) { - queue.erase(queue.begin()); + Target *tgt = *j; 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()); + static_binfo.keep_symbols.insert(static_binfo.keep_symbols.end(), binfo.keep_symbols.begin(), binfo.keep_symbols.end()); + } + list::iterator insert_pos = j; + ++insert_pos; for(BuildInfo::WordList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i) { if(i->size()>10 && !i->compare(i->size()-10, 10, ".framework")) @@ -56,11 +74,7 @@ void Binary::find_dependencies() { Target *real = lib->get_real_target(); if(StaticLibrary *stlib = dynamic_cast(real)) - { - dep_libs.push_back(stlib); - if(stlib->get_component()) - queue.push_back(stlib->get_component()); - } + queue.insert(insert_pos, stlib); else dep_libs.push_back(lib); } @@ -69,6 +83,9 @@ void Binary::find_dependencies() } } + queue.pop_front(); + dep_libs.splice(dep_libs.begin(), queue); + /* Add only the last occurrence of each library to the actual dependencies. This ensures that static library ordering is correct. */ for(list::iterator i=dep_libs.begin(); i!=dep_libs.end(); ++i)