QString InternalLibraryDetailsController::suggestedIncludePath() const
{
    const int currentIndex = libraryDetailsWidget()->libraryComboBox->currentIndex();
    if (currentIndex >= 0) {
        QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex);
        return proFileNode->filePath().toFileInfo().absolutePath();
    }
    return QString();
}
Пример #2
0
bool QMakeStep::init(QList<const BuildStep *> &earlierSteps)
{
    if (m_commandFuture)
        return false;

    QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration();
    const BaseQtVersion *qtVersion = QtKitInformation::qtVersion(target()->kit());

    if (!qtVersion)
        return false;

    QString workingDirectory;

    if (qmakeBc->subNodeBuild())
        workingDirectory = qmakeBc->subNodeBuild()->buildDir();
    else
        workingDirectory = qmakeBc->buildDirectory().toString();

    m_qmakeExecutable = qtVersion->qmakeCommand().toString();
    m_qmakeArguments = allArguments(qtVersion);
    m_runMakeQmake = (qtVersion->qtVersion() >= QtVersionNumber(5, 0 ,0));
    if (m_runMakeQmake) {
        m_makeExecutable = makeCommand();
        if (m_makeExecutable.isEmpty())
            return false;
    } else {
        m_makeExecutable.clear();
    }

    QString makefile = workingDirectory;

    if (qmakeBc->subNodeBuild()) {
        if (!qmakeBc->subNodeBuild()->makefile().isEmpty())
            makefile.append(qmakeBc->subNodeBuild()->makefile());
        else
            makefile.append(QLatin1String("/Makefile"));
    } else if (!qmakeBc->makefile().isEmpty()) {
        makefile.append(QLatin1Char('/'));
        makefile.append(qmakeBc->makefile());
    } else {
        makefile.append(QLatin1String("/Makefile"));
    }

    // Check whether we need to run qmake
    bool makefileOutDated = (qmakeBc->compareToImportFrom(makefile) != QmakeBuildConfiguration::MakefileMatches);
    if (m_forced || makefileOutDated)
        m_needToRunQMake = true;
    m_forced = false;

    ProcessParameters *pp = processParameters();
    pp->setMacroExpander(qmakeBc->macroExpander());
    pp->setWorkingDirectory(workingDirectory);
    pp->setEnvironment(qmakeBc->environment());

    setOutputParser(new QMakeParser);

    QmakeProFileNode *node = static_cast<QmakeProject *>(qmakeBc->target()->project())->rootProjectNode();
    if (qmakeBc->subNodeBuild())
        node = qmakeBc->subNodeBuild();
    QString proFile = node->filePath().toString();

    QList<ProjectExplorer::Task> tasks = qtVersion->reportIssues(proFile, workingDirectory);
    Utils::sort(tasks);

    if (!tasks.isEmpty()) {
        bool canContinue = true;
        foreach (const ProjectExplorer::Task &t, tasks) {
            addTask(t);
            if (t.type == Task::Error)
                canContinue = false;
        }