if(tool->accepts_suffix(ext))
{
t = &dynamic_cast<FileTarget &>(*tool->create_target(*t));
- if(type==LIBRARY && install)
+ if(type==LIBRARY)
create_install(*t);
}
}
vector<Target *> group = extract_group(pending, *tool);
FileTarget &tgt = dynamic_cast<FileTarget &>(*tool->create_target(group));
pending.push_back(&tgt);
- if(type==LIBRARY && install)
+ if(type==LIBRARY)
create_install(tgt);
}
}
if(FileTarget *file = dynamic_cast<FileTarget *>(src))
{
targets.push_back(file);
- if(type==LIBRARY && install)
+ if(type==LIBRARY)
create_install(*file);
}
}
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<FileTarget &>(*s).is_installable())
- build_graph.add_installed_target(*s);
+ (build_graph.*add_func)(*s);
}
get_target("install")->add_dependency(*inst_tgt);
}
+void BuildGraph::add_staged_target(Target &t)
+{
+ builder.get_toolchain().get_tool("CP").create_target(t, "//");
+}
+
void BuildGraph::add_goal(Target &t)
{
goals->add_dependency(t);
created and added as a dependency to the "install" virtual target. */
void add_installed_target(Target &);
+ void add_staged_target(Target &);
+
/** Adds a target as a toplevel goal. These are stored as dependencies of
the "goals" virtual target. */
void add_goal(Target &);
if(!tgt.get_package())
throw invalid_argument("No private install location for "+tgt.get_name());
- prefix = tgt.get_package()->get_temp_directory();
+ prefix = tgt.get_package()->get_staging_directory();
mid = loc.substr(2);
}
else
{
prefix = global_prefix;
+ mid = loc;
+ }
- if(!loc.empty())
- mid = loc;
- else if(const Component *comp = tgt.get_component())
+ if(mid.empty())
+ if(const Component *comp = tgt.get_component())
mid = comp->get_install_map().get_install_location(tgt);
- }
if(mid.empty())
mid = tgt.get_install_location();
return source_dir/arch.get_name();
}
+FS::Path SourcePackage::get_staging_directory() const
+{
+ return get_temp_directory()/"staging";
+}
+
const Component &SourcePackage::get_component(const string &n) const
{
auto i = find_if(components, [&n](const Component *c){ return c->get_name()==n; });
final_build_info.update_from(build_info);
build_info = final_build_info;
- build_info.incpath.push_back((builder.get_prefix()/"include").str());
- build_info.libpath.push_back((builder.get_prefix()/"lib").str());
+ build_info.incpath.push_back(get_staging_directory()/"include");
+ build_info.incpath.push_back(builder.get_prefix()/"include");
+ build_info.libpath.push_back(builder.get_prefix()/"lib");
for(const Feature &f: features)
{
const Msp::FS::Path &get_source_directory() const { return source_dir; }
Msp::FS::Path get_temp_directory() const;
Msp::FS::Path get_output_directory() const;
+ Msp::FS::Path get_staging_directory() const;
const Toolchain &get_toolchain() const { return local_tools; }
const Component &get_component(const std::string &) const;