X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcomponent.cpp;h=68c9b1800097ad6ef014ae5b5a86122e52d392cf;hb=894c4bd9d58df50c38c7a656cf085c48581439ef;hp=6bfce1fb6b8682f19c775552812b26af9da1b451;hpb=fcb86bba9e8ea7e3c93f7f1748c0291b307c46ed;p=builder.git diff --git a/source/component.cpp b/source/component.cpp index 6bfce1f..68c9b18 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -79,6 +79,12 @@ 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()); + if(!(*i)->get_install()) + { + build_info.libmodes[(*i)->get_name()] = BuildInfo::STATIC; + build_info.libpath.push_back((*i)->get_package().get_source_directory()); + } } if(type==LIBRARY || type==MODULE) @@ -101,7 +107,6 @@ void Component::create_targets() const const Toolchain &toolchain = builder.get_toolchain(); SourceList source_filenames = collect_source_files(); - list inst_list; string inst_loc; if(type==TARBALL) @@ -138,7 +143,8 @@ void Component::create_targets() const } else if(type==INSTALL) { - inst_loc = name; + Target *inst = builder.get_target("install"); + const Tool © = toolchain.get_tool("CP"); for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i) { FileTarget *ft; @@ -146,7 +152,7 @@ void Component::create_targets() const ft = dynamic_cast(tgt); else ft = new File(builder, package, *i); - inst_list.push_back(ft); + inst->add_dependency(*copy.create_target(*ft, name)); } } else if(type==DATAFILE) @@ -162,7 +168,7 @@ void Component::create_targets() const builder.add_primary_target(*result); if(install) - inst_list.push_back(result); + builder.add_installed_target(*result); } if(type==PROGRAM || type==LIBRARY || type==MODULE) @@ -185,7 +191,7 @@ void Component::create_targets() const } if(type==LIBRARY && install && dynamic_cast(src)->is_installable()) - inst_list.push_back(src); + builder.add_installed_target(*src); } } @@ -203,39 +209,13 @@ 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(*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::const_iterator i=results.begin(); i!=results.end(); ++i) { builder.add_primary_target(**i); if(install) - inst_list.push_back(*i); + builder.add_installed_target(**i); } } - - Target *inst_tgt = builder.get_target("install"); - const Tool © = toolchain.get_tool("CP"); - for(list::const_iterator i=inst_list.begin(); i!=inst_list.end(); ++i) - { - Target *inst = copy.create_target(**i, inst_loc); - inst_tgt->add_dependency(*inst); - } } Component::SourceList Component::collect_source_files() const