From 445572ee2ea29141d5fb72153b6ce76fe9014d0d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 15 Oct 2014 21:28:12 +0300 Subject: [PATCH] Allow specifying fixed arguments for source generators Currently, the fixed arguments are placed at the front of the command line, with the template file coming last. --- source/sourcegenerator.cpp | 7 +++++++ source/sourcegenerator.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/source/sourcegenerator.cpp b/source/sourcegenerator.cpp index 76d6c89..9acd696 100644 --- a/source/sourcegenerator.cpp +++ b/source/sourcegenerator.cpp @@ -57,6 +57,7 @@ Task *SourceGenerator::run(const Target &target) const vector args; args.push_back(executable->get_path().str()); + args.insert(args.end(), arguments.begin(), arguments.end()); const Target::Dependencies &deps = target.get_dependencies(); for(Target::Dependencies::const_iterator i=deps.begin(); i!=deps.end(); ++i) @@ -73,11 +74,17 @@ SourceGenerator::Loader::Loader(SourceGenerator &sg): DataFile::ObjectLoader(sg), ConditionalLoader(sg.package, format("%s/%s", sg.package.get_name(), sg.tag)) { + add("argument", &Loader::argument); add("command", &Loader::command); add("in_suffix", &Loader::in_suffix); add("out_suffix", &Loader::out_suffix); } +void SourceGenerator::Loader::argument(const string &a) +{ + obj.arguments.push_back(a); +} + void SourceGenerator::Loader::command(const string &c) { obj.set_command((obj.package.get_source_directory()/c).str()); diff --git a/source/sourcegenerator.h b/source/sourcegenerator.h index bb1a88e..be7d675 100644 --- a/source/sourcegenerator.h +++ b/source/sourcegenerator.h @@ -15,6 +15,7 @@ public: Loader(SourceGenerator &); private: + void argument(const std::string &); void command(const std::string &); void in_suffix(const std::string &); void out_suffix(const std::string &); @@ -23,6 +24,7 @@ public: private: const SourcePackage &package; std::list out_suffixes; + std::list arguments; public: SourceGenerator(Builder &, const SourcePackage &, const std::string &); -- 2.45.2