forked from qt-creator/qt-creator
QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with parameter "-query". Qt Creator, so far, assumes that building and querying with a Qt installation are done with one and the same tool: qmake. This change adds the ability to register a Qt version vie either qmake or qtpaths and still build with qmake, if that is installed (which is not anymore mandatory from Qt 6 on). 1) Distinguish between Qt query tool and qmake build tool: Add QtVersion::queryToolFilePath() to the existing QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query" related code, and qmakeFilePath when building with qmake (e.g. in QmakeProjectManager). Also, a couple of functions and variables were renamed from *qmake* to *queryTool* in order to express that the affected code is about querying/managing Qt versions rather than about building with qmake. 2) Support manual Qt Version adding by qtpaths via file dialog This change adds qtpaths to the "Add" Qt Version file picker filter. After selection, "qtpaths -query" is executed for testing purposes. If that fails, (e.g. because it is an older Qt version), qmake is instead chosen, silently. Task-number: QTCREATORBUG-22175 Task-number: QTCREATORBUG-25546 Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -103,7 +103,8 @@ QMakeStep::QMakeStep(BuildStepList *bsl, Id id)
|
||||
auto updateSummary = [this] {
|
||||
QtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit());
|
||||
if (!qtVersion)
|
||||
return tr("<b>qmake:</b> No Qt version set. Cannot run qmake.");
|
||||
return tr("<b>Query tool:</b> No Qt version set. "
|
||||
"Cannot run neither qmake nor qtpaths.");
|
||||
const QString program = qtVersion->qmakeFilePath().fileName();
|
||||
return tr("<b>qmake:</b> %1 %2").arg(program, project()->projectFilePath().fileName());
|
||||
};
|
||||
@@ -164,7 +165,7 @@ QString QMakeStep::allArguments(const QtVersion *v, ArgumentFlags flags) const
|
||||
QString args = ProcessArgs::joinArgs(arguments);
|
||||
// User arguments
|
||||
ProcessArgs::addArgs(&args, userArguments());
|
||||
for (QString arg : qAsConst(m_extraArgs))
|
||||
for (const QString &arg : qAsConst(m_extraArgs))
|
||||
ProcessArgs::addArgs(&args, arg);
|
||||
return (flags & ArgumentFlag::Expand) ? bc->macroExpander()->expand(args) : args;
|
||||
}
|
||||
@@ -214,7 +215,8 @@ bool QMakeStep::init()
|
||||
else
|
||||
workingDirectory = qmakeBc->buildDirectory();
|
||||
|
||||
m_qmakeCommand = CommandLine{qtVersion->qmakeFilePath(), allArguments(qtVersion), CommandLine::Raw};
|
||||
m_qmakeCommand =
|
||||
CommandLine{qtVersion->qmakeFilePath(), allArguments(qtVersion), CommandLine::Raw};
|
||||
m_runMakeQmake = (qtVersion->qtVersion() >= QtVersionNumber(5, 0 ,0));
|
||||
|
||||
// The Makefile is used by qmake and make on the build device, from that
|
||||
|
||||
Reference in New Issue
Block a user