diff --git a/clingwrapper/src/clingwrapper.cxx b/clingwrapper/src/clingwrapper.cxx index c2770b00..c523d932 100644 --- a/clingwrapper/src/clingwrapper.cxx +++ b/clingwrapper/src/clingwrapper.cxx @@ -151,14 +151,28 @@ static struct Signalmap_t { // } // }; +static inline +void push_tokens_from_string(char *s, std::vector &tokens) { + char *token = strtok(s, " "); + + while (token) { + tokens.push_back(token); + token = strtok(NULL, " "); + } +} + class ApplicationStarter { InterOp::TInterp_t Interp; public: ApplicationStarter() { // Create the interpreter and initilize the pointer - // FIXME: We should make these flags available via the env variable - // INTEROP_EXTRA_INTERPRETER_ARGS - Interp = InterOp::CreateInterpreter({"-std=c++17", "-march=native"}); + + std::vector InterpArgs({"-std=c++17", "-march=native"}); + char *InterpArgString = getenv("INTEROP_EXTRA_INTERPRETER_ARGS"); + if (InterpArgString) + push_tokens_from_string(InterpArgString, InterpArgs); + + Interp = InterOp::CreateInterpreter(InterpArgs); // fill out the builtins std::set bi{g_builtins};