19map<string, VuoModuleCompiler::Factory> *VuoModuleCompiler::factories;
24void VuoModuleCompiler::loadAllModuleCompilers(
void)
26 factories =
new map<string, VuoModuleCompiler::Factory>;
28 vector<string> compilerPaths;
30 if (vuoFrameworkPath.empty())
31 compilerPaths.push_back(VUO_BUILD_DIR
"/lib/libVuoCModuleCompiler.dylib");
37 compilerPaths.push_back(file->path());
42 for (
const string &compilerPath : compilerPaths)
44 void *handle = dlopen(compilerPath.c_str(), RTLD_NOW);
46 VUserLog(
"Warning: The module compiler '%s' couldn't be loaded : %s", compilerPath.c_str(), dlerror());
57 auto existingFactory = factories->find(type);
58 if (existingFactory != factories->end())
60 VUserLog(
"Warning: A VuoModuleCompiler for type '%s' is already registered. Ignoring the duplicate.", type.c_str());
64 (*factories)[type] = factory;
75 static once_flag once;
76 std::call_once(once, []() {
77 loadAllModuleCompilers();
80 auto factory = factories->find(type);
81 if (factory != factories->end())
86 moduleCompiler->getVuoType = getVuoType;
87 return moduleCompiler;
99 sourcePath(sourcePath),
104VuoModuleCompiler::~VuoModuleCompiler(
void)