diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-08 15:48:29 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-08 15:49:18 +0100 |
commit | dd756011da13b95fdb630a1bbb90234f1e60f415 (patch) | |
tree | a6259b1e9b6463108796ce912e3d1752e301505f /qmake/library | |
parent | 0c50edbe84914469973a3b10e0170023ccdd66fe (diff) | |
parent | b6bf2a33f4c33a212da7b58a049b3b5b20b3f327 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
configure.json
mkspecs/win32-icc/qmake.conf
Change-Id: Ibf40546b024d644c7d9ed490bee15b82597f4d3f
Diffstat (limited to 'qmake/library')
-rw-r--r-- | qmake/library/qmakeevaluator.cpp | 12 | ||||
-rw-r--r-- | qmake/library/qmakeglobals.cpp | 33 | ||||
-rw-r--r-- | qmake/library/qmakeglobals.h | 13 |
3 files changed, 33 insertions, 25 deletions
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 4b3eeb4e7a..b0ed01e3aa 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -1430,6 +1430,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( if (flags & LoadPreFiles) { setupProject(); + if (!m_option->extra_cmds[QMakeEvalEarly].isEmpty()) + evaluateCommand(m_option->extra_cmds[QMakeEvalEarly], fL1S("(command line -early)")); + for (ProValueMap::ConstIterator it = m_extraVars.constBegin(); it != m_extraVars.constEnd(); ++it) m_valuemapStack.first().insert(it.key(), it.value()); @@ -1441,8 +1444,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( if ((vr = evaluateFeatureFile(QLatin1String("default_pre.prf"))) == ReturnError) goto failed; - if (!m_option->precmds.isEmpty()) { - evaluateCommand(m_option->precmds, fL1S("(command line)")); + if (!m_option->extra_cmds[QMakeEvalBefore].isEmpty()) { + evaluateCommand(m_option->extra_cmds[QMakeEvalBefore], fL1S("(command line)")); // Again, after user configs, to override them applyExtraConfigs(); @@ -1455,7 +1458,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( debugMsg(1, "done visiting file %s", qPrintable(pro->fileName())); if (flags & LoadPostFiles) { - evaluateCommand(m_option->postcmds, fL1S("(command line -after)")); + evaluateCommand(m_option->extra_cmds[QMakeEvalAfter], fL1S("(command line -after)")); // Again, to ensure the project does not mess with us. // Specifically, do not allow a project to override debug/release within a @@ -1465,6 +1468,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( if ((vr = evaluateFeatureFile(QLatin1String("default_post.prf"))) == ReturnError) goto failed; + if (!m_option->extra_cmds[QMakeEvalLate].isEmpty()) + evaluateCommand(m_option->extra_cmds[QMakeEvalLate], fL1S("(command line -late)")); + if ((vr = evaluateConfigFeatures()) == ReturnError) goto failed; } diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index b282b08d5c..b6dc8b20b6 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -111,10 +111,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( QString arg = args.at(*pos); switch (argState) { case ArgConfig: - if (state.after) - state.postconfigs << arg; - else - state.preconfigs << arg; + state.configs[state.phase] << arg; break; case ArgSpec: qmakespec = args[*pos] = cleanSpec(state, arg); @@ -141,8 +138,14 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( args.erase(args.begin() + *pos, args.end()); return ArgumentsOk; } - if (arg == QLatin1String("-after")) - state.after = true; + if (arg == QLatin1String("-early")) + state.phase = QMakeEvalEarly; + else if (arg == QLatin1String("-before")) + state.phase = QMakeEvalBefore; + else if (arg == QLatin1String("-after")) + state.phase = QMakeEvalAfter; + else if (arg == QLatin1String("-late")) + state.phase = QMakeEvalLate; else if (arg == QLatin1String("-config")) argState = ArgConfig; else if (arg == QLatin1String("-nocache")) @@ -166,10 +169,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( else return ArgumentUnknown; } else if (arg.contains(QLatin1Char('='))) { - if (state.after) - state.postcmds << arg; - else - state.precmds << arg; + state.cmds[state.phase] << arg; } else { return ArgumentUnknown; } @@ -184,18 +184,17 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state) { - if (!state.preconfigs.isEmpty()) - state.precmds << (fL1S("CONFIG += ") + state.preconfigs.join(QLatin1Char(' '))); if (!state.extraargs.isEmpty()) { QString extra = fL1S("QMAKE_EXTRA_ARGS ="); for (const QString &ea : qAsConst(state.extraargs)) extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea)); - state.precmds << extra; + state.cmds[QMakeEvalBefore] << extra; + } + for (int p = 0; p < 4; p++) { + if (!state.configs[p].isEmpty()) + state.cmds[p] << (fL1S("CONFIG += ") + state.configs[p].join(QLatin1Char(' '))); + extra_cmds[p] = state.cmds[p].join(QLatin1Char('\n')); } - precmds = state.precmds.join(QLatin1Char('\n')); - if (!state.postconfigs.isEmpty()) - state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(QLatin1Char(' '))); - postcmds = state.postcmds.join(QLatin1Char('\n')); if (xqmakespec.isEmpty()) xqmakespec = qmakespec; diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h index 86b1d28da4..000f685b73 100644 --- a/qmake/library/qmakeglobals.h +++ b/qmake/library/qmakeglobals.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE class QMakeEvaluator; +enum QMakeEvalPhase { QMakeEvalEarly, QMakeEvalBefore, QMakeEvalAfter, QMakeEvalLate }; + class QMakeBaseKey { public: @@ -83,12 +85,13 @@ public: class QMAKE_EXPORT QMakeCmdLineParserState { public: - QMakeCmdLineParserState(const QString &_pwd) : pwd(_pwd), after(false) {} + QMakeCmdLineParserState(const QString &_pwd) : pwd(_pwd), phase(QMakeEvalBefore) {} QString pwd; - QStringList precmds, preconfigs, postcmds, postconfigs, extraargs; - bool after; + QStringList cmds[4], configs[4]; + QStringList extraargs; + QMakeEvalPhase phase; - void flush() { after = false; } + void flush() { phase = QMakeEvalBefore; } }; class QMAKE_EXPORT QMakeGlobals @@ -110,7 +113,7 @@ public: QString qtconf; QString qmakespec, xqmakespec; QString user_template, user_template_prefix; - QString precmds, postcmds; + QString extra_cmds[4]; #ifdef PROEVALUATOR_DEBUG int debugLevel; |