forked from qt-creator/qt-creator
Qmake: Run make qmake_all in the directory that qmake ran in
Call make qmake_all in the same directory that qmake was run in. This fixes long build times when doing builds of individual targets. Qmake is run in a child folder there, but make qmake_all used to be run in the top-level source directory instead. Task-number: QTCREATORBUG-20823 Change-Id: I42e77738b0a92469efb97720cabea26484fb4852 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -187,19 +187,6 @@ bool QMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
m_qmakeExecutable = qtVersion->qmakeCommand().toString();
|
m_qmakeExecutable = qtVersion->qmakeCommand().toString();
|
||||||
m_qmakeArguments = allArguments(qtVersion);
|
m_qmakeArguments = allArguments(qtVersion);
|
||||||
m_runMakeQmake = (qtVersion->qtVersion() >= QtVersionNumber(5, 0 ,0));
|
m_runMakeQmake = (qtVersion->qtVersion() >= QtVersionNumber(5, 0 ,0));
|
||||||
if (m_runMakeQmake) {
|
|
||||||
m_makeExecutable = makeCommand();
|
|
||||||
if (m_makeExecutable.isEmpty()) {
|
|
||||||
emit addOutput(tr("Could not determine which \"make\" command to run. "
|
|
||||||
"Check the \"make\" step in the build configuration."),
|
|
||||||
BuildStep::OutputFormat::ErrorMessage);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
m_makeArguments = makeArguments();
|
|
||||||
} else {
|
|
||||||
m_makeExecutable.clear();
|
|
||||||
m_makeArguments.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString makefile = workingDirectory + '/';
|
QString makefile = workingDirectory + '/';
|
||||||
|
|
||||||
@@ -215,6 +202,20 @@ bool QMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
makefile.append("Makefile");
|
makefile.append("Makefile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_runMakeQmake) {
|
||||||
|
m_makeExecutable = makeCommand();
|
||||||
|
if (m_makeExecutable.isEmpty()) {
|
||||||
|
emit addOutput(tr("Could not determine which \"make\" command to run. "
|
||||||
|
"Check the \"make\" step in the build configuration."),
|
||||||
|
BuildStep::OutputFormat::ErrorMessage);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_makeArguments = makeArguments(makefile);
|
||||||
|
} else {
|
||||||
|
m_makeExecutable.clear();
|
||||||
|
m_makeArguments.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether we need to run qmake
|
// Check whether we need to run qmake
|
||||||
bool makefileOutDated = (qmakeBc->compareToImportFrom(makefile) != QmakeBuildConfiguration::MakefileMatches);
|
bool makefileOutDated = (qmakeBc->compareToImportFrom(makefile) != QmakeBuildConfiguration::MakefileMatches);
|
||||||
if (m_forced || makefileOutDated)
|
if (m_forced || makefileOutDated)
|
||||||
@@ -454,15 +455,12 @@ QString QMakeStep::makeCommand() const
|
|||||||
return ms ? ms->effectiveMakeCommand() : QString();
|
return ms ? ms->effectiveMakeCommand() : QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QMakeStep::makeArguments() const
|
QString QMakeStep::makeArguments(const QString &makefile) const
|
||||||
{
|
{
|
||||||
QString args;
|
QString args;
|
||||||
if (QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration()) {
|
if (!makefile.isEmpty()) {
|
||||||
const QString makefile = qmakeBc->makefile();
|
Utils::QtcProcess::addArg(&args, "-f");
|
||||||
if (!makefile.isEmpty()) {
|
Utils::QtcProcess::addArg(&args, makefile);
|
||||||
Utils::QtcProcess::addArg(&args, "-f");
|
|
||||||
Utils::QtcProcess::addArg(&args, makefile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Utils::QtcProcess::addArg(&args, "qmake_all");
|
Utils::QtcProcess::addArg(&args, "qmake_all");
|
||||||
return args;
|
return args;
|
||||||
@@ -480,9 +478,11 @@ QString QMakeStep::effectiveQMakeCall() const
|
|||||||
|
|
||||||
QString result = qmake;
|
QString result = qmake;
|
||||||
if (qtVersion) {
|
if (qtVersion) {
|
||||||
|
QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration();
|
||||||
|
const QString makefile = qmakeBc ? qmakeBc->makefile() : QString();
|
||||||
result += ' ' + allArguments(qtVersion, ArgumentFlag::Expand);
|
result += ' ' + allArguments(qtVersion, ArgumentFlag::Expand);
|
||||||
if (qtVersion->qtVersion() >= QtVersionNumber(5, 0, 0))
|
if (qtVersion->qtVersion() >= QtVersionNumber(5, 0, 0))
|
||||||
result.append(QString::fromLatin1(" && %1 %2").arg(make).arg(makeArguments()));
|
result.append(QString::fromLatin1(" && %1 %2").arg(make).arg(makeArguments(makefile)));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -144,7 +144,7 @@ public:
|
|||||||
void setSeparateDebugInfo(bool enable);
|
void setSeparateDebugInfo(bool enable);
|
||||||
|
|
||||||
QString makeCommand() const;
|
QString makeCommand() const;
|
||||||
QString makeArguments() const;
|
QString makeArguments(const QString &makefile) const;
|
||||||
QString effectiveQMakeCall() const;
|
QString effectiveQMakeCall() const;
|
||||||
|
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
Reference in New Issue
Block a user