bool MakeStep::init() { CMakeBuildConfiguration *bc = cmakeBuildConfiguration(); QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets); Utils::QtcProcess::addArgs(&arguments, additionalArguments()); setIgnoreReturnValue(m_clean); ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); pp->setWorkingDirectory(bc->buildDirectory()); if (bc->toolChain()) pp->setCommand(bc->toolChain()->makeCommand()); else pp->setCommand(QLatin1String("make")); pp->setArguments(arguments); setOutputParser(new ProjectExplorer::GnuMakeParser()); if (bc->toolChain()) appendOutputParser(bc->toolChain()->outputParser()); outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory()); return AbstractProcessStep::init(); }
bool CMakeProject::parseCMakeLists() { if (!activeTarget() || !activeTarget()->activeBuildConfiguration()) { return false; } CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration()); foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) if (isProjectFile(document->filePath())) document->infoBar()->removeInfo("CMakeEditor.RunCMake"); // Find cbp file QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory().toString()); if (cbpFile.isEmpty()) { emit buildTargetsChanged(); return false; } Kit *k = activeTarget()->kit(); // setFolderName m_rootNode->setDisplayName(QFileInfo(cbpFile).completeBaseName()); CMakeCbpParser cbpparser; // Parsing //qDebug()<<"Parsing file "<<cbpFile; if (!cbpparser.parseCbpFile(k,cbpFile, projectDirectory().toString())) { // TODO report error emit buildTargetsChanged(); return false; } foreach (const QString &file, m_watcher->files()) if (file != cbpFile) m_watcher->removePath(file); // how can we ensure that it is completely written? m_watcher->addPath(cbpFile); m_projectName = cbpparser.projectName(); m_rootNode->setDisplayName(cbpparser.projectName()); //qDebug()<<"Building Tree"; QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList(); QSet<FileName> projectFiles; if (cbpparser.hasCMakeFiles()) { fileList.append(cbpparser.cmakeFileList()); foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList()) projectFiles.insert(node->path()); } else {
bool MakeStep::init() { CMakeBuildConfiguration *bc = cmakeBuildConfiguration(); if (!bc) bc = targetsActiveBuildConfiguration(); if (!bc) emit addTask(Task::buildConfigurationMissingTask()); ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit()); if (!tc) emit addTask(Task::compilerMissingTask()); if (!bc || !tc) { emitFaultyConfigurationMessage(); return false; } m_useNinja = bc->useNinja(); QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets); Utils::QtcProcess::addArgs(&arguments, additionalArguments()); setIgnoreReturnValue(m_clean); ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); Utils::Environment env = bc->environment(); // Force output to english for the parsers. Do this here and not in the toolchain's // addToEnvironment() to not screw up the users run environment. env.set(QLatin1String("LC_ALL"), QLatin1String("C")); if (m_useNinja && !env.value(QLatin1String("NINJA_STATUS")).startsWith(m_ninjaProgressString)) env.set(QLatin1String("NINJA_STATUS"), m_ninjaProgressString + QLatin1String("%o/sec] ")); pp->setEnvironment(env); pp->setWorkingDirectory(bc->buildDirectory().toString()); pp->setCommand(makeCommand(tc, bc->environment())); pp->setArguments(arguments); pp->resolveAll(); setOutputParser(new CMakeParser()); IOutputParser *parser = target()->kit()->createOutputParser(); if (parser) appendOutputParser(parser); outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory()); return AbstractProcessStep::init(); }
void MakeStepConfigWidget::updateDetails() { CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration(); ProjectExplorer::ToolChain *tc = bc->toolChain(); if (tc) { QString arguments = Utils::QtcProcess::joinArgs(m_makeStep->m_buildTargets); Utils::QtcProcess::addArgs(&arguments, m_makeStep->additionalArguments()); ProcessParameters param; param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->buildDirectory()); param.setCommand(tc->makeCommand()); param.setArguments(arguments); m_summaryText = param.summary(displayName()); } else { m_summaryText = tr("<b>Unknown tool chain</b>"); } emit updateSummary(); }
void CMakeManager::runCMake(ProjectExplorer::Project *project) { if (!project) return; CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(project); if (!cmakeProject) return; if (!cmakeProject->activeTarget()) return; if (!cmakeProject->activeTarget()->activeBuildConfiguration()) return; CMakeBuildConfiguration *bc = cmakeProject->activeTarget()->activeBuildConfiguration(); CMakeOpenProjectWizard copw(this, cmakeProject->projectDirectory(), bc->buildDirectory(), CMakeOpenProjectWizard::WantToUpdate, bc->environment()); if (copw.exec() == QDialog::Accepted) { cmakeProject->parseCMakeLists(); } }
bool MakeStep::init(QList<const BuildStep *> &earlierSteps) { CMakeBuildConfiguration *bc = cmakeBuildConfiguration(); if (!bc) bc = targetsActiveBuildConfiguration(); if (!bc) emit addTask(Task::buildConfigurationMissingTask()); ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit()); if (!tc) emit addTask(Task::compilerMissingTask()); if (!bc || !tc) { emitFaultyConfigurationMessage(); return false; } m_useNinja = bc->useNinja(); QString arguments; if (m_addRunConfigurationArgument) { CMakeRunConfiguration* rc = targetsActiveRunConfiguration(); if (!rc) { emit addTask(Task(Task::Error, QCoreApplication::translate("ProjectExplorer::Task", "You asked to build the current Run Configurations build target only, " "but the current Run Configuration is not associated with a build target. " "Please update the Make Step in your build settings."), Utils::FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); emitFaultyConfigurationMessage(); return false; } if (!rc->title().isEmpty()) Utils::QtcProcess::addArg(&arguments, rc->title()); } Utils::QtcProcess::addArgs(&arguments, m_buildTargets); Utils::QtcProcess::addArgs(&arguments, additionalArguments()); setIgnoreReturnValue(m_clean); ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); Utils::Environment env = bc->environment(); // Force output to english for the parsers. Do this here and not in the toolchain's // addToEnvironment() to not screw up the users run environment. env.set(QLatin1String("LC_ALL"), QLatin1String("C")); if (m_useNinja && !env.value(QLatin1String("NINJA_STATUS")).startsWith(m_ninjaProgressString)) env.set(QLatin1String("NINJA_STATUS"), m_ninjaProgressString + QLatin1String("%o/sec] ")); pp->setEnvironment(env); pp->setWorkingDirectory(bc->buildDirectory().toString()); pp->setCommand(makeCommand(tc, bc->environment())); pp->setArguments(arguments); pp->resolveAll(); setOutputParser(new CMakeParser()); IOutputParser *parser = target()->kit()->createOutputParser(); if (parser) appendOutputParser(parser); outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory()); return AbstractProcessStep::init(earlierSteps); }