move postprocessing of INCLUDEPATH into ProFileEvaluator::accept()

the rationale is that postprocessing which is done by the generators (in
some cases right at the point of emitting code to the makefile) should
be abstracted inside the "medium-level" class which also does the path
resolution done by the generators.

along the way we also make minor fixes to the processing:
- we pay attention to CONFIG+=no_include_pwd
- we add the build dir as well when shadow building

Change-Id: Ib389942fdc0470e05c1aa49e3615b6ac00241662
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen
2014-11-26 17:37:42 +01:00
parent 1304c08764
commit 5a9a24fa3d
5 changed files with 19 additions and 25 deletions

View File

@@ -231,7 +231,6 @@ public:
QStringList newProjectFilesCumlative; QStringList newProjectFilesCumlative;
ProFile *fileForCurrentProjectCumlative; // probably only used in parser thread ProFile *fileForCurrentProjectCumlative; // probably only used in parser thread
TargetInformation targetInformation; TargetInformation targetInformation;
QString resolvedMkspecPath;
InstallsList installsList; InstallsList installsList;
QHash<QmakeVariable, QStringList> newVarValues; QHash<QmakeVariable, QStringList> newVarValues;
bool isDeployable; bool isDeployable;
@@ -1892,7 +1891,6 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
} }
} }
result->targetInformation = targetInformation(input.readerExact, readerBuildPass, input.buildDirectory, input.projectFilePath); result->targetInformation = targetInformation(input.readerExact, readerBuildPass, input.buildDirectory, input.projectFilePath);
result->resolvedMkspecPath = input.readerExact->resolvedMkSpec();
result->installsList = installsList(readerBuildPass, input.projectFilePath, input.projectDir); result->installsList = installsList(readerBuildPass, input.projectFilePath, input.projectDir);
// update other variables // update other variables
@@ -2237,7 +2235,6 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
if (m_validParse) { if (m_validParse) {
// update TargetInformation // update TargetInformation
m_qmakeTargetInformation = result->targetInformation; m_qmakeTargetInformation = result->targetInformation;
m_resolvedMkspecPath = result->resolvedMkspecPath;
m_subProjectsNotToDeploy = result->subProjectsNotToDeploy; m_subProjectsNotToDeploy = result->subProjectsNotToDeploy;
m_installsList = result->installsList; m_installsList = result->installsList;
@@ -2317,13 +2314,10 @@ QStringList QmakeProFileNode::includePaths(QtSupport::ProFileReader *reader, con
} }
paths.append(reader->absolutePathValues(QLatin1String("INCLUDEPATH"), projectDir)); paths.append(reader->absolutePathValues(QLatin1String("INCLUDEPATH"), projectDir));
paths.append(reader->absolutePathValues(QLatin1String("QMAKE_INCDIR"), projectDir));
// paths already contains moc dir and ui dir, due to corrrectly parsing uic.prf and moc.prf // paths already contains moc dir and ui dir, due to corrrectly parsing uic.prf and moc.prf
// except if those directories don't exist at the time of parsing // except if those directories don't exist at the time of parsing
// thus we add those directories manually (without checking for existence) // thus we add those directories manually (without checking for existence)
paths << mocDirPath(reader, buildDir) << uiDirPath(reader, buildDir); paths << mocDirPath(reader, buildDir) << uiDirPath(reader, buildDir);
// qmake always adds "."
paths << projectDir;
paths.removeDuplicates(); paths.removeDuplicates();
return paths; return paths;
} }
@@ -2427,11 +2421,6 @@ TargetInformation QmakeProFileNode::targetInformation() const
return m_qmakeTargetInformation; return m_qmakeTargetInformation;
} }
QString QmakeProFileNode::resolvedMkspecPath() const
{
return m_resolvedMkspecPath;
}
InstallsList QmakeProFileNode::installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath, const QString &projectDir) InstallsList QmakeProFileNode::installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath, const QString &projectDir)
{ {
InstallsList result; InstallsList result;

View File

@@ -415,7 +415,6 @@ public:
QString objectsDirectory() const; QString objectsDirectory() const;
QByteArray cxxDefines() const; QByteArray cxxDefines() const;
bool isDeployable() const; bool isDeployable() const;
QString resolvedMkspecPath() const;
enum AsyncUpdateDelay { ParseNow, ParseLater }; enum AsyncUpdateDelay { ParseNow, ParseLater };
void scheduleUpdate(AsyncUpdateDelay delay); void scheduleUpdate(AsyncUpdateDelay delay);
@@ -473,7 +472,6 @@ private:
QMap<QString, QDateTime> m_uitimestamps; QMap<QString, QDateTime> m_uitimestamps;
TargetInformation m_qmakeTargetInformation; TargetInformation m_qmakeTargetInformation;
QString m_resolvedMkspecPath;
QStringList m_subProjectsNotToDeploy; QStringList m_subProjectsNotToDeploy;
InstallsList m_installsList; InstallsList m_installsList;

View File

@@ -538,10 +538,6 @@ void QmakeProject::updateCppCodeModel()
} }
} }
if (QmakeProFileNode *node = rootQmakeProjectNode())
templatePart->headerPaths += ProjectPart::HeaderPath(node->resolvedMkspecPath(),
ProjectPart::HeaderPath::IncludePath);
// part->precompiledHeaders // part->precompiledHeaders
templatePart->precompiledHeaders.append(pro->variableValue(PrecompiledHeaderVar)); templatePart->precompiledHeaders.append(pro->variableValue(PrecompiledHeaderVar));

View File

@@ -197,7 +197,25 @@ bool ProFileEvaluator::loadNamedSpec(const QString &specDir, bool hostSpec)
bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags) bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
{ {
return d->visitProFile(pro, QMakeHandler::EvalProjectFile, flags) == QMakeEvaluator::ReturnTrue; if (d->visitProFile(pro, QMakeHandler::EvalProjectFile, flags) != QMakeEvaluator::ReturnTrue)
return false;
if (flags & QMakeEvaluator::LoadPostFiles) {
// This is postprocessing which is hard-coded inside qmake's generators.
ProStringList &incpath = d->valuesRef(ProKey("INCLUDEPATH"));
incpath += d->values(ProKey("QMAKE_INCDIR"));
if (!d->isActiveConfig(QStringLiteral("no_include_pwd"))) {
incpath.prepend(ProString(pro->directoryName()));
// It's pretty stupid that this is appended - it should be the second entry.
if (pro->directoryName() != d->m_outputDir)
incpath << ProString(d->m_outputDir);
}
// The location of this is inconsistent among generators.
incpath << ProString(d->m_qmakespec);
}
return true;
} }
QString ProFileEvaluator::propertyValue(const QString &name) const QString ProFileEvaluator::propertyValue(const QString &name) const
@@ -205,11 +223,6 @@ QString ProFileEvaluator::propertyValue(const QString &name) const
return d->m_option->propertyValue(ProKey(name)).toQString(); return d->m_option->propertyValue(ProKey(name)).toQString();
} }
QString ProFileEvaluator::resolvedMkSpec() const
{
return d->m_qmakespec;
}
#ifdef PROEVALUATOR_CUMULATIVE #ifdef PROEVALUATOR_CUMULATIVE
void ProFileEvaluator::setCumulative(bool on) void ProFileEvaluator::setCumulative(bool on)
{ {

View File

@@ -93,8 +93,6 @@ public:
const ProFile *pro) const; const ProFile *pro) const;
QString propertyValue(const QString &val) const; QString propertyValue(const QString &val) const;
QString resolvedMkSpec() const;
private: private:
QString sysrootify(const QString &path, const QString &baseDir) const; QString sysrootify(const QString &path, const QString &baseDir) const;