Changeset 799 for mcbuilder/trunk/src/Builder.cpp
- Timestamp:
- 08/09/08 21:44:20 (5 months ago)
- Files:
-
- 1 modified
-
mcbuilder/trunk/src/Builder.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mcbuilder/trunk/src/Builder.cpp
r797 r799 23 23 #include "ConsoleItem.h" 24 24 25 #define LIBRARIES_DIR "cores/makecontroller/libraries" 26 25 27 /* 26 28 Builder takes a project and turns it into a binary executable. … … 28 30 and Properties for this project. 29 31 */ 30 Builder::Builder( MainWindow *mainWindow, ProjectInfo *projInfo, BuildLog *buildLog) : QProcess( 0 )32 Builder::Builder( MainWindow *mainWindow, ProjectInfo *projInfo, BuildLog *buildLog ) : QProcess( 0 ) 31 33 { 32 34 this->mainWindow = mainWindow; 33 35 this->projInfo = projInfo; 34 36 this->buildLog = buildLog; 37 35 38 connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(filterOutput())); 36 39 connect(this, SIGNAL(readyReadStandardError()), this, SLOT(filterErrorOutput())); … … 54 57 } 55 58 currentProjectPath = projectName; 56 ensureBuildDirExists(currentProjectPath); // make sure we have a build dir57 59 setWorkingDirectory(QDir(currentProjectPath).filePath("build")); 58 loadDependencies( currentProjectPath); // this loads up the list of libraries this project depends on60 loadDependencies(LIBRARIES_DIR, currentProjectPath); // this loads up the list of libraries this project depends on 59 61 createMakefile(currentProjectPath); // create a Makefile for this project, given the dependencies 60 62 createConfigFile(currentProjectPath); // create a config file based on the Properties for this project … … 107 109 /* 108 110 If there's no build directory within a project, create one. 109 */ 110 void Builder::ensureBuildDirExists(QString projPath) 111 Return the build dir's path. 112 */ 113 QString Builder::ensureBuildDirExists(QString projPath) 111 114 { 112 115 QDir dir(projPath); 113 116 if(!dir.exists("build")) 114 117 dir.mkdir("build"); 118 return dir.filePath("build"); 115 119 } 116 120 … … 184 188 { 185 189 bool retval = true; 186 QDir buildDir( projectPath + "/build");190 QDir buildDir( ensureBuildDirExists(projectPath) ); 187 191 QFile makefile(buildDir.filePath("Makefile")); 188 192 if(makefile.open(QIODevice::WriteOnly | QFile::Text)) … … 250 254 251 255 // add in the directories for the required libraries 252 QDir libdir(QDir::current().filePath( "cores/makecontroller/libraries"));256 QDir libdir(QDir::current().filePath(LIBRARIES_DIR)); 253 257 foreach(Library lib, libraries) 254 258 tofile << " -I" << filteredPath(libdir.filePath(lib.name)) << " \\" << endl; … … 484 488 while(!outline.isNull()) 485 489 { 486 qDebug("msg: %s", qPrintable(outline));490 //qDebug("msg: %s", qPrintable(outline)); 487 491 QStringList sl = outline.split(" "); 488 492 if(sl.first().endsWith("arm-elf-gcc") && sl.at(1) == "-c") … … 522 526 while(!outline.isNull()) 523 527 { 524 qDebug("err: %s", qPrintable(outline));528 //qDebug("err: %s", qPrintable(outline)); 525 529 QString line = outline; 526 530 outline = outstream.readLine(); … … 648 652 Create a Library structure for each library and store it in our class member "libraries" 649 653 */ 650 void Builder::loadDependencies(QString project)654 void Builder::loadDependencies(QString libsDir, QString project) 651 655 { 652 656 QDir projDir(project); 653 657 QStringList srcFiles = projDir.entryList(QStringList() << "*.c" << "*.h"); 654 QDir libDir(QDir::current().filePath( "cores/makecontroller/libraries"));658 QDir libDir(QDir::current().filePath(libsDir)); 655 659 QStringList libDirs = libDir.entryList(QStringList(), QDir::Dirs | QDir::NoDotAndDotDot); 656 660
