]> git.tdb.fi Git - builder.git/commitdiff
Handle "use"d libraries through build info
authorMikko Rasa <tdb@tdb.fi>
Thu, 17 Jan 2013 09:01:15 +0000 (11:01 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 17 Jan 2013 09:01:15 +0000 (11:01 +0200)
source/component.cpp

index db78917c70fdf63fe1aef7fb95fa599629ca34f9..9ffbbf398feb11d7ec5c6f83c54ff9c046a69c30 100644 (file)
@@ -79,6 +79,8 @@ void Component::create_build_info()
                for(SourceList::const_iterator j=use_sources.begin(); j!=use_sources.end(); ++j)
                        base = FS::common_ancestor(base, *j);
                build_info.incpath.push_back(base);
+               build_info.libs.push_back((*i)->get_name());
+               build_info.libmodes[(*i)->get_name()] = BuildInfo::STATIC;
        }
 
        if(type==LIBRARY || type==MODULE)
@@ -203,24 +205,6 @@ void Component::create_targets() const
                else
                        results.push_back(linker.create_target(objs));
 
-               const Target::Dependencies &world_deps = builder.get_target("world")->get_dependencies();
-               for(UseList::const_iterator i=uses.begin(); i!=uses.end(); ++i)
-               {
-                       /* The world target depends on all primary targets; look for the
-                       static library belonging to the component.  This is a bit roundabout
-                       way but gets the job done. */
-                       bool found = false;
-                       for(Target::Dependencies::const_iterator j=world_deps.begin(); j!=world_deps.end(); ++j)
-                               if((*j)->get_component()==*i && dynamic_cast<StaticLibrary *>(*j))
-                               {
-                                       results.front()->add_dependency(**j);
-                                       found = true;
-                                       break;
-                               }
-                       if(!found)
-                               builder.problem(package.get_name(), format("Can't find static library %s for component %s", (*i)->get_name(), name));
-               }
-
                for(list<Target *>::const_iterator i=results.begin(); i!=results.end(); ++i)
                {
                        builder.add_primary_target(**i);