AddonCompiler.hpp
1 #pragma once
2 
3 #include <JitCpp/JitOptions.hpp>
4 
5 #include <QThread>
6 
7 #include <score_plugin_jit_export.h>
8 
9 #include <verdigris>
10 
11 #include <score/plugins/qt_interfaces/PluginRequirements_QtInterface.hpp>
12 #undef RESET
13 namespace score
14 {
15 class Plugin_QtInterface;
16 }
17 
18 namespace Jit
19 {
21 class AddonCompiler final : public QObject
22 {
23  W_OBJECT(AddonCompiler)
24 public:
25  AddonCompiler();
26 
27  ~AddonCompiler();
28  void submitJob(
29  const std::string& id, std::string cpp, std::vector<std::string> flags,
30  CompilerOptions opts) W_SIGNAL(submitJob, id, cpp, flags, opts);
31  void jobCompleted(score::Plugin_QtInterface* p) W_SIGNAL(jobCompleted, p);
32  void jobFailed() W_SIGNAL(jobFailed);
33  void on_job(
34  std::string id, std::string cpp, std::vector<std::string> flags,
35  CompilerOptions opts);
36 
37 private:
38  QThread m_thread;
39 };
40 
41 using FactoryFunction = std::function<void()>;
42 using CustomCompiler = std::function<FactoryFunction(
43  const std::string&, const std::vector<std::string>&)>;
44 }
45 
46 Q_DECLARE_METATYPE(std::string)
47 W_REGISTER_ARGTYPE(std::string)
48 Q_DECLARE_METATYPE(std::vector<std::string>)
49 W_REGISTER_ARGTYPE(std::vector<std::string>)
50 Q_DECLARE_METATYPE(Jit::CompilerOptions)
51 W_REGISTER_ARGTYPE(Jit::CompilerOptions)
52 Q_DECLARE_METATYPE(score::Plugin_QtInterface*)
53 W_REGISTER_ARGTYPE(score::Plugin_QtInterface*)
Compiles jobs asynchronously.
Definition: AddonCompiler.hpp:22
Definition: PluginRequirements_QtInterface.hpp:18
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: JitOptions.hpp:7