X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flib%2Fbinarycomponent.cpp;h=408ea464d9ef5a01dad5f1dfdb03b7d7a88c7fac;hb=b4781796aa997368f46b87b73a907bcab955ca3d;hp=d29673a73761e72420dc398cae16044c435fd942;hpb=1ab0b29388ce71004b95bc6bec6d9ef3b4371e12;p=builder.git diff --git a/source/lib/binarycomponent.cpp b/source/lib/binarycomponent.cpp index d29673a..408ea46 100644 --- a/source/lib/binarycomponent.cpp +++ b/source/lib/binarycomponent.cpp @@ -14,14 +14,6 @@ void BinaryComponent::create_build_info() for(const Component *u: uses) { - /* Select an include path that contains all the sources for this and the - used component. This should produce a sensible result in most cases. */ - FS::Path base; - for(const FS::Path &s: sources) - base = base.empty() ? s : FS::common_ancestor(base, s); - for(const FS::Path &s: u->get_sources()) - base = FS::common_ancestor(base, s); - build_info.incpath.push_back(base); build_info.libs.push_back(u->get_name()); if(!u->get_install()) { @@ -95,7 +87,7 @@ void BinaryComponent::create_targets() const if(tool->accepts_suffix(ext)) { t = &dynamic_cast(*tool->create_target(*t)); - if(type==LIBRARY && install) + if(type==LIBRARY) create_install(*t); } } @@ -106,17 +98,20 @@ void BinaryComponent::create_targets() const vector group = extract_group(pending, *tool); FileTarget &tgt = dynamic_cast(*tool->create_target(group)); pending.push_back(&tgt); - if(type==LIBRARY && install) + if(type==LIBRARY) create_install(tgt); } } vector results; - results.reserve(2); + results.reserve(3); if(type==LIBRARY) { Tool &archiver = toolchain.get_tool("AR"); - results.push_back(linker.create_target(objs, "shared")); + Target *shlib = linker.create_target(objs, "shared"); + results.push_back(shlib); + if(Target *imp = linker.create_target(*shlib, "import")) + results.push_back(imp); results.push_back(archiver.create_target(objs)); } else if(type==MODULE) @@ -156,7 +151,7 @@ vector BinaryComponent::create_sources() const if(FileTarget *file = dynamic_cast(src)) { targets.push_back(file); - if(type==LIBRARY && install) + if(type==LIBRARY) create_install(*file); } } @@ -190,13 +185,14 @@ vector BinaryComponent::extract_group(vector &targets, c void BinaryComponent::create_install(FileTarget &target) const { BuildGraph &build_graph = package.get_builder().get_build_graph(); + auto add_func = (install ? &BuildGraph::add_installed_target : &BuildGraph::add_staged_target); if(target.is_installable()) - build_graph.add_installed_target(target); + (build_graph.*add_func)(target); for(Target *s: target.get_side_effects()) if(dynamic_cast(*s).is_installable()) - build_graph.add_installed_target(*s); + (build_graph.*add_func)(*s); }