2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "qmakestep.h"
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2018-05-17 09:37:56 +02:00
|
|
|
#include "qmakemakestep.h"
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakebuildconfiguration.h"
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "qmakekitinformation.h"
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakenodes.h"
|
2016-04-20 09:21:28 +02:00
|
|
|
#include "qmakeparser.h"
|
|
|
|
|
#include "qmakeproject.h"
|
|
|
|
|
#include "qmakeprojectmanagerconstants.h"
|
2019-03-06 10:44:28 +01:00
|
|
|
#include "qmakesettings.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2020-07-14 15:23:26 +03:00
|
|
|
#include <android/androidconstants.h>
|
|
|
|
|
|
2011-06-08 13:32:03 +02:00
|
|
|
#include <projectexplorer/buildmanager.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2016-04-20 09:21:28 +02:00
|
|
|
#include <projectexplorer/gnumakeparser.h>
|
2018-11-17 21:19:04 +02:00
|
|
|
#include <projectexplorer/processparameters.h>
|
2011-06-08 13:32:03 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2020-10-06 14:59:53 +02:00
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2013-06-13 17:10:32 +02:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2014-03-18 16:55:20 +01:00
|
|
|
#include <coreplugin/icontext.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2011-05-20 21:40:53 +02:00
|
|
|
#include <qtsupport/qtversionmanager.h>
|
2015-03-04 17:14:28 +01:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2020-09-18 12:11:40 +02:00
|
|
|
|
Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.
For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.
The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.
Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-22 00:11:58 +02:00
|
|
|
#include <ios/iosconstants.h>
|
|
|
|
|
|
2014-06-16 18:25:52 +04:00
|
|
|
#include <utils/algorithm.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
2020-10-06 08:01:03 +02:00
|
|
|
#include <utils/layoutbuilder.h>
|
2010-10-19 11:14:03 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2016-08-03 17:55:54 +02:00
|
|
|
#include <utils/utilsicons.h>
|
2020-09-18 12:11:40 +02:00
|
|
|
#include <utils/variablechooser.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDir>
|
2019-11-26 10:04:37 +01:00
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QListWidget>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMessageBox>
|
2019-11-26 10:04:37 +01:00
|
|
|
#include <QPlainTextEdit>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
using namespace QtSupport;
|
2008-12-02 12:01:29 +01:00
|
|
|
using namespace ProjectExplorer;
|
2012-08-23 15:53:58 +02:00
|
|
|
using namespace Utils;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
using namespace QmakeProjectManager::Internal;
|
|
|
|
|
|
|
|
|
|
namespace QmakeProjectManager {
|
|
|
|
|
|
2012-11-20 07:18:01 +02:00
|
|
|
const char QMAKE_ARGUMENTS_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeArguments";
|
|
|
|
|
const char QMAKE_FORCED_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeForced";
|
2020-04-17 15:18:27 +02:00
|
|
|
const char QMAKE_SELECTED_ABIS_KEY[] = "QtProjectManager.QMakeBuildStep.SelectedAbis";
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2021-04-23 04:19:14 +02:00
|
|
|
QMakeStep::QMakeStep(BuildStepList *bsl, Id id)
|
2019-12-20 17:05:30 +01:00
|
|
|
: AbstractProcessStep(bsl, id)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2019-10-09 21:29:12 +03:00
|
|
|
setLowPriority();
|
2020-10-05 18:23:17 +02:00
|
|
|
|
2020-10-06 10:00:04 +02:00
|
|
|
m_buildType = addAspect<SelectionAspect>();
|
|
|
|
|
m_buildType->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
|
|
|
|
|
m_buildType->setDisplayName(tr("qmake build configuration:"));
|
|
|
|
|
m_buildType->addOption(tr("Debug"));
|
|
|
|
|
m_buildType->addOption(tr("Release"));
|
|
|
|
|
|
2020-10-06 14:59:53 +02:00
|
|
|
m_userArgs = addAspect<ArgumentsAspect>();
|
|
|
|
|
m_userArgs->setSettingsKey(QMAKE_ARGUMENTS_KEY);
|
|
|
|
|
m_userArgs->setLabelText(tr("Additional arguments:"));
|
|
|
|
|
|
2020-10-06 15:43:14 +02:00
|
|
|
m_effectiveCall = addAspect<StringAspect>();
|
|
|
|
|
m_effectiveCall->setDisplayStyle(StringAspect::TextEditDisplay);
|
|
|
|
|
m_effectiveCall->setLabelText(tr("Effective qmake call:"));
|
|
|
|
|
m_effectiveCall->setReadOnly(true);
|
|
|
|
|
m_effectiveCall->setUndoRedoEnabled(false);
|
|
|
|
|
m_effectiveCall->setEnabled(true);
|
|
|
|
|
|
2020-10-05 18:23:17 +02:00
|
|
|
auto updateSummary = [this] {
|
|
|
|
|
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit());
|
|
|
|
|
if (!qtVersion)
|
|
|
|
|
return tr("<b>qmake:</b> No Qt version set. Cannot run qmake.");
|
2021-07-13 09:41:26 +02:00
|
|
|
const QString program = qtVersion->qmakeFilePath().fileName();
|
2020-10-05 18:23:17 +02:00
|
|
|
return tr("<b>qmake:</b> %1 %2").arg(program, project()->projectFilePath().fileName());
|
|
|
|
|
};
|
|
|
|
|
setSummaryUpdater(updateSummary);
|
|
|
|
|
|
|
|
|
|
connect(target(), &Target::kitChanged, this, updateSummary);
|
2009-10-27 14:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration *QMakeStep::qmakeBuildConfiguration() const
|
2009-11-26 14:43:27 +01:00
|
|
|
{
|
2019-10-25 09:55:32 +02:00
|
|
|
return qobject_cast<QmakeBuildConfiguration *>(buildConfiguration());
|
2009-11-26 14:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
2019-11-20 15:51:44 +01:00
|
|
|
QmakeBuildSystem *QMakeStep::qmakeBuildSystem() const
|
|
|
|
|
{
|
|
|
|
|
return qmakeBuildConfiguration()->qmakeBuildSystem();
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-01 11:36:08 +02:00
|
|
|
///
|
|
|
|
|
/// Returns all arguments
|
|
|
|
|
/// That is: possbile subpath
|
|
|
|
|
/// spec
|
|
|
|
|
/// config arguemnts
|
|
|
|
|
/// moreArguments
|
|
|
|
|
/// user arguments
|
2018-05-14 21:59:18 +03:00
|
|
|
QString QMakeStep::allArguments(const BaseQtVersion *v, ArgumentFlags flags) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2016-08-22 15:07:36 +02:00
|
|
|
QTC_ASSERT(v, return QString());
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
|
2008-12-02 12:01:29 +01:00
|
|
|
QStringList arguments;
|
2010-01-13 18:00:02 +01:00
|
|
|
if (bc->subNodeBuild())
|
2015-10-29 17:53:47 +01:00
|
|
|
arguments << bc->subNodeBuild()->filePath().toUserOutput();
|
2018-05-14 21:59:18 +03:00
|
|
|
else if (flags & ArgumentFlag::OmitProjectPath)
|
2015-01-10 23:40:32 +02:00
|
|
|
arguments << project()->projectFilePath().fileName();
|
2010-01-13 18:00:02 +01:00
|
|
|
else
|
2014-05-02 12:22:58 +02:00
|
|
|
arguments << project()->projectFilePath().toUserOutput();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
if (v->qtVersion() < QtVersionNumber(5, 0, 0))
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "-r";
|
2011-06-01 15:03:44 +00:00
|
|
|
bool userProvidedMkspec = false;
|
2021-05-06 13:07:36 +02:00
|
|
|
for (ProcessArgs::ConstArgIterator ait(userArguments()); ait.next(); ) {
|
2017-06-12 14:23:34 +02:00
|
|
|
if (ait.value() == "-spec") {
|
2011-06-01 15:03:44 +00:00
|
|
|
if (ait.next()) {
|
|
|
|
|
userProvidedMkspec = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-05-16 12:18:07 +02:00
|
|
|
}
|
2011-04-07 13:12:55 +02:00
|
|
|
}
|
2019-05-27 15:19:36 +02:00
|
|
|
const QString specArg = mkspec();
|
2011-09-06 15:19:05 +00:00
|
|
|
if (!userProvidedMkspec && !specArg.isEmpty())
|
2019-05-27 15:19:36 +02:00
|
|
|
arguments << "-spec" << QDir::toNativeSeparators(specArg);
|
2009-10-26 15:57:30 +01:00
|
|
|
|
2010-08-11 15:32:14 +02:00
|
|
|
// Find out what flags we pass on to qmake
|
2010-09-01 12:33:53 +02:00
|
|
|
arguments << bc->configCommandLineArguments();
|
2010-08-11 15:32:14 +02:00
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
arguments << deducedArguments().toArguments();
|
2010-09-28 13:18:41 +02:00
|
|
|
|
2021-05-06 13:07:36 +02:00
|
|
|
QString args = ProcessArgs::joinArgs(arguments);
|
2011-10-20 18:37:35 +00:00
|
|
|
// User arguments
|
2021-05-06 13:07:36 +02:00
|
|
|
ProcessArgs::addArgs(&args, userArguments());
|
2021-04-23 04:19:14 +02:00
|
|
|
for (QString arg : qAsConst(m_extraArgs))
|
2021-05-06 13:07:36 +02:00
|
|
|
ProcessArgs::addArgs(&args, arg);
|
2018-05-14 21:59:18 +03:00
|
|
|
return (flags & ArgumentFlag::Expand) ? bc->macroExpander()->expand(args) : args;
|
2010-08-11 15:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
QMakeStepConfig QMakeStep::deducedArguments() const
|
2010-08-11 15:32:14 +02:00
|
|
|
{
|
2020-02-18 18:25:26 +01:00
|
|
|
Kit *kit = target()->kit();
|
2015-03-04 17:14:28 +01:00
|
|
|
QMakeStepConfig config;
|
2020-02-18 18:25:26 +01:00
|
|
|
Abi targetAbi;
|
|
|
|
|
if (ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit)) {
|
2012-01-17 10:33:45 +01:00
|
|
|
targetAbi = tc->targetAbi();
|
2019-01-07 12:15:40 +01:00
|
|
|
if (HostOsInfo::isWindowsHost()
|
|
|
|
|
&& tc->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) {
|
2020-02-18 18:25:26 +01:00
|
|
|
config.sysRoot = SysRootKitAspect::sysRoot(kit).toString();
|
2019-01-07 12:15:40 +01:00
|
|
|
config.targetTriple = tc->originalTargetTriple();
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-14 13:37:56 +01:00
|
|
|
|
2020-09-07 15:56:18 +02:00
|
|
|
BaseQtVersion *version = QtKitAspect::qtVersion(kit);
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
config.osType = QMakeStepConfig::osTypeFor(targetAbi, version);
|
2019-11-28 14:37:02 +01:00
|
|
|
config.separateDebugInfo = qmakeBuildConfiguration()->separateDebugInfo();
|
2019-11-28 16:58:42 +01:00
|
|
|
config.linkQmlDebuggingQQ2 = qmakeBuildConfiguration()->qmlDebugging();
|
|
|
|
|
config.useQtQuickCompiler = qmakeBuildConfiguration()->useQtQuickCompiler();
|
2015-02-19 17:22:24 +01:00
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
return config;
|
2011-10-20 18:37:35 +00:00
|
|
|
}
|
|
|
|
|
|
2019-01-10 15:31:44 +01:00
|
|
|
bool QMakeStep::init()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2020-09-14 17:17:55 +02:00
|
|
|
if (!AbstractProcessStep::init())
|
|
|
|
|
return false;
|
|
|
|
|
|
2019-03-28 11:52:51 +01:00
|
|
|
m_wasSuccess = true;
|
2016-04-20 09:21:28 +02:00
|
|
|
QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration();
|
2020-09-07 15:56:18 +02:00
|
|
|
const BaseQtVersion *qtVersion = QtKitAspect::qtVersion(kit());
|
2011-05-04 13:14:46 +02:00
|
|
|
|
2017-02-20 12:27:37 +01:00
|
|
|
if (!qtVersion) {
|
|
|
|
|
emit addOutput(tr("No Qt version configured."), BuildStep::OutputFormat::ErrorMessage);
|
2011-05-04 13:14:46 +02:00
|
|
|
return false;
|
2017-02-20 12:27:37 +01:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
FilePath workingDirectory;
|
2010-10-05 17:38:45 +02:00
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
if (qmakeBc->subNodeBuild())
|
2020-03-20 14:55:49 +01:00
|
|
|
workingDirectory = qmakeBc->qmakeBuildSystem()->buildDir(qmakeBc->subNodeBuild()->filePath());
|
2010-01-13 18:00:02 +01:00
|
|
|
else
|
2019-10-25 09:55:32 +02:00
|
|
|
workingDirectory = qmakeBc->buildDirectory();
|
2016-04-20 09:21:28 +02:00
|
|
|
|
2021-07-13 09:41:26 +02:00
|
|
|
m_qmakeCommand = CommandLine{qtVersion->qmakeFilePath(), allArguments(qtVersion), CommandLine::Raw};
|
2016-04-20 09:21:28 +02:00
|
|
|
m_runMakeQmake = (qtVersion->qtVersion() >= QtVersionNumber(5, 0 ,0));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2021-06-03 12:49:17 +02:00
|
|
|
// The Makefile is used by qmake and make on the build device, from that
|
|
|
|
|
// perspective it is local.
|
2010-10-05 17:38:45 +02:00
|
|
|
|
2021-08-12 15:04:18 +02:00
|
|
|
QString make;
|
2016-04-20 09:21:28 +02:00
|
|
|
if (qmakeBc->subNodeBuild()) {
|
2018-11-13 15:30:27 +01:00
|
|
|
QmakeProFileNode *pro = qmakeBc->subNodeBuild();
|
2017-02-10 11:16:18 +01:00
|
|
|
if (pro && !pro->makefile().isEmpty())
|
2021-08-12 15:04:18 +02:00
|
|
|
make = pro->makefile();
|
2012-04-24 15:49:09 +02:00
|
|
|
else
|
2021-08-12 15:04:18 +02:00
|
|
|
make = "Makefile";
|
2016-04-20 09:21:28 +02:00
|
|
|
} else if (!qmakeBc->makefile().isEmpty()) {
|
2021-08-12 15:04:18 +02:00
|
|
|
make = qmakeBc->makefile().path();
|
2010-10-05 17:38:45 +02:00
|
|
|
} else {
|
2021-08-12 15:04:18 +02:00
|
|
|
make = "Makefile";
|
2010-10-05 17:38:45 +02:00
|
|
|
}
|
|
|
|
|
|
2021-08-12 15:04:18 +02:00
|
|
|
FilePath makeFile = workingDirectory / make;
|
|
|
|
|
|
2018-07-23 15:14:01 +02:00
|
|
|
if (m_runMakeQmake) {
|
2019-06-21 08:31:37 +02:00
|
|
|
const FilePath make = makeCommand();
|
|
|
|
|
if (make.isEmpty()) {
|
2018-07-23 15:14:01 +02:00
|
|
|
emit addOutput(tr("Could not determine which \"make\" command to run. "
|
|
|
|
|
"Check the \"make\" step in the build configuration."),
|
|
|
|
|
BuildStep::OutputFormat::ErrorMessage);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-08-12 15:04:18 +02:00
|
|
|
m_makeCommand = CommandLine{make, makeArguments(makeFile.path()), CommandLine::Raw};
|
2018-07-23 15:14:01 +02:00
|
|
|
} else {
|
2019-06-21 08:31:37 +02:00
|
|
|
m_makeCommand = {};
|
2018-07-23 15:14:01 +02:00
|
|
|
}
|
|
|
|
|
|
2011-09-22 13:36:46 +02:00
|
|
|
// Check whether we need to run qmake
|
2019-03-06 10:44:28 +01:00
|
|
|
if (m_forced || QmakeSettings::alwaysRunQmake()
|
2021-08-12 15:04:18 +02:00
|
|
|
|| qmakeBc->compareToImportFrom(makeFile) != QmakeBuildConfiguration::MakefileMatches) {
|
2009-10-15 19:06:51 +02:00
|
|
|
m_needToRunQMake = true;
|
2019-03-06 10:44:28 +01:00
|
|
|
}
|
2011-09-22 13:36:46 +02:00
|
|
|
m_forced = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2020-09-14 17:17:55 +02:00
|
|
|
processParameters()->setWorkingDirectory(workingDirectory);
|
2009-11-11 17:06:58 +01:00
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
QmakeProFileNode *node = static_cast<QmakeProFileNode *>(qmakeBc->project()->rootProjectNode());
|
2016-04-20 09:21:28 +02:00
|
|
|
if (qmakeBc->subNodeBuild())
|
|
|
|
|
node = qmakeBc->subNodeBuild();
|
2017-05-25 15:11:20 +03:00
|
|
|
QTC_ASSERT(node, return false);
|
2015-10-29 17:53:47 +01:00
|
|
|
QString proFile = node->filePath().toString();
|
2010-10-05 17:34:28 +02:00
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
Tasks tasks = qtVersion->reportIssues(proFile, workingDirectory.toString());
|
2014-06-16 18:25:52 +04:00
|
|
|
Utils::sort(tasks);
|
2014-04-03 17:02:21 +02:00
|
|
|
|
|
|
|
|
if (!tasks.isEmpty()) {
|
|
|
|
|
bool canContinue = true;
|
2021-04-23 04:19:14 +02:00
|
|
|
for (const Task &t : qAsConst(tasks)) {
|
2019-01-16 18:06:21 +01:00
|
|
|
emit addTask(t);
|
2014-04-03 17:02:21 +02:00
|
|
|
if (t.type == Task::Error)
|
|
|
|
|
canContinue = false;
|
|
|
|
|
}
|
|
|
|
|
if (!canContinue) {
|
2014-06-20 14:32:40 +02:00
|
|
|
emitFaultyConfigurationMessage();
|
2014-04-03 17:02:21 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-20 21:40:53 +02:00
|
|
|
|
2017-02-09 13:56:22 +01:00
|
|
|
m_scriptTemplate = node->projectType() == ProjectType::ScriptTemplate;
|
2010-06-09 15:08:06 +02:00
|
|
|
|
2020-09-14 17:17:55 +02:00
|
|
|
return true;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-16 13:53:05 +02:00
|
|
|
void QMakeStep::setupOutputFormatter(OutputFormatter *formatter)
|
|
|
|
|
{
|
|
|
|
|
formatter->addLineParser(new QMakeParser);
|
|
|
|
|
m_outputFormatter = formatter;
|
|
|
|
|
AbstractProcessStep::setupOutputFormatter(formatter);
|
|
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void QMakeStep::doRun()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-09 15:08:06 +02:00
|
|
|
if (m_scriptTemplate) {
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
emit finished(true);
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2009-09-24 16:02:02 +02:00
|
|
|
|
2009-10-15 19:06:51 +02:00
|
|
|
if (!m_needToRunQMake) {
|
2017-01-12 10:59:12 +01:00
|
|
|
emit addOutput(tr("Configuration unchanged, skipping qmake step."), BuildStep::OutputFormat::NormalMessage);
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
emit finished(true);
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2010-04-07 15:15:52 +02:00
|
|
|
|
2011-09-22 13:36:46 +02:00
|
|
|
m_needToRunQMake = false;
|
2016-04-20 09:21:28 +02:00
|
|
|
|
|
|
|
|
m_nextState = State::RUN_QMAKE;
|
|
|
|
|
runNextCommand();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::setForced(bool b)
|
|
|
|
|
{
|
|
|
|
|
m_forced = b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::processStartupFailed()
|
|
|
|
|
{
|
2011-09-22 13:36:46 +02:00
|
|
|
m_needToRunQMake = true;
|
2008-12-02 12:01:29 +01:00
|
|
|
AbstractProcessStep::processStartupFailed();
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-09 13:10:59 +02:00
|
|
|
bool QMakeStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-04-09 13:10:59 +02:00
|
|
|
bool result = AbstractProcessStep::processSucceeded(exitCode, status);
|
2008-12-02 12:01:29 +01:00
|
|
|
if (!result)
|
2011-09-22 13:36:46 +02:00
|
|
|
m_needToRunQMake = true;
|
2019-10-25 09:55:32 +02:00
|
|
|
emit buildConfiguration()->buildDirectoryChanged();
|
2008-12-02 12:01:29 +01:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void QMakeStep::doCancel()
|
|
|
|
|
{
|
|
|
|
|
AbstractProcessStep::doCancel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::finish(bool success)
|
|
|
|
|
{
|
|
|
|
|
m_wasSuccess = success;
|
|
|
|
|
runNextCommand();
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-21 08:31:37 +02:00
|
|
|
void QMakeStep::startOneCommand(const CommandLine &command)
|
2016-04-20 09:21:28 +02:00
|
|
|
{
|
|
|
|
|
ProcessParameters *pp = processParameters();
|
2019-06-21 08:31:37 +02:00
|
|
|
pp->setCommandLine(command);
|
2016-04-20 09:21:28 +02:00
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
AbstractProcessStep::doRun();
|
2016-04-20 09:21:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::runNextCommand()
|
|
|
|
|
{
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
if (isCanceled())
|
|
|
|
|
m_wasSuccess = false;
|
2016-04-20 09:21:28 +02:00
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
if (!m_wasSuccess)
|
2016-04-20 09:21:28 +02:00
|
|
|
m_nextState = State::POST_PROCESS;
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
emit progress(static_cast<int>(m_nextState) * 100 / static_cast<int>(State::POST_PROCESS),
|
|
|
|
|
QString());
|
2016-04-20 09:21:28 +02:00
|
|
|
|
|
|
|
|
switch (m_nextState) {
|
|
|
|
|
case State::IDLE:
|
|
|
|
|
return;
|
|
|
|
|
case State::RUN_QMAKE:
|
2020-04-16 13:53:05 +02:00
|
|
|
m_outputFormatter->setLineParsers({new QMakeParser});
|
2016-04-20 09:21:28 +02:00
|
|
|
m_nextState = (m_runMakeQmake ? State::RUN_MAKE_QMAKE_ALL : State::POST_PROCESS);
|
2019-06-21 08:31:37 +02:00
|
|
|
startOneCommand(m_qmakeCommand);
|
2016-04-20 09:21:28 +02:00
|
|
|
return;
|
|
|
|
|
case State::RUN_MAKE_QMAKE_ALL:
|
|
|
|
|
{
|
2018-07-12 23:59:51 +02:00
|
|
|
auto *parser = new GnuMakeParser;
|
2020-04-07 13:49:34 +02:00
|
|
|
parser->addSearchDir(processParameters()->workingDirectory());
|
2020-04-16 13:53:05 +02:00
|
|
|
m_outputFormatter->setLineParsers({parser});
|
2016-04-20 09:21:28 +02:00
|
|
|
m_nextState = State::POST_PROCESS;
|
2019-06-21 08:31:37 +02:00
|
|
|
startOneCommand(m_makeCommand);
|
2016-04-20 09:21:28 +02:00
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case State::POST_PROCESS:
|
|
|
|
|
m_nextState = State::IDLE;
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
emit finished(m_wasSuccess);
|
2016-04-20 09:21:28 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
void QMakeStep::setUserArguments(const QString &arguments)
|
2009-07-24 18:53:54 +02:00
|
|
|
{
|
2020-10-06 14:59:53 +02:00
|
|
|
m_userArgs->setArguments(arguments);
|
2010-09-01 12:33:53 +02:00
|
|
|
}
|
|
|
|
|
|
2017-03-03 16:18:08 +01:00
|
|
|
QStringList QMakeStep::extraArguments() const
|
|
|
|
|
{
|
|
|
|
|
return m_extraArgs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::setExtraArguments(const QStringList &args)
|
|
|
|
|
{
|
|
|
|
|
if (m_extraArgs != args) {
|
|
|
|
|
m_extraArgs = args;
|
2019-07-29 09:09:48 +02:00
|
|
|
emit qmakeBuildConfiguration()->qmakeBuildConfigurationChanged();
|
2019-11-20 15:51:44 +01:00
|
|
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
2017-03-03 16:18:08 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-11 17:49:46 +03:00
|
|
|
QStringList QMakeStep::extraParserArguments() const
|
|
|
|
|
{
|
|
|
|
|
return m_extraParserArgs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::setExtraParserArguments(const QStringList &args)
|
|
|
|
|
{
|
|
|
|
|
m_extraParserArgs = args;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
FilePath QMakeStep::makeCommand() const
|
2016-04-20 09:21:28 +02:00
|
|
|
{
|
2019-10-07 12:08:48 +03:00
|
|
|
if (auto ms = stepList()->firstOfType<MakeStep>())
|
|
|
|
|
return ms->makeExecutable();
|
|
|
|
|
return FilePath();
|
2016-04-20 09:21:28 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-23 15:14:01 +02:00
|
|
|
QString QMakeStep::makeArguments(const QString &makefile) const
|
2016-06-13 17:01:40 +03:00
|
|
|
{
|
|
|
|
|
QString args;
|
2018-07-23 15:14:01 +02:00
|
|
|
if (!makefile.isEmpty()) {
|
2021-05-06 13:07:36 +02:00
|
|
|
ProcessArgs::addArg(&args, "-f");
|
|
|
|
|
ProcessArgs::addArg(&args, makefile);
|
2016-06-13 17:01:40 +03:00
|
|
|
}
|
2021-05-06 13:07:36 +02:00
|
|
|
ProcessArgs::addArg(&args, "qmake_all");
|
2016-06-13 17:01:40 +03:00
|
|
|
return args;
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
QString QMakeStep::effectiveQMakeCall() const
|
|
|
|
|
{
|
2020-09-07 15:56:18 +02:00
|
|
|
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(kit());
|
2021-08-12 15:04:18 +02:00
|
|
|
FilePath qmake = qtVersion ? qtVersion->qmakeFilePath() : FilePath();
|
2016-04-20 09:21:28 +02:00
|
|
|
if (qmake.isEmpty())
|
2021-08-12 15:04:18 +02:00
|
|
|
qmake = FilePath::fromString(tr("<no Qt version>"));
|
|
|
|
|
FilePath make = makeCommand();
|
2016-04-20 09:21:28 +02:00
|
|
|
if (make.isEmpty())
|
2021-08-12 15:04:18 +02:00
|
|
|
make = FilePath::fromString(tr("<no Make step found>"));
|
|
|
|
|
|
|
|
|
|
CommandLine cmd(qmake, {});
|
2016-04-20 09:21:28 +02:00
|
|
|
|
2021-08-12 15:04:18 +02:00
|
|
|
QString result = qmake.toString();
|
2016-08-22 15:07:36 +02:00
|
|
|
if (qtVersion) {
|
2018-07-23 15:14:01 +02:00
|
|
|
QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration();
|
2021-08-12 15:04:18 +02:00
|
|
|
const FilePath makefile = qmakeBc ? qmakeBc->makefile() : FilePath();
|
2018-05-14 21:59:18 +03:00
|
|
|
result += ' ' + allArguments(qtVersion, ArgumentFlag::Expand);
|
2016-08-22 15:07:36 +02:00
|
|
|
if (qtVersion->qtVersion() >= QtVersionNumber(5, 0, 0))
|
2021-08-12 15:04:18 +02:00
|
|
|
result.append(QString(" && %1 %2").arg(make.path()).arg(makeArguments(makefile.path())));
|
2016-08-22 15:07:36 +02:00
|
|
|
}
|
2016-04-20 09:21:28 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-01 12:33:53 +02:00
|
|
|
QStringList QMakeStep::parserArguments()
|
|
|
|
|
{
|
2019-06-11 17:49:46 +03:00
|
|
|
// NOTE: extra parser args placed before the other args intentionally
|
|
|
|
|
QStringList result = m_extraParserArgs;
|
2020-09-07 15:56:18 +02:00
|
|
|
BaseQtVersion *qt = QtKitAspect::qtVersion(kit());
|
2016-04-20 09:21:28 +02:00
|
|
|
QTC_ASSERT(qt, return QStringList());
|
2021-05-06 13:07:36 +02:00
|
|
|
for (ProcessArgs::ConstArgIterator ait(allArguments(qt, ArgumentFlag::Expand)); ait.next(); ) {
|
2011-03-18 20:03:22 +01:00
|
|
|
if (ait.isSimple())
|
|
|
|
|
result << ait.value();
|
2016-04-20 09:21:28 +02:00
|
|
|
}
|
2010-09-01 12:33:53 +02:00
|
|
|
return result;
|
2009-07-24 18:53:54 +02:00
|
|
|
}
|
|
|
|
|
|
2020-10-06 14:59:53 +02:00
|
|
|
QString QMakeStep::userArguments() const
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2020-10-06 14:59:53 +02:00
|
|
|
return m_userArgs->arguments(macroExpander());
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-27 15:19:36 +02:00
|
|
|
QString QMakeStep::mkspec() const
|
2011-06-01 15:03:44 +00:00
|
|
|
{
|
2020-10-06 14:59:53 +02:00
|
|
|
QString additionalArguments = userArguments();
|
2021-05-06 13:07:36 +02:00
|
|
|
ProcessArgs::addArgs(&additionalArguments, m_extraArgs);
|
|
|
|
|
for (ProcessArgs::ArgIterator ait(&additionalArguments); ait.next(); ) {
|
2017-06-12 14:23:34 +02:00
|
|
|
if (ait.value() == "-spec") {
|
2011-06-01 15:03:44 +00:00
|
|
|
if (ait.next())
|
2019-05-28 13:49:26 +02:00
|
|
|
return FilePath::fromUserInput(ait.value()).toString();
|
2011-06-01 15:03:44 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-06 15:04:17 +01:00
|
|
|
return QmakeKitAspect::effectiveMkspec(target()->kit());
|
2011-06-01 15:03:44 +00:00
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
QVariantMap QMakeStep::toMap() const
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
QVariantMap map(AbstractProcessStep::toMap());
|
2017-06-12 14:23:34 +02:00
|
|
|
map.insert(QMAKE_FORCED_KEY, m_forced);
|
2020-04-17 15:18:27 +02:00
|
|
|
map.insert(QMAKE_SELECTED_ABIS_KEY, m_selectedAbis);
|
2010-01-14 17:41:29 +01:00
|
|
|
return map;
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
bool QMakeStep::fromMap(const QVariantMap &map)
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2017-06-12 14:23:34 +02:00
|
|
|
m_forced = map.value(QMAKE_FORCED_KEY, false).toBool();
|
2020-04-17 15:18:27 +02:00
|
|
|
m_selectedAbis = map.value(QMAKE_SELECTED_ABIS_KEY).toStringList();
|
2019-11-28 14:37:02 +01:00
|
|
|
|
|
|
|
|
// Backwards compatibility with < Creator 4.12.
|
|
|
|
|
const QVariant separateDebugInfo
|
|
|
|
|
= map.value("QtProjectManager.QMakeBuildStep.SeparateDebugInfo");
|
|
|
|
|
if (separateDebugInfo.isValid())
|
|
|
|
|
qmakeBuildConfiguration()->forceSeparateDebugInfo(separateDebugInfo.toBool());
|
2019-11-28 16:58:42 +01:00
|
|
|
const QVariant qmlDebugging
|
|
|
|
|
= map.value("QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary");
|
|
|
|
|
if (qmlDebugging.isValid())
|
|
|
|
|
qmakeBuildConfiguration()->forceQmlDebugging(qmlDebugging.toBool());
|
|
|
|
|
const QVariant useQtQuickCompiler
|
|
|
|
|
= map.value("QtProjectManager.QMakeBuildStep.UseQtQuickCompiler");
|
|
|
|
|
if (useQtQuickCompiler.isValid())
|
|
|
|
|
qmakeBuildConfiguration()->forceQtQuickCompiler(useQtQuickCompiler.toBool());
|
2011-05-13 17:41:02 +02:00
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
return BuildStep::fromMap(map);
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2020-10-02 17:53:39 +02:00
|
|
|
QWidget *QMakeStep::createConfigWidget()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2021-03-11 19:02:42 +01:00
|
|
|
abisLabel = new QLabel(tr("ABIs:"));
|
2019-11-26 10:04:37 +01:00
|
|
|
abisLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
|
|
|
|
|
|
2021-03-11 19:02:42 +01:00
|
|
|
abisListWidget = new QListWidget;
|
2019-11-26 10:04:37 +01:00
|
|
|
|
2021-03-11 19:02:42 +01:00
|
|
|
Layouting::Form builder;
|
2020-10-06 10:00:04 +02:00
|
|
|
builder.addRow(m_buildType);
|
2020-10-06 14:59:53 +02:00
|
|
|
builder.addRow(m_userArgs);
|
2020-10-06 15:43:14 +02:00
|
|
|
builder.addRow(m_effectiveCall);
|
2020-10-06 08:01:03 +02:00
|
|
|
builder.addRow({abisLabel, abisListWidget});
|
2021-03-11 19:02:42 +01:00
|
|
|
auto widget = builder.emerge(false);
|
2011-05-30 13:01:33 +02:00
|
|
|
|
|
|
|
|
qmakeBuildConfigChanged();
|
|
|
|
|
|
2021-11-01 16:09:36 +01:00
|
|
|
emit updateSummary();
|
2020-08-31 11:55:21 +02:00
|
|
|
updateAbiWidgets();
|
2011-05-30 13:01:33 +02:00
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
|
2020-10-06 14:59:53 +02:00
|
|
|
connect(m_userArgs, &BaseAspect::changed, widget, [this] {
|
|
|
|
|
updateAbiWidgets();
|
|
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
|
|
|
|
|
emit qmakeBuildConfiguration()->qmakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
|
|
|
|
});
|
|
|
|
|
|
2020-10-06 10:00:04 +02:00
|
|
|
connect(m_buildType, &BaseAspect::changed,
|
|
|
|
|
widget, [this] { buildConfigurationSelected(); });
|
2020-10-05 18:23:17 +02:00
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmlDebuggingChanged,
|
2020-10-05 18:23:17 +02:00
|
|
|
widget, [this] {
|
2019-12-02 12:59:17 +01:00
|
|
|
linkQmlDebuggingLibraryChanged();
|
|
|
|
|
askForRebuild(tr("QML Debugging"));
|
|
|
|
|
});
|
2020-10-05 18:23:17 +02:00
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
connect(project(), &Project::projectLanguagesUpdated,
|
2020-10-05 18:23:17 +02:00
|
|
|
widget, [this] { linkQmlDebuggingLibraryChanged(); });
|
2020-08-31 11:55:21 +02:00
|
|
|
connect(target(), &Target::parsingFinished,
|
2020-10-05 18:23:17 +02:00
|
|
|
widget, [this] { updateEffectiveQMakeCall(); });
|
2020-08-31 11:55:21 +02:00
|
|
|
connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::useQtQuickCompilerChanged,
|
2020-10-05 18:23:17 +02:00
|
|
|
widget, [this] { useQtQuickCompilerChanged(); });
|
2020-08-31 11:55:21 +02:00
|
|
|
connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::separateDebugInfoChanged,
|
2020-10-05 18:23:17 +02:00
|
|
|
widget, [this] { separateDebugInfoChanged(); });
|
2020-08-31 11:55:21 +02:00
|
|
|
connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmakeBuildConfigurationChanged,
|
2020-10-05 18:23:17 +02:00
|
|
|
widget, [this] { qmakeBuildConfigChanged(); });
|
|
|
|
|
connect(target(), &Target::kitChanged,
|
|
|
|
|
widget, [this] { qtVersionChanged(); });
|
|
|
|
|
|
|
|
|
|
connect(abisListWidget, &QListWidget::itemChanged, this, [this] {
|
2019-11-20 15:50:42 +01:00
|
|
|
abisChanged();
|
2020-08-31 11:55:21 +02:00
|
|
|
if (QmakeBuildConfiguration *bc = qmakeBuildConfiguration())
|
2020-02-28 09:05:46 +01:00
|
|
|
BuildManager::buildLists({bc->cleanSteps()});
|
2019-11-20 15:50:42 +01:00
|
|
|
});
|
2020-09-18 12:11:40 +02:00
|
|
|
|
2020-10-06 14:59:53 +02:00
|
|
|
VariableChooser::addSupportForChildWidgets(widget, macroExpander());
|
2009-12-03 18:37:27 +01:00
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
return widget;
|
2011-05-25 11:23:25 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::qtVersionChanged()
|
2009-10-29 19:42:56 +01:00
|
|
|
{
|
2020-08-31 11:55:21 +02:00
|
|
|
updateAbiWidgets();
|
2009-11-25 20:08:39 +01:00
|
|
|
updateEffectiveQMakeCall();
|
2009-10-29 19:42:56 +01:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::qmakeBuildConfigChanged()
|
2009-08-06 15:31:32 +02:00
|
|
|
{
|
2020-08-31 11:55:21 +02:00
|
|
|
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
|
2016-04-20 09:21:28 +02:00
|
|
|
bool debug = bc->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild;
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = true;
|
2020-10-06 10:00:04 +02:00
|
|
|
m_buildType->setValue(debug? 0 : 1);
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = false;
|
2020-08-31 11:55:21 +02:00
|
|
|
updateAbiWidgets();
|
2009-12-03 18:37:27 +01:00
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
}
|
2009-08-06 15:31:32 +02:00
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::linkQmlDebuggingLibraryChanged()
|
2011-01-12 16:24:00 +01:00
|
|
|
{
|
2020-08-31 11:55:21 +02:00
|
|
|
updateAbiWidgets();
|
2011-01-12 16:24:00 +01:00
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::useQtQuickCompilerChanged()
|
2014-10-15 17:07:43 +02:00
|
|
|
{
|
2020-08-31 11:55:21 +02:00
|
|
|
updateAbiWidgets();
|
2014-10-15 17:07:43 +02:00
|
|
|
updateEffectiveQMakeCall();
|
2019-11-28 16:58:42 +01:00
|
|
|
askForRebuild(tr("Qt Quick Compiler"));
|
2014-10-15 17:07:43 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::separateDebugInfoChanged()
|
2015-02-19 17:22:24 +01:00
|
|
|
{
|
2020-08-31 11:55:21 +02:00
|
|
|
updateAbiWidgets();
|
2015-02-19 17:22:24 +01:00
|
|
|
updateEffectiveQMakeCall();
|
2019-11-28 14:37:02 +01:00
|
|
|
askForRebuild(tr("Separate Debug Information"));
|
2015-02-19 17:22:24 +01:00
|
|
|
}
|
|
|
|
|
|
Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.
For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.
The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.
Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-22 00:11:58 +02:00
|
|
|
static bool isIos(const Kit *k)
|
|
|
|
|
{
|
|
|
|
|
const Id deviceType = DeviceTypeKitAspect::deviceTypeId(k);
|
|
|
|
|
return deviceType == Ios::Constants::IOS_DEVICE_TYPE
|
|
|
|
|
|| deviceType == Ios::Constants::IOS_SIMULATOR_TYPE;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::abisChanged()
|
2019-08-26 14:19:07 +03:00
|
|
|
{
|
2020-08-31 11:55:21 +02:00
|
|
|
m_selectedAbis.clear();
|
2019-11-26 10:04:37 +01:00
|
|
|
for (int i = 0; i < abisListWidget->count(); ++i) {
|
|
|
|
|
auto item = abisListWidget->item(i);
|
2019-08-26 14:19:07 +03:00
|
|
|
if (item->checkState() == Qt::CheckState::Checked)
|
2020-08-31 11:55:21 +02:00
|
|
|
m_selectedAbis << item->text();
|
2019-08-26 14:19:07 +03:00
|
|
|
}
|
2020-04-17 15:18:27 +02:00
|
|
|
|
Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.
For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.
The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.
Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-22 00:11:58 +02:00
|
|
|
if (BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit())) {
|
|
|
|
|
if (qtVersion->hasAbi(Abi::LinuxOS, Abi::AndroidLinuxFlavor)) {
|
2021-09-05 18:49:26 +03:00
|
|
|
const QString prefix = QString("%1=").arg(Android::Constants::ANDROID_ABIS);
|
Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.
For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.
The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.
Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-22 00:11:58 +02:00
|
|
|
QStringList args = m_extraArgs;
|
|
|
|
|
for (auto it = args.begin(); it != args.end(); ++it) {
|
|
|
|
|
if (it->startsWith(prefix)) {
|
|
|
|
|
args.erase(it);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-04-17 15:18:27 +02:00
|
|
|
}
|
Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.
For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.
The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.
Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-22 00:11:58 +02:00
|
|
|
if (!m_selectedAbis.isEmpty())
|
|
|
|
|
args << prefix + '"' + m_selectedAbis.join(' ') + '"';
|
|
|
|
|
setExtraArguments(args);
|
2021-09-05 18:49:26 +03:00
|
|
|
buildSystem()->setProperty(Android::Constants::AndroidAbis, m_selectedAbis);
|
Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.
For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.
The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.
Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-22 00:11:58 +02:00
|
|
|
} else if (qtVersion->hasAbi(Abi::DarwinOS) && !isIos(target()->kit())) {
|
|
|
|
|
const QString prefix = "QMAKE_APPLE_DEVICE_ARCHS=";
|
|
|
|
|
QStringList args = m_extraArgs;
|
|
|
|
|
for (auto it = args.begin(); it != args.end(); ++it) {
|
|
|
|
|
if (it->startsWith(prefix)) {
|
|
|
|
|
args.erase(it);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
QStringList archs;
|
|
|
|
|
for (const QString &selectedAbi : qAsConst(m_selectedAbis)) {
|
|
|
|
|
const auto abi = Abi::abiFromTargetTriplet(selectedAbi);
|
|
|
|
|
if (abi.architecture() == Abi::X86Architecture)
|
|
|
|
|
archs << "x86_64";
|
|
|
|
|
else if (abi.architecture() == Abi::ArmArchitecture)
|
|
|
|
|
archs << "arm64";
|
|
|
|
|
}
|
|
|
|
|
if (!archs.isEmpty())
|
|
|
|
|
args << prefix + '"' + archs.join(' ') + '"';
|
|
|
|
|
setExtraArguments(args);
|
2020-04-17 15:18:27 +02:00
|
|
|
}
|
2019-08-26 14:19:07 +03:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
updateAbiWidgets();
|
2019-08-26 14:19:07 +03:00
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::buildConfigurationSelected()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-12-03 18:37:27 +01:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2020-08-31 11:55:21 +02:00
|
|
|
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
|
2016-04-20 09:21:28 +02:00
|
|
|
BaseQtVersion::QmakeBuildConfigs buildConfiguration = bc->qmakeBuildConfiguration();
|
2020-10-06 10:00:04 +02:00
|
|
|
if (m_buildType->value() == 0) { // debug
|
2016-04-20 09:21:28 +02:00
|
|
|
buildConfiguration = buildConfiguration | BaseQtVersion::DebugBuild;
|
2011-05-24 19:08:31 +02:00
|
|
|
} else {
|
2016-04-20 09:21:28 +02:00
|
|
|
buildConfiguration = buildConfiguration & ~BaseQtVersion::DebugBuild;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = true;
|
|
|
|
|
bc->setQMakeBuildConfiguration(buildConfiguration);
|
|
|
|
|
m_ignoreChange = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
updateAbiWidgets();
|
2009-12-03 18:37:27 +01:00
|
|
|
updateEffectiveQMakeCall();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::askForRebuild(const QString &title)
|
2014-10-15 17:07:43 +02:00
|
|
|
{
|
2020-06-02 09:10:40 +02:00
|
|
|
auto *question = new QMessageBox(Core::ICore::dialogParent());
|
2017-12-08 15:41:49 +03:00
|
|
|
question->setWindowTitle(title);
|
2011-09-01 16:14:21 +02:00
|
|
|
question->setText(tr("The option will only take effect if the project is recompiled. Do you want to recompile now?"));
|
|
|
|
|
question->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
|
|
|
|
question->setModal(true);
|
2020-08-31 11:55:21 +02:00
|
|
|
connect(question, &QDialog::finished, this, &QMakeStep::recompileMessageBoxFinished);
|
2011-09-01 16:14:21 +02:00
|
|
|
question->show();
|
2011-01-12 16:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::updateAbiWidgets()
|
2009-07-24 18:53:54 +02:00
|
|
|
{
|
2020-10-26 10:19:08 +01:00
|
|
|
if (!abisLabel)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit());
|
|
|
|
|
if (!qtVersion)
|
2009-11-30 16:34:30 +01:00
|
|
|
return;
|
2020-08-31 11:55:21 +02:00
|
|
|
|
2020-04-17 15:18:27 +02:00
|
|
|
const Abis abis = qtVersion->qtAbis();
|
|
|
|
|
const bool enableAbisSelect = abis.size() > 1;
|
2019-11-26 10:04:37 +01:00
|
|
|
abisLabel->setVisible(enableAbisSelect);
|
|
|
|
|
abisListWidget->setVisible(enableAbisSelect);
|
2020-04-17 15:18:27 +02:00
|
|
|
|
|
|
|
|
if (enableAbisSelect && abisListWidget->count() != abis.size()) {
|
2019-11-26 10:04:37 +01:00
|
|
|
abisListWidget->clear();
|
2020-08-31 11:55:21 +02:00
|
|
|
QStringList selectedAbis = m_selectedAbis;
|
2020-04-17 15:18:27 +02:00
|
|
|
|
Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.
For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.
The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.
Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-22 00:11:58 +02:00
|
|
|
if (selectedAbis.isEmpty()) {
|
|
|
|
|
if (qtVersion->hasAbi(Abi::LinuxOS, Abi::AndroidLinuxFlavor)) {
|
|
|
|
|
// Prefer ARM for Android, prefer 32bit.
|
|
|
|
|
for (const Abi &abi : abis) {
|
|
|
|
|
if (abi.param() == ProjectExplorer::Constants::ANDROID_ABI_ARMEABI_V7A)
|
|
|
|
|
selectedAbis.append(abi.param());
|
|
|
|
|
}
|
|
|
|
|
if (selectedAbis.isEmpty()) {
|
|
|
|
|
for (const Abi &abi : abis) {
|
|
|
|
|
if (abi.param() == ProjectExplorer::Constants::ANDROID_ABI_ARM64_V8A)
|
|
|
|
|
selectedAbis.append(abi.param());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (qtVersion->hasAbi(Abi::DarwinOS) && !isIos(target()->kit()) && HostOsInfo::isRunningUnderRosetta()) {
|
|
|
|
|
// Automatically select arm64 when running under Rosetta
|
2020-04-17 15:18:27 +02:00
|
|
|
for (const Abi &abi : abis) {
|
Add workarounds for running under Rosetta on macOS
When Qt Creator is built as an Intel binary, and runs on
an Apple Silicon (ARM) Mac, it will be run via the Rosetta
translation layer. This means any process spawned by QtC,
including qmake, CMake, and lldb, will launch as x86_64
binaries as well.
For qmake and CMake, this affects their default choice of
build architecture, resulting in x86_64 builds of user
applications. We want to produce native arm64 apps, even
if Qt Creator itself isn't one, so we explicitly detect
the situation, and if Qt has an arm64 slice, we default
to arm64 builds.
The logic of adding CONFIG+=x86_64 to the qmake step has
been disabled, as the assumption that a single qmake run
and build will produce only a single architecture does no
longer hold. The corresponding logic in Qt was removed
in 2015 (qtbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
In the case of lldb, running it as an x86_64 binary fails
to attach to the running application. We work around this
by using the 'arch' tool to explicitly launch it as an
arm64 binary. This works for debugging both arm64 and
x86_64 applications.
Change-Id: I65cc0f600223990f25c76cef18d927895e551260
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-22 00:11:58 +02:00
|
|
|
if (abi.architecture() == Abi::ArmArchitecture)
|
2020-04-17 15:18:27 +02:00
|
|
|
selectedAbis.append(abi.param());
|
|
|
|
|
}
|
2019-08-26 14:19:07 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-17 15:18:27 +02:00
|
|
|
for (const Abi &abi : abis) {
|
|
|
|
|
const QString param = abi.param();
|
|
|
|
|
auto item = new QListWidgetItem{param, abisListWidget};
|
|
|
|
|
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
|
|
|
item->setCheckState(selectedAbis.contains(param) ? Qt::Checked : Qt::Unchecked);
|
|
|
|
|
}
|
2019-08-26 14:19:07 +03:00
|
|
|
abisChanged();
|
|
|
|
|
}
|
2009-08-12 13:21:41 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::updateEffectiveQMakeCall()
|
2009-08-12 13:21:41 +02:00
|
|
|
{
|
2020-10-06 15:43:14 +02:00
|
|
|
m_effectiveCall->setValue(effectiveQMakeCall());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 11:55:21 +02:00
|
|
|
void QMakeStep::recompileMessageBoxFinished(int button)
|
2011-09-01 16:14:21 +02:00
|
|
|
{
|
|
|
|
|
if (button == QMessageBox::Yes) {
|
2020-08-31 11:55:21 +02:00
|
|
|
if (BuildConfiguration *bc = buildConfiguration())
|
2020-02-28 09:05:46 +01:00
|
|
|
BuildManager::buildLists({bc->cleanSteps(), bc->buildSteps()});
|
2011-09-01 16:14:21 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:25:48 +02:00
|
|
|
////
|
|
|
|
|
// QMakeStepFactory
|
|
|
|
|
////
|
|
|
|
|
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
QMakeStepFactory::QMakeStepFactory()
|
2009-04-20 16:25:48 +02:00
|
|
|
{
|
2019-08-09 10:40:40 +02:00
|
|
|
registerStep<QMakeStep>(Constants::QMAKE_BS_ID);
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
setSupportedConfiguration(Constants::QMAKE_BC_ID);
|
|
|
|
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
2020-09-24 17:29:46 +02:00
|
|
|
//: QMakeStep default display name
|
2021-03-19 10:46:11 +01:00
|
|
|
setDisplayName(::QmakeProjectManager::QMakeStep::tr("qmake"));
|
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6fb2ec did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-29 12:28:40 +01:00
|
|
|
setFlags(BuildStepInfo::UniqueStep);
|
2009-04-20 16:25:48 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-06 09:31:48 +02:00
|
|
|
QMakeStepConfig::TargetArchConfig QMakeStepConfig::targetArchFor(const Abi &, const BaseQtVersion *)
|
|
|
|
|
{
|
|
|
|
|
return NoArch;
|
2015-03-04 17:14:28 +01:00
|
|
|
}
|
|
|
|
|
|
2021-04-23 04:19:14 +02:00
|
|
|
QMakeStepConfig::OsType QMakeStepConfig::osTypeFor(const Abi &targetAbi, const BaseQtVersion *version)
|
2015-03-04 17:14:28 +01:00
|
|
|
{
|
2021-04-23 04:19:14 +02:00
|
|
|
OsType os = NoOsType;
|
2015-03-04 17:14:28 +01:00
|
|
|
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios";
|
2017-06-12 14:23:34 +02:00
|
|
|
if (!version || version->type() != IOSQT)
|
2015-03-04 17:14:28 +01:00
|
|
|
return os;
|
2021-04-23 04:19:14 +02:00
|
|
|
if (targetAbi.os() == Abi::DarwinOS && targetAbi.binaryFormat() == Abi::MachOFormat) {
|
|
|
|
|
if (targetAbi.architecture() == Abi::X86Architecture)
|
|
|
|
|
os = IphoneSimulator;
|
|
|
|
|
else if (targetAbi.architecture() == Abi::ArmArchitecture)
|
|
|
|
|
os = IphoneOS;
|
2015-03-04 17:14:28 +01:00
|
|
|
}
|
|
|
|
|
return os;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList QMakeStepConfig::toArguments() const
|
|
|
|
|
{
|
|
|
|
|
QStringList arguments;
|
|
|
|
|
|
2016-04-18 16:47:04 +02:00
|
|
|
// TODO: make that depend on the actual Qt version that is used
|
2015-03-04 17:14:28 +01:00
|
|
|
if (osType == IphoneSimulator)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=iphonesimulator" << "CONFIG+=simulator" /*since Qt 5.7*/;
|
2015-03-04 17:14:28 +01:00
|
|
|
else if (osType == IphoneOS)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=iphoneos" << "CONFIG+=device" /*since Qt 5.7*/;
|
2015-03-04 17:14:28 +01:00
|
|
|
|
2019-11-15 16:20:33 +01:00
|
|
|
if (linkQmlDebuggingQQ2 == TriState::Enabled)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=qml_debug";
|
2019-11-15 16:20:33 +01:00
|
|
|
else if (linkQmlDebuggingQQ2 == TriState::Disabled)
|
2019-11-28 16:58:42 +01:00
|
|
|
arguments << "CONFIG-=qml_debug";
|
2015-03-04 17:14:28 +01:00
|
|
|
|
2019-11-15 16:20:33 +01:00
|
|
|
if (useQtQuickCompiler == TriState::Enabled)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=qtquickcompiler";
|
2019-11-15 16:20:33 +01:00
|
|
|
else if (useQtQuickCompiler == TriState::Disabled)
|
2019-11-28 16:58:42 +01:00
|
|
|
arguments << "CONFIG-=qtquickcompiler";
|
2015-03-04 17:14:28 +01:00
|
|
|
|
2019-11-15 16:20:33 +01:00
|
|
|
if (separateDebugInfo == TriState::Enabled)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=force_debug_info" << "CONFIG+=separate_debug_info";
|
2019-11-15 16:20:33 +01:00
|
|
|
else if (separateDebugInfo == TriState::Disabled)
|
2019-11-28 14:37:02 +01:00
|
|
|
arguments << "CONFIG-=separate_debug_info";
|
2015-03-04 17:14:28 +01:00
|
|
|
|
2019-01-07 12:15:40 +01:00
|
|
|
if (!sysRoot.isEmpty()) {
|
|
|
|
|
arguments << ("QMAKE_CFLAGS+=--sysroot=\"" + sysRoot + "\"");
|
|
|
|
|
arguments << ("QMAKE_CXXFLAGS+=--sysroot=\"" + sysRoot + "\"");
|
|
|
|
|
arguments << ("QMAKE_LFLAGS+=--sysroot=\"" + sysRoot + "\"");
|
|
|
|
|
if (!targetTriple.isEmpty()) {
|
|
|
|
|
arguments << ("QMAKE_CFLAGS+=--target=" + targetTriple);
|
|
|
|
|
arguments << ("QMAKE_CXXFLAGS+=--target=" + targetTriple);
|
|
|
|
|
arguments << ("QMAKE_LFLAGS+=--target=" + targetTriple);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
return arguments;
|
|
|
|
|
}
|
2020-08-31 11:55:21 +02:00
|
|
|
|
|
|
|
|
} // QmakeProjectManager
|