X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsourcegenerator.cpp;h=584822a1074b06a1fb959714cfbb463b63c54bbc;hb=da4075117e3ad3a340e0d23fa7d53a9009305a61;hp=c7a4f92204c214e2b9b5877d1cf258fefa4f9eb0;hpb=ae85358a5f3d408f9886f58c8cdb2c6c92c3a25a;p=builder.git diff --git a/source/sourcegenerator.cpp b/source/sourcegenerator.cpp index c7a4f92..584822a 100644 --- a/source/sourcegenerator.cpp +++ b/source/sourcegenerator.cpp @@ -30,13 +30,21 @@ Target *SourceGenerator::create_target(const list &sources, const stri TemplateFile &tmpl = dynamic_cast(*sources.front()); const Component *comp = tmpl.get_component(); const SourcePackage *pkg = tmpl.get_package(); + FS::Path subdir; string base; - if(processing_unit==ONE_FILE) - base = FS::basepart(FS::basename(tmpl.get_path())); - else if(processing_unit==DIRECTORY) - base = FS::basename(FS::dirname(tmpl.get_path())); - else + if(processing_unit==COMPONENT) base = comp->get_name(); + else + { + subdir = FS::dirname(FS::relative(tmpl.get_path(), pkg->get_source_directory())); + if(processing_unit==ONE_FILE) + base = FS::basepart(FS::basename(tmpl.get_path())); + else if(processing_unit==DIRECTORY) + { + base = FS::basename(subdir); + subdir = FS::dirname(subdir); + } + } Target *primary = 0; for(list::const_iterator i=out_suffixes.begin(); i!=out_suffixes.end(); ++i) @@ -44,7 +52,7 @@ Target *SourceGenerator::create_target(const list &sources, const stri Tool *tool = builder.get_toolchain().get_tool_for_suffix(*i, true); if(tool) { - FS::Path fn = pkg->get_temp_directory()/comp->get_name()/(base+*i); + FS::Path fn = pkg->get_temp_directory()/"generated"/subdir/(base+*i); Target *target = tool->create_source(*comp, fn); target->set_tool(*this); for(list::const_iterator j=sources.begin(); j!=sources.end(); ++j) @@ -88,6 +96,7 @@ SourceGenerator::Loader::Loader(SourceGenerator &sg): ConditionalLoader(sg.package, format("%s/%s", sg.package.get_name(), sg.tag)) { add("argument", &Loader::argument); + add("arguments", &Loader::arguments); add("command", &Loader::command); add("in_suffix", &Loader::in_suffix); add("out_argument", &SourceGenerator::out_argument); @@ -100,6 +109,11 @@ void SourceGenerator::Loader::argument(const string &a) obj.arguments.push_back(a); } +void SourceGenerator::Loader::arguments(const vector &a) +{ + obj.arguments.insert(obj.arguments.end(), a.begin(), a.end()); +} + void SourceGenerator::Loader::command(const string &c) { if(c.find('/')!=string::npos)