}
+#ifdef ANDROIDTOOLS_BUILD
#if defined(_WIN32)
#define ANDROIDTOOLS_API __declspec(dllexport)
#elif defined(__GNUC__)
{
return new AndroidPlugin(builder);
}
+#endif
}
+#ifdef BASETOOLS_BUILD
#if defined(_WIN32)
#define BASETOOLS_API __declspec(dllexport)
#elif defined(__GNUC__)
{
return new BasePlugin(builder);
}
+#endif
}
+#ifdef CLANGTOOLS_BUILD
#if defined(_WIN32)
#define CLANGTOOLS_API __declspec(dllexport)
#elif defined(__GNUC__)
{
return new ClangPlugin(builder);
}
+#endif
}
+#ifdef DATATOOLS_BUILD
#if defined(_WIN32)
#define DATATOOLS_API __declspec(dllexport)
#elif defined(__GNUC__)
{
return new DataFilePlugin(builder);
}
+#endif
}
+#ifdef GNUTOOLS_BUILD
#if defined(_WIN32)
#define GNUTOOLS_API __declspec(dllexport)
#elif defined(__GNUC__)
{
return new GnuPlugin(builder);
}
+#endif
}
+#ifdef MSVCTOOLS_BUILD
#if defined(_WIN32)
#define MSVCTOOLS_API __declspec(dllexport)
#elif defined(__GNUC__)
{
return new MsvcPlugin(builder);
}
+#endif
}
}
+ add_plugins(unordered_plugins);
+}
+
+void Builder::add_plugins(vector<LoadedPlugin> &unordered_plugins)
+{
auto have_plugin = [this](const string &r){
return any_of(plugins.begin(), plugins.end(), [&r](const LoadedPlugin &p){ return FS::basepart(FS::basename(p.path))==r; });
};
~Builder();
void load_plugins();
+
+ template<typename... T>
+ void load_plugins();
+
+private:
+ void add_plugins(std::vector<LoadedPlugin> &);
+
+public:
PackageManager &get_package_manager() { return package_manager; }
SourcePackage::ComponentRegistry &get_component_registry() { return component_registry; }
int do_create_makefile();
};
+template<typename... T>
+void Builder::load_plugins()
+{
+ Plugin *raw_plugins[] = { new T(*this)... };
+ std::vector<LoadedPlugin> pending_plugins;
+ for(Plugin *p: raw_plugins)
+ {
+ LoadedPlugin plugin;
+ plugin.plugin = p;
+ pending_plugins.emplace_back(std::move(plugin));
+ }
+ add_plugins(pending_plugins);
+}
+
template<typename F>
void Builder::call_plugins(F func) const
{