예제 #1
0
void compiler::compile(Object & obj)
{
	string file=obj.filePath;
	string base=obj.baseName;
	string root=obj.rootDir;
	bool isCpp=file.substr(file.find_last_of('.'))==".cpp";
	computeDependencies(obj);
	obj.addInclude(cfg().rootDir+"hardware/arduino/cores/arduino"); // change this to work with tinyX5;
	obj.addInclude(ofToDataPath(cfg().robotRoot+"/include"));

	cmd.newCommand();
	if(isCpp) cmd.addArgument(cfg().toolDir+"avr-g++");
	else cmd.addArgument(cfg().toolDir+"avr-gcc");
	cmd.addArgument("-c -g -Os -w");
	if(isCpp) cmd.addArgument("-fno-exceptions");
	cmd.addArgument("-ffunction-sections -fdata-sections");
	cmd.addArgument("-DF_CPU="+cfg().freq+"L");
	cmd.addArgument("-DARDUINO=22");
	for(unsigned int i=0; i<obj.size(); i++){
		cmd.addArgument("-I"+obj[i]);
	}
	cmd.addArgument("-mmcu="+cfg().mcu);
	if(isCpp) cmd.addArgument(root+base+".cpp");
	else cmd.addArgument(root+base+".c");
	cmd.addArgument("-o " + appletDir+base+ ".o");

	percent=0;
	cmd.execute();

	/*
	path/to/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -DF_CPU=processor_speed
	-I(includes_for_cpp) -mmcu=processor_name path/to/target.cpp -o target.o
	*/
}
예제 #2
0
string compiler::searchFolder(string & incl, string startPosition,Object & obj)
{
	string ret="";
	ofxDirList dir;
	//cout << startPosition << " is the start pos\n";
	int nDir=dir.listDir(startPosition);
	bool found=false;
	for(int i = 0; i < nDir; i++){
		string fl=dir.getName(i);
		if(fl==incl+".h"){
			found=true;
      if(cfg().verbose) cout << "found " + incl + " in " + startPosition<<endl; 
			obj.addInclude(startPosition);
		}
		//if(fl.substr(fl.find_last_of('.'))==".cpp") objects.push_back(Object(dir.getPath(i)));
		else if(fl==incl+".cpp"||fl==incl+".c"){
			bool foundC=false;
			for(unsigned int j=0; j<objects.size()&&!found; j++){
				if(objects[j].filePath==dir.getPath(i)) foundC=true;
			}
			if(!foundC){
				objects.push_back(Object(dir.getPath(i)));
				computeDependencies(objects.back());
			}
		}
		else if(fl.find_last_of('.')==fl.npos&&!found&&fl!="Makefile"&&fl!="examples"){
			ret=searchFolder(incl,dir.getPath(i),obj);
			found=ret.length();
		}
	}
	return ret;
}
예제 #3
0
파일: program.cpp 프로젝트: MAPJe71/libyuni
	bool LibConfigProgram::displayInformationAboutYuniVersion(LibConfig::VersionInfo::Settings& version)
	{
		// Getting the config file
		String::List options;
		if (not version.configFile(options, pOptPrintErrors) or not version.parserModulesOptions(options, pOptPrintErrors))
		{
			pExitStatus = 1;
			return false;
		}
		// Dependencies
		computeDependencies(version);
		if (pOptPrintModulesDeps)
		{
			printModulesDependencies();
			checkForDependencies(version);
			return false;
		}
		if (!checkForDependencies(version))
			return false;
		return true;
	}
void ControlDependenceGraphBase::graphForFunction(Function &F, PostDominatorTree &pdt) {
  computeDependencies(F,pdt);
  insertRegions(pdt);
}