1#ifndef BACKENDS_P4TOOLS_COMMON_P4CTOOL_H_
2#define BACKENDS_P4TOOLS_COMMON_P4CTOOL_H_
8#include "backends/p4tools/common/compiler/compiler_target.h"
9#include "backends/p4tools/common/compiler/context.h"
10#include "backends/p4tools/common/lib/logging.h"
11#include "backends/p4tools/common/options.h"
12#include "frontends/common/options.h"
20template <
class Options,
21 typename = std::enable_if_t<std::is_base_of_v<AbstractP4cToolOptions, Options>>>
29 virtual void registerTarget() = 0;
35 int main(std::string_view toolName,
const std::vector<const char *> &args) {
40 auto &toolOptions = Options::get();
41 auto compileContext = toolOptions.process(args);
42 if (!compileContext) {
49 if (!toolOptions.disableInformationLogging) {
54 if (toolOptions.seed) {
55 printInfo(
"============ Program seed %1% =============\n", *toolOptions.seed);
61 if (!compilerResult.has_value()) {
64 return mainImpl(compilerResult.value());
static CompileContext & get()
Definition context.h:15
Definition compile_context.h:77