summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-08-21 17:08:20 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-09-03 17:57:56 +0200
commitc4ec7942f0147fad28914e65ffbb93f67d430278 (patch)
tree093129d44a9122863baa4a584a9505f318d6a52b /src
parent5af04e6b297c572e5b420854ef0f7a8dc138d516 (diff)
downloadqt-creator-c4ec7942f0147fad28914e65ffbb93f67d430278.tar.gz
add support for extra vars and extra configs
will be needed for qmake build passes Change-Id: I6c887abd8e9e858954ce90c60ccdd1b70b6aeee3 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/shared/proparser/qmakeevaluator.cpp20
-rw-r--r--src/shared/proparser/qmakeevaluator.h9
2 files changed, 29 insertions, 0 deletions
diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp
index 4ea3ad45f1..42121af0c8 100644
--- a/src/shared/proparser/qmakeevaluator.cpp
+++ b/src/shared/proparser/qmakeevaluator.cpp
@@ -1279,6 +1279,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
loadDefaults();
}
+#ifdef QT_BUILD_QMAKE
+ for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
+ it != m_extraVars.constEnd(); ++it)
+ m_valuemapStack[0].insert(it.key(), it.value());
+#endif
+
m_handler->aboutToEval(currentProFile(), pro, type);
m_profileStack.push(pro);
valuesRef(ProKey("PWD")) = ProStringList(ProString(currentDirectory()));
@@ -1288,6 +1294,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
evaluateFeatureFile(QLatin1String("default_pre.prf"));
evaluateCommand(m_option->precmds, fL1S("(command line)"));
+
+#ifdef QT_BUILD_QMAKE
+ // After user configs, to override them
+ if (!m_extraConfigs.isEmpty())
+ evaluateCommand("CONFIG += " + m_extraConfigs.join(" "), fL1S("(extra configs)"));
+#endif
}
debugMsg(1, "visiting file %s", qPrintable(pro->fileName()));
@@ -1297,6 +1309,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
if (flags & LoadPostFiles) {
evaluateCommand(m_option->postcmds, fL1S("(command line -after)"));
+#ifdef QT_BUILD_QMAKE
+ // 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("CONFIG += " + m_extraConfigs.join(" "), fL1S("(extra configs)"));
+#endif
+
evaluateFeatureFile(QLatin1String("default_post.prf"));
QSet<QString> processed;
diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h
index 30457fc2da..cdc5096c0e 100644
--- a/src/shared/proparser/qmakeevaluator.h
+++ b/src/shared/proparser/qmakeevaluator.h
@@ -89,6 +89,11 @@ public:
QMakeHandler *handler);
~QMakeEvaluator();
+#ifdef QT_BUILD_QMAKE
+ void setExtraVars(const ProValueMap &extraVars) { m_extraVars = extraVars; }
+ void setExtraConfigs(const ProStringList &extraConfigs) { m_extraConfigs = extraConfigs; }
+#endif
+
ProStringList values(const ProKey &variableName) const;
ProStringList &valuesRef(const ProKey &variableName);
ProString first(const ProKey &variableName) const;
@@ -232,6 +237,10 @@ public:
QStack<Location> m_locationStack; // All execution location changes
QStack<ProFile *> m_profileStack; // Includes only
+#ifdef QT_BUILD_QMAKE
+ ProValueMap m_extraVars;
+ ProStringList m_extraConfigs;
+#endif
QString m_outputDir;
int m_listCount;