Commit 499a49b6 authored by Tobias Hunger's avatar Tobias Hunger

qmake: Skip running qmake when using non-default tool chains

Do not rerun qmake when using a tool chain which requires a
non-standard mkspec to be used.

Change-Id: I6171790805743251a7867111faa46bd4d4cc890d
Reviewed-on: http://codereview.qt.nokia.com/314Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 0bbc59c5
......@@ -121,7 +121,6 @@ Qt4BuildConfiguration *QMakeStep::qt4BuildConfiguration() const
/// user arguments
QString QMakeStep::allArguments(bool shorted)
{
QString additonalArguments = m_userArgs;
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
QStringList arguments;
if (bc->subNodeBuild())
......@@ -131,24 +130,19 @@ QString QMakeStep::allArguments(bool shorted)
buildConfiguration()->target()->project()->file()->fileName()).fileName());
else
arguments << QDir::toNativeSeparators(buildConfiguration()->target()->project()->file()->fileName());
arguments << "-r";
bool haveSpec = false;
for (Utils::QtcProcess::ArgIterator ait(&additonalArguments); ait.next(); )
if (ait.value() == QLatin1String("-spec"))
haveSpec = true;
if (!haveSpec) {
const QString tcSpec = bc->toolChain() ? bc->toolChain()->mkspec() : QString();
if (tcSpec.isEmpty()) {
if (bc->qtVersion())
arguments << "-spec" << bc->qtVersion()->mkspec();
} else if (!bc->qtVersion() || bc->qtVersion()->hasMkspec(tcSpec)) {
arguments << "-spec" << tcSpec;
} else {
arguments << "-spec" << bc->qtVersion()->mkspec();
arguments << "-r";
bool userProvidedMkspec = false;
for (Utils::QtcProcess::ConstArgIterator ait(&m_userArgs); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) {
if (ait.next()) {
userProvidedMkspec = true;
break;
}
}
}
if (!userProvidedMkspec)
arguments << "-spec" << mkspec();
// Find out what flags we pass on to qmake
arguments << bc->configCommandLineArguments();
......@@ -156,7 +150,7 @@ QString QMakeStep::allArguments(bool shorted)
arguments << moreArguments();
QString args = Utils::QtcProcess::joinArgs(arguments);
Utils::QtcProcess::addArgs(&args, additonalArguments);
Utils::QtcProcess::addArgs(&args, m_userArgs);
return args;
}
......@@ -434,6 +428,25 @@ QString QMakeStep::userArguments()
return m_userArgs;
}
QString QMakeStep::mkspec()
{
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
QString additionalArguments = m_userArgs;
for (Utils::QtcProcess::ArgIterator ait(&additionalArguments); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) {
if (ait.next())
return ait.value();
}
}
const QString tcSpec = bc->toolChain() ? bc->toolChain()->mkspec() : QString();
if (!bc->qtVersion())
return tcSpec;
if (!tcSpec.isEmpty() && bc->qtVersion()->hasMkspec(tcSpec))
return tcSpec;
return bc->qtVersion()->mkspec();
}
QVariantMap QMakeStep::toMap() const
{
QVariantMap map(AbstractProcessStep::toMap());
......
......@@ -103,6 +103,7 @@ public:
QStringList moreArguments();
QStringList parserArguments();
QString userArguments();
QString mkspec();
void setUserArguments(const QString &arguments);
bool linkQmlDebuggingLibrary() const;
void setLinkQmlDebuggingLibrary(bool enable);
......
......@@ -46,6 +46,7 @@
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h>
#include <qtsupport/qtversionfactory.h>
#include <qtsupport/baseqtversion.h>
......@@ -475,14 +476,8 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
// we have to compare without the spec/platform cmd argument
// and compare that on its own
QString workingDirectory = QFileInfo(makefile).absolutePath();
QString userArgs = qs->userArguments();
QStringList actualArgs;
QString actualSpec = extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs);
if (actualSpec.isEmpty()) {
// Easy one: the user has chosen not to override the settings
actualSpec = version->mkspec();
}
actualArgs += qs->moreArguments();
QStringList actualArgs = qs->moreArguments();
QString actualSpec = qs->mkspec();
QString qmakeArgs = result.second;
QStringList parsedArgs;
......@@ -830,23 +825,19 @@ void Qt4BuildConfiguration::importFromBuildDirectory()
QtSupport::QtVersionManager::scanMakeFile(mkfile, version->defaultBuildConfig());
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfig = result.first;
QString aa = result.second;
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&aa, directory, version);
QString versionSpec = version->mkspec();
QString additionalArguments;
if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
// using the default spec, don't modify additional arguments
} else {
additionalArguments = "-spec " + Utils::QtcProcess::quoteArg(parsedSpec);
}
Utils::QtcProcess::addArgs(&additionalArguments, aa);
QString additionalArguments = result.second;
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
// So we got all the information now apply it...
setQtVersion(version);
qmakeStep()->setUserArguments(additionalArguments);
QMakeStep *qs = qmakeStep();
qs->setUserArguments(additionalArguments);
if (!parsedSpec.isEmpty() && parsedSpec != QLatin1String("default") && qs->mkspec() != parsedSpec) {
Utils::QtcProcess::addArgs(&additionalArguments, (QStringList() << "-spec" << parsedSpec));
qs->setUserArguments(additionalArguments);
}
setQMakeBuildConfiguration(qmakeBuildConfig);
// Adjust command line arguments, this is ugly as hell
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment