#include "Project.h" #include "FileSystemUtilities.h" #include "ProcessUtilities.h" #include "ProjectParser.h" #include "ToolChain.h" #include #include #include #include static std::string getNamedString(int argc, char** argv, const std::string& Key, const std::string& Default) { std::string Sign = "--"+Key+"="; for (int i=1; i& E) { Executables.push_back(E); Executables[Executables.size()-1]->configuration().setParent(&this->configuration()); return *this; } void fatalErrorCantCreateBuildDir(const std::string& D) { std::cerr << "Can't create build directory " << D << std::endl << "Specify the correct directory with the --builddir= option" << std::endl << "and make sure it has the appropriate permissions." << std::endl; exit(1); } void fatalErrorCantReadProjectFile(const std::string& F) { std::cerr << "Can't open project file " << F << std::endl << "Specify the correct project file with the --projectfile= option" << std::endl << "and make sure it has the appropriate permissions." << std::endl; exit(1); } void Project::readProjectFile(bool DiscoveryMode) { if (!fileExists(ProjectFile)) fatalErrorCantReadProjectFile(ProjectFile); parse(*this,ProjectFile,DiscoveryMode); } void Project::run() { configure(); if (DiscoverMode) { systemConfiguration().writeTo(pathAppend(configuration().buildDir(),"makefest.cfg")); return; } // setup for (unsigned int i=0; ireadSystemConfiguration(); // building unsigned int MaxTasks = 2; unsigned int TasksRunning = 0; bool TaskCreated; do { TaskCreated = false; TasksRunning = waitForProcessEvent(); for (unsigned int i=TasksRunning; icreateNextTask(); return T; } void Project::error(const std::string& Error) const { std::cout << Error << std::endl; } void Project::configure() { for (unsigned int i=0; iconfigure(); } const SystemConfiguration& Project::systemConfiguration() const { return System; } SystemConfiguration& Project::systemConfiguration() { return System; } void Project::readSystemConfiguration(bool OnlyFromCache) { if (!createDirectory(configuration().buildDir())) fatalErrorCantCreateBuildDir(configuration().buildDir()); std::string PathName = pathAppend(configuration().buildDir(),"makefest.cfg"); System.readFrom(PathName); if (ProjectFile.empty()) ProjectFile = System.valueAsString(ProjectFile); System.configureKey(true,"projectfile",ProjectFile); System.configureComment("General library search paths"); std::vector IncludeSearchDirs(System.valueAsStringList("includesearchdir")); System.configureKey("includesearchdir",IncludeSearchDirs); for (unsigned int i=0; i LibrarySearchDirs(System.valueAsStringList("librarysearchdir")); System.configureKey("librarysearchdir",LibrarySearchDirs); for (unsigned int i=0; i