30 this->builtIn =
false;
60 if (isModule(
module, moduleKey))
74 m->modulePath = modulePath;
76 else if (moduleKey !=
"libmodule")
77 VUserLog(
"Warning: No VuoModuleMetadata found in \"%s\" so I'm not going to load it.", moduleKey.c_str());
86 bool VuoCompilerModule::isModule(Module *module,
string moduleKey)
109 moduleDetails = json_tokener_parse(moduleDetailsStr.c_str());
113 VUserLog(
"Error: Couldn't parse VuoModuleMetadata as JSON: %s", moduleDetailsStr.c_str());
122 dependencies = set<string>(dependenciesVector.begin(), dependenciesVector.end());
135 if (json_object_object_get_ex(o, key.c_str(), &operatingSystemsObject))
137 if (json_object_get_type(operatingSystemsObject) == json_type_object)
140 if (json_object_object_get_ex(operatingSystemsObject,
"macosx", &macosObject))
157 if (version ==
"10.7")
158 return VuoCompilerTargetSet::MacVersion_10_7;
159 if (version ==
"10.8")
160 return VuoCompilerTargetSet::MacVersion_10_8;
161 if (version ==
"10.9")
162 return VuoCompilerTargetSet::MacVersion_10_9;
163 if (version ==
"10.10")
164 return VuoCompilerTargetSet::MacVersion_10_10;
165 if (version ==
"10.11")
166 return VuoCompilerTargetSet::MacVersion_10_11;
167 if (version ==
"10.12")
168 return VuoCompilerTargetSet::MacVersion_10_12;
169 if (version ==
"10.13")
170 return VuoCompilerTargetSet::MacVersion_10_13;
171 if (version ==
"10.14")
172 return VuoCompilerTargetSet::MacVersion_10_14;
173 if (version ==
"10.15")
174 return VuoCompilerTargetSet::MacVersion_10_15;
176 return VuoCompilerTargetSet::MacVersion_Any;
186 globals.insert(
"moduleDetails");
212 string nameAfterCompilation =
nameForGlobal(nameBeforeCompilation, moduleKey);
213 return (
module->getNamedValue(nameBeforeCompilation) != NULL ||
module->getNamedValue(nameAfterCompilation) != NULL);
224 Module::GlobalListType& globals =
module->getGlobalList();
227 for (Module::GlobalListType::iterator i = globals.begin(), e = globals.end(); i != e; ++i) {
228 string curGlobalVarName = i->getName();
230 if (globalsAndFuncsToRename.find(curGlobalVarName) != globalsAndFuncsToRename.end()) {
232 i->setName(newGlobalVarName);
237 Module::FunctionListType& functions =
module->getFunctionList();
240 for (Module::FunctionListType::iterator i = functions.begin(), e = functions.end(); i != e; ++i) {
241 string curFuncName = i->getName();
243 if (globalsAndFuncsToRename.find(curFuncName) != globalsAndFuncsToRename.end()) {
245 i->setName(newFuncName);
257 Function *functionDst =
module->getFunction(functionSrc->getName());
260 functionDst = Function::Create(functionSrc->getFunctionType(),
261 GlobalValue::ExternalLinkage,
262 functionSrc->getName(),
264 functionDst->setAttributes( functionSrc->getAttributes() );
291 return compatibleTargets;
323 this->builtIn = builtIn;