void load_plugins();
PackageManager &get_package_manager() { return package_manager; }
+ template<typename F>
+ void call_plugins(F) const;
+
void set_architecture(const std::string &);
const Architecture &get_current_arch() const { return *current_arch; }
const Architecture &get_native_arch() const { return native_arch; }
int do_create_makefile();
};
+template<typename F>
+void Builder::call_plugins(F func) const
+{
+ for(const LoadedPlugin &p: plugins)
+ func(*p.plugin);
+}
+
#endif
class Architecture;
class Builder;
+class SourcePackage;
class Toolchain;
class Plugin
virtual ~Plugin() = default;
virtual void add_tools(Toolchain &, const Architecture &) const { }
+ virtual void create_targets(SourcePackage &) const { }
};
#endif
#include "file.h"
#include "installcomponent.h"
#include "builtin/pkgconfigfile.h"
+#include "plugin.h"
#include "sourcearchivecomponent.h"
#include "sourcegenerator.h"
#include "sourcepackage.h"
}
new CompileCommandsJson(builder, *this);
+
+ builder.call_plugins([this](const Plugin &p){ p.create_targets(*this); });
}
void SourcePackage::save_caches()