X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinary.cpp;h=fcf30f1d1fca03170f868ac7423ced7d37605683;hb=HEAD;hp=6efe77a6475b5ce74fc18d9c2435910b3734f5a8;hpb=3f0f7216789aeedba206308c452623351e406e75;p=builder.git diff --git a/source/binary.cpp b/source/binary.cpp deleted file mode 100644 index 6efe77a..0000000 --- a/source/binary.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include "binary.h" -#include "builder.h" -#include "component.h" -#include "objectfile.h" -#include "sharedlibrary.h" -#include "sourcepackage.h" -#include "staticlibrary.h" -#include "tool.h" - -using namespace std; -using namespace Msp; - -Binary::Binary(Builder &b, const FS::Path &p): - FileTarget(b, p) -{ } - -Binary::Binary(Builder &b, const Component &c, const string &p, const list &objs): - FileTarget(b, c.get_package(), c.get_package().get_output_directory()/p), - objects(objs) -{ - component = &c; - for(list::const_iterator i=objects.begin(); i!=objects.end(); ++i) - add_dependency(**i); - - nested_build_sig = true; - arch_in_build_sig = true; -} - -void Binary::find_dependencies() -{ - if(!component) - return; - - list queue; - list dep_libs; - set missing_libs; - queue.push_back(component); - while(!queue.empty()) - { - queue.erase(queue.begin()); - - BuildInfo binfo; - collect_build_info(binfo); - - 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")) - continue; - - BuildInfo::LibraryMode libmode = component->get_build_info().get_libmode_for(*i); - Target *lib = builder.get_vfs().find_library(*i, binfo.libpath, libmode); - if(lib) - { - 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()); - } - else - dep_libs.push_back(lib); - } - else if(missing_libs.insert(*i).second) - problems.push_back(format("Required library %s not found", *i)); - } - } - - /* 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) - { - bool last = true; - for(list::iterator j=i; (last && j!=dep_libs.end()); ++j) - last = (j==i || *j!=*i); - if(last) - add_dependency(**i); - } -}