24 VuoCompilerModule_Pro();
30 this->builtIn =
false;
57 if (isModule(
module, moduleKey))
71 m->modulePath = modulePath;
73 else if (moduleKey !=
"libmodule")
74 VUserLog(
"Warning: No VuoModuleMetadata found in \"%s\" so I'm not going to load it.", moduleKey.c_str());
83 bool VuoCompilerModule::isModule(Module *module,
string moduleKey)
106 moduleDetails = json_tokener_parse(moduleDetailsStr.c_str());
110 VUserLog(
"Error: Couldn't parse VuoModuleMetadata as JSON: %s", moduleDetailsStr.c_str());
119 dependencies = set<string>(dependenciesVector.begin(), dependenciesVector.end());
132 if (json_object_object_get_ex(o, key.c_str(), &operatingSystemsObject))
134 if (json_object_get_type(operatingSystemsObject) == json_type_object)
137 if (json_object_object_get_ex(operatingSystemsObject,
"macosx", &macosObject))
154 if (version ==
"10.7")
155 return VuoCompilerTargetSet::MacVersion_10_7;
156 if (version ==
"10.8")
157 return VuoCompilerTargetSet::MacVersion_10_8;
158 if (version ==
"10.9")
159 return VuoCompilerTargetSet::MacVersion_10_9;
160 if (version ==
"10.10")
161 return VuoCompilerTargetSet::MacVersion_10_10;
162 if (version ==
"10.11")
163 return VuoCompilerTargetSet::MacVersion_10_11;
164 if (version ==
"10.12")
165 return VuoCompilerTargetSet::MacVersion_10_12;
166 if (version ==
"10.13")
167 return VuoCompilerTargetSet::MacVersion_10_13;
168 if (version ==
"10.14")
169 return VuoCompilerTargetSet::MacVersion_10_14;
170 if (version ==
"10.15")
171 return VuoCompilerTargetSet::MacVersion_10_15;
173 return VuoCompilerTargetSet::MacVersion_Any;
183 globals.insert(
"moduleDetails");
209 string nameAfterCompilation =
nameForGlobal(nameBeforeCompilation, moduleKey);
210 return (
module->getNamedValue(nameBeforeCompilation) != NULL ||
module->getNamedValue(nameAfterCompilation) != NULL);
221 Module::GlobalListType& globals =
module->getGlobalList();
224 for (Module::GlobalListType::iterator i = globals.begin(), e = globals.end(); i != e; ++i) {
225 string curGlobalVarName = i->getName();
227 if (globalsAndFuncsToRename.find(curGlobalVarName) != globalsAndFuncsToRename.end()) {
229 i->setName(newGlobalVarName);
234 Module::FunctionListType& functions =
module->getFunctionList();
237 for (Module::FunctionListType::iterator i = functions.begin(), e = functions.end(); i != e; ++i) {
238 string curFuncName = i->getName();
240 if (globalsAndFuncsToRename.find(curFuncName) != globalsAndFuncsToRename.end()) {
242 i->setName(newFuncName);
254 Function *functionDst =
module->getFunction(functionSrc->getName());
257 functionDst = Function::Create(functionSrc->getFunctionType(),
258 GlobalValue::ExternalLinkage,
259 functionSrc->getName(),
261 functionDst->setAttributes( functionSrc->getAttributes() );
288 return compatibleTargets;
320 this->builtIn = builtIn;