summaryrefslogtreecommitdiff
path: root/src/shared/proparser/qmakeevaluator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/proparser/qmakeevaluator.cpp')
-rw-r--r--src/shared/proparser/qmakeevaluator.cpp49
1 files changed, 36 insertions, 13 deletions
diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp
index ed1d0a619e..0df4406391 100644
--- a/src/shared/proparser/qmakeevaluator.cpp
+++ b/src/shared/proparser/qmakeevaluator.cpp
@@ -109,6 +109,7 @@ void QMakeEvaluator::initStatics()
statics.strfalse = QLatin1String("false");
statics.strCONFIG = ProKey("CONFIG");
statics.strARGS = ProKey("ARGS");
+ statics.strARGC = ProKey("ARGC");
statics.strDot = QLatin1String(".");
statics.strDotDot = QLatin1String("..");
statics.strever = QLatin1String("ever");
@@ -116,6 +117,7 @@ void QMakeEvaluator::initStatics()
statics.strhost_build = QLatin1String("host_build");
statics.strTEMPLATE = ProKey("TEMPLATE");
statics.strQMAKE_PLATFORM = ProKey("QMAKE_PLATFORM");
+ statics.strQMAKESPEC = ProKey("QMAKESPEC");
#ifdef PROEVALUATOR_FULL
statics.strREQUIRES = ProKey("REQUIRES");
#endif
@@ -931,6 +933,12 @@ void QMakeEvaluator::visitProVariable(
setTemplate();
else if (varName == statics.strQMAKE_PLATFORM)
m_featureRoots = 0;
+ else if (varName == statics.strQMAKESPEC) {
+ if (!values(varName).isEmpty()) {
+ m_qmakespec = values(varName).first().toQString();
+ m_featureRoots = 0;
+ }
+ }
#ifdef PROEVALUATOR_FULL
else if (varName == statics.strREQUIRES)
checkRequirements(values(varName));
@@ -967,6 +975,8 @@ void QMakeEvaluator::loadDefaults()
vars[ProKey("_DATE_")] << ProString(QDateTime::currentDateTime().toString());
if (!m_option->qmake_abslocation.isEmpty())
vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation);
+ if (!m_option->qmake_args.isEmpty())
+ vars[ProKey("QMAKE_ARGS")] = ProStringList(m_option->qmake_args);
#if defined(Q_OS_WIN32)
vars[ProKey("QMAKE_HOST.os")] << ProString("Windows");
@@ -1152,7 +1162,7 @@ bool QMakeEvaluator::loadSpecInternal()
m_qmakespec = orig_spec.toQString();
# endif
#endif
- valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespec);
+ valuesRef(ProKey("QMAKESPEC")) = ProString(m_qmakespec);
m_qmakespecName = IoUtils::fileName(m_qmakespec).toString();
// This also ensures that m_featureRoots is valid.
if (evaluateFeatureFile(QLatin1String("spec_post.prf")) != ReturnTrue)
@@ -1263,6 +1273,14 @@ void QMakeEvaluator::evaluateCommand(const QString &cmds, const QString &where)
}
}
+void QMakeEvaluator::applyExtraConfigs()
+{
+ if (m_extraConfigs.isEmpty())
+ return;
+
+ evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(QLatin1Char(' ')), fL1S("(extra configs)"));
+}
+
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConfigFeatures()
{
QSet<QString> processed;
@@ -1357,10 +1375,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
loadDefaults();
}
- for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
- it != m_extraVars.constEnd(); ++it)
- m_valuemapStack.first().insert(it.key(), it.value());
-
VisitReturn vr;
m_handler->aboutToEval(currentProFile(), pro, type);
@@ -1369,14 +1383,23 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
if (flags & LoadPreFiles) {
setupProject();
+ for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
+ it != m_extraVars.constEnd(); ++it)
+ m_valuemapStack.first().insert(it.key(), it.value());
+
+ // In case default_pre needs to make decisions based on the current
+ // build pass configuration.
+ applyExtraConfigs();
+
if ((vr = evaluateFeatureFile(QLatin1String("default_pre.prf"))) == ReturnError)
goto failed;
- evaluateCommand(m_option->precmds, fL1S("(command line)"));
+ if (!m_option->precmds.isEmpty()) {
+ evaluateCommand(m_option->precmds, fL1S("(command line)"));
- // After user configs, to override them
- if (!m_extraConfigs.isEmpty())
- evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(QLatin1Char(' ')), fL1S("(extra configs)"));
+ // Again, after user configs, to override them
+ applyExtraConfigs();
+ }
}
debugMsg(1, "visiting file %s", qPrintable(pro->fileName()));
@@ -1390,8 +1413,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
// Again, to ensure the project does not mess with us.
// Specifically, do not allow a project to override debug/release within a
// debug_and_release build pass - it's too late for that at this point anyway.
- if (!m_extraConfigs.isEmpty())
- evaluateCommand(fL1S("CONFIG += ") + m_extraConfigs.join(QLatin1Char(' ')), fL1S("(extra configs)"));
+ applyExtraConfigs();
if ((vr = evaluateFeatureFile(QLatin1String("default_post.prf"))) == ReturnError)
goto failed;
@@ -1444,8 +1466,8 @@ void QMakeEvaluator::updateFeaturePaths()
feature_roots += m_qmakefeatures;
- feature_roots += m_option->propertyValue(ProKey("QMAKEFEATURES")).toQString(m_mtmp).split(
- m_option->dirlist_sep, QString::SkipEmptyParts);
+ feature_roots += m_option->splitPathList(
+ m_option->propertyValue(ProKey("QMAKEFEATURES")).toQString(m_mtmp));
QStringList feature_bases;
if (!m_buildRoot.isEmpty()) {
@@ -1635,6 +1657,7 @@ ProStringList QMakeEvaluator::evaluateFunction(
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
}
m_valuemapStack.top()[statics.strARGS] = args;
+ m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.count())));
vr = visitProBlock(func.pro(), func.tokPtr());
if (vr == ReturnReturn)
vr = ReturnTrue;