19 std::regex r(
"([^ ]+) *(.*)");
20 for (
const auto& arg: arguments) {
22 if (std::regex_match(arg.native(), matches, r)) {
23 fs::path path = std::filesystem::canonical(fs::path(matches[1]));
24 if (!fs::is_regular_file(path)) {
25 BENCHMAX_LOG_WARN(
"benchmax",
"The tool " << path <<
" does not seem to be a file. We skip it.");
28 const fs::perms executable = fs::perms::others_exec | fs::perms::group_exec | fs::perms::owner_exec;
29 if ((fs::status(path).permissions() & executable) == fs::perms::none) {
30 BENCHMAX_LOG_WARN(
"benchmax",
"The tool " << path <<
" does not seem to be executable. We skip it.");
33 BENCHMAX_LOG_DEBUG(
"benchmax.tools",
"Adding tool " << path <<
" with arguments \"" << matches[2] <<
"\".");
34 tools.emplace_back(std::make_unique<T>(path, matches[2]));
47 createTools<SMTRAT_Analyzer>(
settings_tools().tools_smtrat_analyzer, tools);
65 namespace po = boost::program_options;
66 auto& settings = settings::Settings::getInstance();
69 parser->add_finalizer([&s](
const auto& values){
72 parser->add(
"Tool settings").add_options()
73 (
"statistics,s", po::bool_switch(&s.collect_statistics),
"run tools with statistics")
74 (
"tool", po::value<std::vector<std::filesystem::path>>(&s.tools_generic),
"a generic tool")
75 (
"mathsat", po::value<std::vector<std::filesystem::path>>(&s.tools_mathsat),
"MathSAT with SMT-LIB interface")
76 (
"minisat", po::value<std::vector<std::filesystem::path>>(&s.tools_minisat),
"Minisat with DIMACS interface")
77 (
"minisatp", po::value<std::vector<std::filesystem::path>>(&s.tools_minisatp),
"Minisatp with OPB interface")
78 (
"smtrat,S", po::value<std::vector<std::filesystem::path>>(&s.tools_smtrat),
"SMT-RAT with SMT-LIB interface")
79 (
"smtrat-opb,O", po::value<std::vector<std::filesystem::path>>(&s.tools_smtrat_opb),
"SMT-RAT with OPB interface")
80 (
"smtrat-analyzer,A", po::value<std::vector<std::filesystem::path>>(&s.tools_smtrat_analyzer),
"SMT-RAT formula analyzer")
81 (
"z3,Z", po::value<std::vector<std::filesystem::path>>(&s.tools_z3),
"z3 with SMT-LIB interface")
#define BENCHMAX_LOG_DEBUG(channel, msg)
Log debug messages.
#define BENCHMAX_LOG_WARN(channel, msg)
Log warnings.
Generic class to manage settings parsing using boost::program_options.
bool finalize_tool_settings(ToolSettings &s, const boost::program_options::variables_map &)
Postprocess settings to compute common prefix.
void registerToolSettings(SettingsParser *parser)
Registers tool settings with the settings parser.
std::filesystem::path common_prefix(const std::filesystem::path &p1, const std::filesystem::path &p2)
Computes the common prefix of two paths.
Tools loadTools()
Load all tools from the tool settings.
std::vector< ToolPtr > Tools
A vector of ToolPtr.
const auto & settings_tools()
Returns the tool settings.
void createTools(const std::vector< std::filesystem::path > &arguments, Tools &tools)
Create tools of a given type T from a list of binaries and store them in tools.