]> git.tdb.fi Git - builder.git/commitdiff
Refactor Binary::find_depends
authorMikko Rasa <tdb@tdb.fi>
Sun, 15 Jul 2012 17:29:35 +0000 (20:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 15 Jul 2012 17:32:08 +0000 (20:32 +0300)
source/binary.cpp
source/component.cpp

index ed7316950f00b84dabae08845bdeb758bd03fd03..0dcb62f01a057dfc66085f3524ccf5553d586cc5 100644 (file)
@@ -28,10 +28,7 @@ void Binary::find_depends()
        if(!component)
                return;
 
-       const SourcePackage &spkg = component->get_package();
        BuildInfo::LibraryMode libmode = component->get_build_info().libmode;
-       if(dynamic_cast<SharedLibrary *>(this) && libmode<BuildInfo::DYNAMIC)
-               libmode = BuildInfo::DYNAMIC;
 
        list<const Component *> queue;
        list<Target *> dep_libs;
@@ -41,12 +38,10 @@ void Binary::find_depends()
                const Component *c = queue.front();
                queue.erase(queue.begin());
 
-               const BuildInfo::PathList &libpath = c->get_build_info().libpath;
-
-               const BuildInfo::WordList &libs = c->get_build_info().libs;
-               for(BuildInfo::WordList::const_iterator i=libs.begin(); i!=libs.end(); ++i)
+               const BuildInfo &binfo = c->get_build_info();
+               for(BuildInfo::WordList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i)
                {
-                       Target *lib = builder.get_vfs().find_library(*i, libpath, libmode);
+                       Target *lib = builder.get_vfs().find_library(*i, binfo.libpath, libmode);
                        if(lib)
                        {
                                dep_libs.push_back(lib);
@@ -57,7 +52,7 @@ void Binary::find_depends()
                                                queue.push_back(stlib->get_component());
                        }
                        else
-                               builder.problem(spkg.get_name(), format("Couldn't find library %s for %s", *i, name));
+                               builder.problem(package->get_name(), format("Couldn't find library %s for %s", *i, name));
                }
        }
 
index 72cdf7833facb134303aa90a2e25352e8b8dc7f5..9262af3320c97245318351acf01fbdf177285fe5 100644 (file)
@@ -66,6 +66,10 @@ void Component::create_build_info()
        for(BuildInfo::PathList::iterator i=build_info.libpath.begin(); i!=build_info.libpath.end(); ++i)
                *i = (pkg.get_source() / *i).str();
 
+       if(type==LIBRARY || type==MODULE)
+               if(build_info.libmode<BuildInfo::DYNAMIC)
+                       build_info.libmode = BuildInfo::DYNAMIC;
+
        if(build_info.libmode<BuildInfo::DYNAMIC)
        {
                for(PackageList::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i)