X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinary.cpp;h=fcf30f1d1fca03170f868ac7423ced7d37605683;hb=42d80b43a463627e0e7edf6df3be9bd4b976d74c;hp=079ae84995843d669f632789030e4bbb24bde69d;hpb=c51411c4b3ed4e6a0d8343b848db3dc736bc7857;p=builder.git diff --git a/source/binary.cpp b/source/binary.cpp index 079ae84..fcf30f1 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,17 +45,26 @@ 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()); + if(binfo.threads) + static_binfo.threads = true; + } + 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")) @@ -65,11 +76,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); } @@ -78,6 +85,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)