]> git.tdb.fi Git - builder.git/commitdiff
Collect libpath for static library dependencies from the libs themselves
authorMikko Rasa <tdb@tdb.fi>
Sun, 5 Oct 2014 23:41:14 +0000 (02:41 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 5 Oct 2014 23:46:40 +0000 (02:46 +0300)
Also fixes Binary::find_dependencies which broke in 3f0f721.

source/binary.cpp
source/binary.h
source/component.cpp

index 079ae84995843d669f632789030e4bbb24bde69d..f3654f42f906767d2a41464117f3e2a52ceccb9b 100644 (file)
@@ -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<const Component *> queue;
+       list<Target *> queue;
        list<Target *> dep_libs;
        set<string> 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<StaticLibrary *>(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);
index 7581541bd3d9d1a726e273460ecbbd02d56e47fd..d763dd572f97b084a9f9c7aa0b5bd831eaa632ac 100644 (file)
@@ -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<ObjectFile *> objects;
 
index c2f4386a917b28a242868b53071b3084e3d00646..4e7f547f36f7d05b9212a09f957907e1c79c75a8 100644 (file)
@@ -90,15 +90,6 @@ void Component::create_build_info()
        if(type==LIBRARY || type==MODULE)
                if(build_info.libmode<BuildInfo::DYNAMIC)
                        build_info.libmode = BuildInfo::DYNAMIC;
-
-       if(build_info.libmode<BuildInfo::DYNAMIC)
-       {
-               for(Package::Requirements::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i)
-               {
-                       const BuildInfo &ebi = (*i)->get_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