X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinary.cpp;h=fcf30f1d1fca03170f868ac7423ced7d37605683;hb=HEAD;hp=df0daaff72c51dc46a3a1607f940482e966a871f;hpb=8575b50479945c3ad6ab0e4ea7eb116da5b5f04d;p=builder.git diff --git a/source/binary.cpp b/source/binary.cpp deleted file mode 100644 index df0daaf..0000000 --- a/source/binary.cpp +++ /dev/null @@ -1,81 +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()) - { - const Component *c = queue.front(); - queue.erase(queue.begin()); - - const BuildInfo &binfo = c->get_build_info(); - 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); - } -}