forked from qt-creator/qt-creator
Give our Profile parser more information from the qmakestep
e.g. DEFINES+=bla on the qmakestep command line now work Task-Nr: QTCREATORBUG-2091
This commit is contained in:
@@ -115,18 +115,7 @@ QStringList QMakeStep::allArguments()
|
||||
arguments << "-spec" << bc->qtVersion()->mkspec();
|
||||
|
||||
// Find out what flags we pass on to qmake
|
||||
QStringList addedUserConfigArguments;
|
||||
QStringList removedUserConfigArguments;
|
||||
bc->getConfigCommandLineArguments(&addedUserConfigArguments, &removedUserConfigArguments);
|
||||
if (!removedUserConfigArguments.isEmpty()) {
|
||||
foreach (const QString &removedConfig, removedUserConfigArguments)
|
||||
arguments.append("CONFIG-=" + removedConfig);
|
||||
}
|
||||
if (!addedUserConfigArguments.isEmpty()) {
|
||||
foreach (const QString &addedConfig, addedUserConfigArguments)
|
||||
arguments.append("CONFIG+=" + addedConfig);
|
||||
}
|
||||
|
||||
arguments << bc->configCommandLineArguments();
|
||||
arguments << moreArguments();
|
||||
|
||||
if (!additonalArguments.isEmpty())
|
||||
@@ -286,6 +275,17 @@ void QMakeStep::setUserArguments(const QStringList &arguments)
|
||||
emit userArgumentsChanged();
|
||||
|
||||
qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged();
|
||||
qt4BuildConfiguration()->emitProFileEvaluteNeeded();
|
||||
}
|
||||
|
||||
QStringList QMakeStep::parserArguments()
|
||||
{
|
||||
QStringList result;
|
||||
foreach (const QString &str, allArguments()) {
|
||||
if (str.contains("="))
|
||||
result << str;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList QMakeStep::userArguments()
|
||||
|
||||
@@ -88,6 +88,7 @@ public:
|
||||
// TODO clean up those functions
|
||||
QStringList allArguments();
|
||||
QStringList moreArguments();
|
||||
QStringList parserArguments();
|
||||
QStringList userArguments();
|
||||
void setUserArguments(const QStringList &arguments);
|
||||
|
||||
|
||||
@@ -363,6 +363,11 @@ void Qt4BuildConfiguration::setQMakeBuildConfiguration(QtVersion::QmakeBuildConf
|
||||
emit qmakeBuildConfigurationChanged();
|
||||
}
|
||||
|
||||
void Qt4BuildConfiguration::emitProFileEvaluteNeeded()
|
||||
{
|
||||
emit proFileEvaluateNeeded(this);
|
||||
}
|
||||
|
||||
void Qt4BuildConfiguration::emitQMakeBuildConfigurationChanged()
|
||||
{
|
||||
emit qmakeBuildConfigurationChanged();
|
||||
@@ -379,26 +384,25 @@ void Qt4BuildConfiguration::emitS60CreatesSmartInstallerChanged()
|
||||
}
|
||||
|
||||
|
||||
void Qt4BuildConfiguration::getConfigCommandLineArguments(QStringList *addedUserConfigs, QStringList *removedUserConfigs) const
|
||||
QStringList Qt4BuildConfiguration::configCommandLineArguments() const
|
||||
{
|
||||
QStringList result;
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion()->defaultBuildConfig();
|
||||
QtVersion::QmakeBuildConfigs userBuildConfiguration = m_qmakeBuildConfiguration;
|
||||
if (removedUserConfigs) {
|
||||
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(userBuildConfiguration & QtVersion::BuildAll))
|
||||
(*removedUserConfigs) << "debug_and_release";
|
||||
}
|
||||
if (addedUserConfigs) {
|
||||
result << "CONFIG-=debug_and_release";
|
||||
|
||||
if (!(defaultBuildConfiguration & QtVersion::BuildAll) && (userBuildConfiguration & QtVersion::BuildAll))
|
||||
(*addedUserConfigs) << "debug_and_release";
|
||||
result << "CONFIG+=debug_and_release";
|
||||
if ((defaultBuildConfiguration & QtVersion::DebugBuild)
|
||||
&& !(userBuildConfiguration & QtVersion::DebugBuild)
|
||||
&& !(userBuildConfiguration & QtVersion::BuildAll))
|
||||
(*addedUserConfigs) << "release";
|
||||
result << "CONFIG+=release";
|
||||
if (!(defaultBuildConfiguration & QtVersion::DebugBuild)
|
||||
&& (userBuildConfiguration & QtVersion::DebugBuild)
|
||||
&& !(userBuildConfiguration & QtVersion::BuildAll))
|
||||
(*addedUserConfigs) << "debug";
|
||||
}
|
||||
result << "CONFIG+=debug";
|
||||
return result;
|
||||
}
|
||||
|
||||
QMakeStep *Qt4BuildConfiguration::qmakeStep() const
|
||||
|
||||
@@ -76,6 +76,9 @@ public:
|
||||
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfiguration() const;
|
||||
void setQMakeBuildConfiguration(QtVersion::QmakeBuildConfigs config);
|
||||
|
||||
/// \internal for qmakestep
|
||||
void emitProFileEvaluteNeeded();
|
||||
// used by qmake step to notify that the qmake args have changed
|
||||
// not really nice, the build configuration should save the arguments
|
||||
// since they are needed for reevaluation
|
||||
@@ -87,7 +90,7 @@ public:
|
||||
// not really nice
|
||||
void emitS60CreatesSmartInstallerChanged();
|
||||
|
||||
void getConfigCommandLineArguments(QStringList *addedUserConfigs, QStringList *removedUserConfigs) const;
|
||||
QStringList configCommandLineArguments() const;
|
||||
|
||||
// Those functions are used in a few places.
|
||||
// The drawback is that we shouldn't actually depend on them being always there
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qtuicodemodelsupport.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "qmakestep.h"
|
||||
|
||||
#include <projectexplorer/nodesvisitor.h>
|
||||
|
||||
@@ -1311,12 +1312,13 @@ void Qt4ProFileNode::setupReader()
|
||||
m_readerCumulative = m_project->createProFileReader(this);
|
||||
|
||||
// Find out what flags we pass on to qmake
|
||||
QStringList addedUserConfigArguments;
|
||||
QStringList removedUserConfigArguments;
|
||||
m_project->activeTarget()->activeBuildConfiguration()->getConfigCommandLineArguments(&addedUserConfigArguments, &removedUserConfigArguments);
|
||||
|
||||
m_readerExact->setConfigCommandLineArguments(addedUserConfigArguments, removedUserConfigArguments);
|
||||
m_readerCumulative->setConfigCommandLineArguments(addedUserConfigArguments, removedUserConfigArguments);
|
||||
QStringList args;
|
||||
if (QMakeStep *qs = m_project->activeTarget()->activeBuildConfiguration()->qmakeStep())
|
||||
args = qs->parserArguments();
|
||||
else
|
||||
args = m_project->activeTarget()->activeBuildConfiguration()->configCommandLineArguments();
|
||||
m_readerExact->setCommandLineArguments(args);
|
||||
m_readerCumulative->setCommandLineArguments(args);
|
||||
}
|
||||
|
||||
bool Qt4ProFileNode::evaluate()
|
||||
|
||||
@@ -224,8 +224,7 @@ public:
|
||||
QHash<const ProFile*, QHash<ProString, ProStringList> > m_filevaluemap; // Variables per include file
|
||||
QString m_tmp1, m_tmp2, m_tmp3, m_tmp[2]; // Temporaries for efficient toQString
|
||||
|
||||
QStringList m_addUserConfigCmdArgs;
|
||||
QStringList m_removeUserConfigCmdArgs;
|
||||
QStringList m_cmdArgs;
|
||||
|
||||
ProFileOption *m_option;
|
||||
ProFileParser *m_parser;
|
||||
@@ -1274,11 +1273,13 @@ ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile(
|
||||
if (tgt.isEmpty())
|
||||
tgt.append(ProString(QFileInfo(pro->fileName()).baseName(), NoHash));
|
||||
|
||||
ProStringList &tmp = m_valuemapStack.top()[ProString("CONFIG")];
|
||||
foreach (const QString &add, m_addUserConfigCmdArgs)
|
||||
tmp.append(ProString(add, NoHash));
|
||||
foreach (const QString &remove, m_removeUserConfigCmdArgs)
|
||||
removeAll(&tmp, ProString(remove, NoHash));
|
||||
if (ProFile *pro = m_parser->parsedProFile(
|
||||
fL1S("(command line)"), false, m_cmdArgs.join(fL1S("\n")))) {
|
||||
m_locationStack.push(m_current);
|
||||
visitProBlock(pro, pro->tokPtr());
|
||||
m_current = m_locationStack.pop();
|
||||
pro->deref();
|
||||
}
|
||||
}
|
||||
|
||||
visitProBlock(pro, pro->tokPtr());
|
||||
@@ -3217,10 +3218,9 @@ void ProFileEvaluator::setOutputDir(const QString &dir)
|
||||
d->m_outputDir = dir;
|
||||
}
|
||||
|
||||
void ProFileEvaluator::setConfigCommandLineArguments(const QStringList &addUserConfigCmdArgs, const QStringList &removeUserConfigCmdArgs)
|
||||
void ProFileEvaluator::setCommandLineArguments(const QStringList &args)
|
||||
{
|
||||
d->m_addUserConfigCmdArgs = addUserConfigCmdArgs;
|
||||
d->m_removeUserConfigCmdArgs = removeUserConfigCmdArgs;
|
||||
d->m_cmdArgs = args;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
|
||||
// -nocache, -cache, -spec, QMAKESPEC
|
||||
// -set persistent value
|
||||
void setConfigCommandLineArguments(const QStringList &addUserConfigCmdArgs, const QStringList &removeUserConfigCmdArgs);
|
||||
void setCommandLineArguments(const QStringList &args);
|
||||
|
||||
enum LoadFlag {
|
||||
LoadProOnly = 0,
|
||||
|
||||
Reference in New Issue
Block a user