diff --git a/Rez/Rez.cc b/Rez/Rez.cc index cae9d57e63..268d700ccd 100644 --- a/Rez/Rez.cc +++ b/Rez/Rez.cc @@ -28,6 +28,8 @@ int main(int argc, const char *argv[]) ("output,o", po::value()->default_value("rez.output.rsrc"), "output file") ("type,t", po::value()->default_value("rsrc"), "output file finder type code") ("creator,c", po::value()->default_value("RSED"), "output file finder creator code") + ("define,D", po::value>(), "predefine preprocessor symbol") + ("include,I", po::value>(), "add include file path") ("debug,d", "debug logging") ; po::options_description hidden, alldesc; @@ -71,6 +73,13 @@ int main(int argc, const char *argv[]) for(std::string fn : options["input"].as>()) { RezLexer lexer(fn); + + for(std::string define : options["define"].as>()) + lexer.addDefine(define); + for(std::string path : options["include"].as>()) + lexer.addIncludePath(path); + + RezParser parser(lexer, world); parser.parse(); } diff --git a/Rez/RezLexer.cc b/Rez/RezLexer.cc index 07f23a2861..70d344f07c 100644 --- a/Rez/RezLexer.cc +++ b/Rez/RezLexer.cc @@ -101,6 +101,18 @@ RezLexer::~RezLexer() } + + +void RezLexer::addDefine(std::string str) +{ + pImpl->ctx.add_macro_definition(str); +} + +void RezLexer::addIncludePath(std::string path) +{ + pImpl->ctx.add_include_path(path.c_str()); +} + bool RezLexer::atEnd() { return pImpl->iter == pImpl->ctx.end(); diff --git a/Rez/RezLexer.h b/Rez/RezLexer.h index c0e7f12cea..a3c6b97a0c 100644 --- a/Rez/RezLexer.h +++ b/Rez/RezLexer.h @@ -23,6 +23,9 @@ public: ~RezLexer(); RezSymbol nextToken(); + + void addDefine(std::string str); + void addIncludePath(std::string path); }; #endif // REZLEXER_H