Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
MakeCompilerStrategy.cpp
Go to the documentation of this file.
3#include <cstdlib>
4#include <iostream>
5#include <string>
6
7void MakeCompilerStrategy::compile_run(const std::string& sourceFile, const std::string& outputBinary) {
8 if (!this->check_if_compile(outputBinary)) {
9 this->compile(sourceFile, outputBinary);
10 }
11 std::string command_run = MartyRuntimeConfig::shell_quote(outputBinary)
12 + " -Q " + std::to_string(this->Q_match);
13 if (!param_file_.empty()) {
14 command_run += " --param-file " + MartyRuntimeConfig::shell_quote(param_file_);
15 }
16 if (!output_file_.empty()) {
17 command_run += " --output-file " + MartyRuntimeConfig::shell_quote(output_file_);
18 }
19 executeCommand(command_run);
20}
21
22void MakeCompilerStrategy::compile(const std::string& sourceFile, const std::string&) {
23 std::string command = "cd " + MartyRuntimeConfig::shell_quote(sourceFile) + " && make";
24 executeCommand(command);
25}
bool executeCommand(const std::string &command)
Executes a shell command and captures its output.
Declares a compilation strategy based on make.
virtual bool check_if_compile(const std::string &outputBinary)
Checks whether a compiled binary already exists and is non-empty.
void compile_run(const std::string &sourceFile, const std::string &outputBinary) override
Compiles if necessary and then runs the resulting binary.
double Q_match
Matching scale (default: 80.379 GeV, the physical W mass).
void compile(const std::string &sourceFile, const std::string &outputBinary) override
Invokes make in the given source directory.
static std::string shell_quote(const std::filesystem::path &path)
Shell-quote a path for command strings passed to std::system().