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"
|
2011-05-25 11:23:25 +02:00
|
|
|
#include "ui_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"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
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>
|
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>
|
2017-03-17 00:27:13 +02:00
|
|
|
#include <coreplugin/variablechooser.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>
|
2014-06-16 18:25:52 +04:00
|
|
|
#include <utils/algorithm.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
#include <utils/hostosinfo.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>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDir>
|
|
|
|
|
#include <QMessageBox>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
using namespace QmakeProjectManager;
|
|
|
|
|
using namespace QmakeProjectManager::Internal;
|
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
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
namespace {
|
2012-11-20 07:18:01 +02:00
|
|
|
const char QMAKE_BS_ID[] = "QtProjectManager.QMakeBuildStep";
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2012-11-20 07:18:01 +02:00
|
|
|
const char QMAKE_ARGUMENTS_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeArguments";
|
|
|
|
|
const char QMAKE_FORCED_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeForced";
|
2014-11-25 18:23:15 +01:00
|
|
|
const char QMAKE_USE_QTQUICKCOMPILER[] = "QtProjectManager.QMakeBuildStep.UseQtQuickCompiler";
|
2015-02-19 17:22:24 +01:00
|
|
|
const char QMAKE_SEPARATEDEBUGINFO_KEY[] = "QtProjectManager.QMakeBuildStep.SeparateDebugInfo";
|
2012-11-20 07:18:01 +02:00
|
|
|
const char QMAKE_QMLDEBUGLIBAUTO_KEY[] = "QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto";
|
|
|
|
|
const char QMAKE_QMLDEBUGLIB_KEY[] = "QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary";
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
QMakeStep::QMakeStep(BuildStepList *bsl) : AbstractProcessStep(bsl, QMAKE_BS_ID)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2010-08-19 12:26:21 +02:00
|
|
|
//: QMakeStep default display name
|
|
|
|
|
setDefaultDisplayName(tr("qmake"));
|
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
|
|
|
{
|
2013-10-16 14:00:45 +02:00
|
|
|
return static_cast<QmakeBuildConfiguration *>(buildConfiguration());
|
2009-11-26 14:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
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;
|
2012-08-23 15:53:58 +02:00
|
|
|
for (QtcProcess::ConstArgIterator ait(m_userArgs); 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
|
|
|
}
|
2012-08-23 15:53:58 +02:00
|
|
|
FileName specArg = mkspec();
|
2011-09-06 15:19:05 +00:00
|
|
|
if (!userProvidedMkspec && !specArg.isEmpty())
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "-spec" << specArg.toUserOutput();
|
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
|
|
|
|
2012-08-23 15:53:58 +02:00
|
|
|
QString args = QtcProcess::joinArgs(arguments);
|
2011-10-20 18:37:35 +00:00
|
|
|
// User arguments
|
2012-08-23 15:53:58 +02:00
|
|
|
QtcProcess::addArgs(&args, m_userArgs);
|
2017-03-03 16:18:08 +01:00
|
|
|
foreach (QString arg, m_extraArgs)
|
|
|
|
|
QtcProcess::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
|
|
|
{
|
2015-03-04 17:14:28 +01:00
|
|
|
ProjectExplorer::Kit *kit = target()->kit();
|
|
|
|
|
QMakeStepConfig config;
|
2012-04-24 15:49:09 +02:00
|
|
|
ProjectExplorer::ToolChain *tc
|
2016-12-16 00:43:14 +01:00
|
|
|
= ProjectExplorer::ToolChainKitInformation::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
2012-01-17 10:33:45 +01:00
|
|
|
ProjectExplorer::Abi targetAbi;
|
2019-01-07 12:15:40 +01:00
|
|
|
if (tc) {
|
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) {
|
|
|
|
|
config.sysRoot = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString();
|
|
|
|
|
config.targetTriple = tc->originalTargetTriple();
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-14 13:37:56 +01:00
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
config.archConfig = QMakeStepConfig::targetArchFor(targetAbi, version);
|
|
|
|
|
config.osType = QMakeStepConfig::osTypeFor(targetAbi, version);
|
2015-10-01 15:38:31 +02:00
|
|
|
if (linkQmlDebuggingLibrary() && version && version->qtVersion().majorVersion >= 5)
|
|
|
|
|
config.linkQmlDebuggingQQ2 = true;
|
2011-02-14 13:37:56 +01:00
|
|
|
|
2014-10-15 17:07:43 +02:00
|
|
|
if (useQtQuickCompiler() && version)
|
2015-03-04 17:14:28 +01:00
|
|
|
config.useQtQuickCompiler = true;
|
2011-10-20 18:37:35 +00:00
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
if (separateDebugInfo())
|
|
|
|
|
config.separateDebugInfo = true;
|
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
|
|
|
{
|
2016-04-20 09:21:28 +02:00
|
|
|
QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration();
|
|
|
|
|
const BaseQtVersion *qtVersion = QtKitInformation::qtVersion(target()->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
|
|
|
|
2010-01-13 18:00:02 +01:00
|
|
|
QString workingDirectory;
|
2010-10-05 17:38:45 +02:00
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
if (qmakeBc->subNodeBuild())
|
|
|
|
|
workingDirectory = qmakeBc->subNodeBuild()->buildDir();
|
2010-01-13 18:00:02 +01:00
|
|
|
else
|
2016-04-20 09:21:28 +02:00
|
|
|
workingDirectory = qmakeBc->buildDirectory().toString();
|
|
|
|
|
|
|
|
|
|
m_qmakeExecutable = qtVersion->qmakeCommand().toString();
|
|
|
|
|
m_qmakeArguments = allArguments(qtVersion);
|
|
|
|
|
m_runMakeQmake = (qtVersion->qtVersion() >= QtVersionNumber(5, 0 ,0));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-06-18 12:08:29 +03:00
|
|
|
QString makefile = workingDirectory + '/';
|
2010-10-05 17:38:45 +02:00
|
|
|
|
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())
|
|
|
|
|
makefile.append(pro->makefile());
|
2012-04-24 15:49:09 +02:00
|
|
|
else
|
2017-06-18 12:08:29 +03:00
|
|
|
makefile.append("Makefile");
|
2016-04-20 09:21:28 +02:00
|
|
|
} else if (!qmakeBc->makefile().isEmpty()) {
|
|
|
|
|
makefile.append(qmakeBc->makefile());
|
2010-10-05 17:38:45 +02:00
|
|
|
} else {
|
2017-06-18 12:08:29 +03:00
|
|
|
makefile.append("Makefile");
|
2010-10-05 17:38:45 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-23 15:14:01 +02:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-22 13:36:46 +02:00
|
|
|
// Check whether we need to run qmake
|
2016-04-20 09:21:28 +02:00
|
|
|
bool makefileOutDated = (qmakeBc->compareToImportFrom(makefile) != QmakeBuildConfiguration::MakefileMatches);
|
2011-09-22 13:36:46 +02:00
|
|
|
if (m_forced || makefileOutDated)
|
2009-10-15 19:06:51 +02:00
|
|
|
m_needToRunQMake = true;
|
2011-09-22 13:36:46 +02:00
|
|
|
m_forced = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-11-12 17:23:55 +01:00
|
|
|
ProcessParameters *pp = processParameters();
|
2016-04-20 09:21:28 +02:00
|
|
|
pp->setMacroExpander(qmakeBc->macroExpander());
|
2010-11-12 17:23:55 +01:00
|
|
|
pp->setWorkingDirectory(workingDirectory);
|
2016-04-20 09:21:28 +02:00
|
|
|
pp->setEnvironment(qmakeBc->environment());
|
2009-11-11 17:06:58 +01:00
|
|
|
|
2009-12-09 13:54:46 +01:00
|
|
|
setOutputParser(new QMakeParser);
|
2010-06-09 15:08:06 +02:00
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
QmakeProFileNode *node = static_cast<QmakeProject *>(qmakeBc->target()->project())->rootProjectNode();
|
|
|
|
|
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
|
|
|
|
2014-04-03 17:02:21 +02:00
|
|
|
QList<ProjectExplorer::Task> tasks = qtVersion->reportIssues(proFile, workingDirectory);
|
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;
|
|
|
|
|
foreach (const ProjectExplorer::Task &t, 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
|
|
|
|
2019-01-10 15:31:44 +01:00
|
|
|
return AbstractProcessStep::init();
|
2008-12-02 12:01:29 +01: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
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::BuildStepConfigWidget *QMakeStep::createConfigWidget()
|
|
|
|
|
{
|
|
|
|
|
return new QMakeStepConfigWidget(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
2018-07-12 23:59:51 +02:00
|
|
|
auto *project = static_cast<QmakeProject *>(qmakeBuildConfiguration()->target()->project());
|
2012-07-13 17:14:42 +02:00
|
|
|
project->emitBuildDirectoryInitialized();
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
void QMakeStep::startOneCommand(const QString &command, const QString &args)
|
|
|
|
|
{
|
|
|
|
|
ProcessParameters *pp = processParameters();
|
|
|
|
|
pp->setCommand(command);
|
|
|
|
|
pp->setArguments(args);
|
|
|
|
|
pp->resolveAll();
|
|
|
|
|
|
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:
|
|
|
|
|
setOutputParser(new QMakeParser);
|
|
|
|
|
m_nextState = (m_runMakeQmake ? State::RUN_MAKE_QMAKE_ALL : State::POST_PROCESS);
|
|
|
|
|
startOneCommand(m_qmakeExecutable, m_qmakeArguments);
|
|
|
|
|
return;
|
|
|
|
|
case State::RUN_MAKE_QMAKE_ALL:
|
|
|
|
|
{
|
2018-07-12 23:59:51 +02:00
|
|
|
auto *parser = new GnuMakeParser;
|
2016-04-20 09:21:28 +02:00
|
|
|
parser->setWorkingDirectory(processParameters()->workingDirectory());
|
|
|
|
|
setOutputParser(parser);
|
|
|
|
|
m_nextState = State::POST_PROCESS;
|
2016-06-13 17:01:40 +03:00
|
|
|
startOneCommand(m_makeExecutable, m_makeArguments);
|
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
|
|
|
{
|
2010-01-12 17:20:15 +01:00
|
|
|
if (m_userArgs == arguments)
|
|
|
|
|
return;
|
2009-11-26 18:51:07 +01:00
|
|
|
m_userArgs = arguments;
|
2010-01-12 17:20:15 +01:00
|
|
|
|
2009-11-30 16:34:30 +01:00
|
|
|
emit userArgumentsChanged();
|
2010-01-12 17:20:15 +01:00
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
qmakeBuildConfiguration()->emitQMakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildConfiguration()->emitProFileEvaluateNeeded();
|
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;
|
|
|
|
|
emit extraArgumentsChanged();
|
|
|
|
|
qmakeBuildConfiguration()->emitQMakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildConfiguration()->emitProFileEvaluateNeeded();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-12 16:24:00 +01:00
|
|
|
bool QMakeStep::linkQmlDebuggingLibrary() const
|
|
|
|
|
{
|
2015-10-01 15:41:04 +02:00
|
|
|
return m_linkQmlDebuggingLibrary;
|
2011-01-12 16:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
|
|
|
|
|
{
|
2015-10-01 15:41:04 +02:00
|
|
|
if (enable == m_linkQmlDebuggingLibrary)
|
2011-01-12 16:24:00 +01:00
|
|
|
return;
|
2015-10-01 15:41:04 +02:00
|
|
|
|
|
|
|
|
m_linkQmlDebuggingLibrary = enable;
|
2011-01-12 16:24:00 +01:00
|
|
|
|
|
|
|
|
emit linkQmlDebuggingLibraryChanged();
|
|
|
|
|
|
2013-10-16 14:00:45 +02:00
|
|
|
qmakeBuildConfiguration()->emitQMakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildConfiguration()->emitProFileEvaluateNeeded();
|
2011-01-12 16:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-15 17:07:43 +02:00
|
|
|
bool QMakeStep::useQtQuickCompiler() const
|
|
|
|
|
{
|
|
|
|
|
return m_useQtQuickCompiler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::setUseQtQuickCompiler(bool enable)
|
|
|
|
|
{
|
|
|
|
|
if (enable == m_useQtQuickCompiler)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_useQtQuickCompiler = enable;
|
|
|
|
|
|
|
|
|
|
emit useQtQuickCompilerChanged();
|
|
|
|
|
|
|
|
|
|
qmakeBuildConfiguration()->emitQMakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildConfiguration()->emitProFileEvaluateNeeded();
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-19 17:22:24 +01:00
|
|
|
bool QMakeStep::separateDebugInfo() const
|
|
|
|
|
{
|
|
|
|
|
return m_separateDebugInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::setSeparateDebugInfo(bool enable)
|
|
|
|
|
{
|
|
|
|
|
if (enable == m_separateDebugInfo)
|
|
|
|
|
return;
|
|
|
|
|
m_separateDebugInfo = enable;
|
|
|
|
|
|
|
|
|
|
emit separateDebugInfoChanged();
|
|
|
|
|
|
|
|
|
|
qmakeBuildConfiguration()->emitQMakeBuildConfigurationChanged();
|
|
|
|
|
qmakeBuildConfiguration()->emitProFileEvaluateNeeded();
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
QString QMakeStep::makeCommand() const
|
|
|
|
|
{
|
2018-07-12 23:59:51 +02:00
|
|
|
auto *ms = qobject_cast<BuildStepList *>(parent())->firstOfType<MakeStep>();
|
2016-04-20 09:21:28 +02:00
|
|
|
return ms ? ms->effectiveMakeCommand() : QString();
|
|
|
|
|
}
|
|
|
|
|
|
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()) {
|
|
|
|
|
Utils::QtcProcess::addArg(&args, "-f");
|
|
|
|
|
Utils::QtcProcess::addArg(&args, makefile);
|
2016-06-13 17:01:40 +03:00
|
|
|
}
|
|
|
|
|
Utils::QtcProcess::addArg(&args, "qmake_all");
|
|
|
|
|
return args;
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
QString QMakeStep::effectiveQMakeCall() const
|
|
|
|
|
{
|
|
|
|
|
BaseQtVersion *qtVersion = QtKitInformation::qtVersion(target()->kit());
|
2018-05-03 09:21:31 +02:00
|
|
|
QString qmake = qtVersion ? qtVersion->qmakeCommand().toUserOutput() : QString();
|
2016-04-20 09:21:28 +02:00
|
|
|
if (qmake.isEmpty())
|
|
|
|
|
qmake = tr("<no Qt version>");
|
|
|
|
|
QString make = makeCommand();
|
|
|
|
|
if (make.isEmpty())
|
|
|
|
|
make = tr("<no Make step found>");
|
|
|
|
|
|
2016-08-22 15:07:36 +02:00
|
|
|
QString result = qmake;
|
|
|
|
|
if (qtVersion) {
|
2018-07-23 15:14:01 +02:00
|
|
|
QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration();
|
|
|
|
|
const QString makefile = qmakeBc ? qmakeBc->makefile() : QString();
|
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))
|
2018-07-23 15:14:01 +02:00
|
|
|
result.append(QString::fromLatin1(" && %1 %2").arg(make).arg(makeArguments(makefile)));
|
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()
|
|
|
|
|
{
|
|
|
|
|
QStringList result;
|
2016-04-20 09:21:28 +02:00
|
|
|
BaseQtVersion *qt = QtKitInformation::qtVersion(target()->kit());
|
|
|
|
|
QTC_ASSERT(qt, return QStringList());
|
2018-05-14 21:59:18 +03:00
|
|
|
for (QtcProcess::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
|
|
|
}
|
|
|
|
|
|
2010-10-19 11:14:03 +02:00
|
|
|
QString QMakeStep::userArguments()
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2009-11-26 18:51:07 +01:00
|
|
|
return m_userArgs;
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
FileName QMakeStep::mkspec() const
|
2011-06-01 15:03:44 +00:00
|
|
|
{
|
|
|
|
|
QString additionalArguments = m_userArgs;
|
2017-03-03 16:18:08 +01:00
|
|
|
QtcProcess::addArgs(&additionalArguments, m_extraArgs);
|
2012-08-23 15:53:58 +02:00
|
|
|
for (QtcProcess::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())
|
2012-08-23 15:53:58 +02:00
|
|
|
return FileName::fromUserInput(ait.value());
|
2011-06-01 15:03:44 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
return QmakeProjectManager::QmakeKitInformation::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_ARGUMENTS_KEY, m_userArgs);
|
|
|
|
|
map.insert(QMAKE_QMLDEBUGLIB_KEY, m_linkQmlDebuggingLibrary);
|
|
|
|
|
map.insert(QMAKE_FORCED_KEY, m_forced);
|
|
|
|
|
map.insert(QMAKE_USE_QTQUICKCOMPILER, m_useQtQuickCompiler);
|
|
|
|
|
map.insert(QMAKE_SEPARATEDEBUGINFO_KEY, m_separateDebugInfo);
|
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_userArgs = map.value(QMAKE_ARGUMENTS_KEY).toString();
|
|
|
|
|
m_forced = map.value(QMAKE_FORCED_KEY, false).toBool();
|
|
|
|
|
m_useQtQuickCompiler = map.value(QMAKE_USE_QTQUICKCOMPILER, false).toBool();
|
2015-10-01 15:41:04 +02:00
|
|
|
|
|
|
|
|
// QMAKE_QMLDEBUGLIBAUTO_KEY was used in versions 2.3 to 3.5 (both included) to automatically
|
|
|
|
|
// change the qml_debug CONFIG flag based no the qmake build configuration.
|
2017-06-12 14:23:34 +02:00
|
|
|
if (map.value(QMAKE_QMLDEBUGLIBAUTO_KEY, false).toBool()) {
|
2015-10-01 15:41:04 +02:00
|
|
|
m_linkQmlDebuggingLibrary =
|
2017-01-30 14:59:10 +01:00
|
|
|
project()->projectLanguages().contains(
|
|
|
|
|
ProjectExplorer::Constants::QMLJS_LANGUAGE_ID) &&
|
2015-10-01 15:41:04 +02:00
|
|
|
(qmakeBuildConfiguration()->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild);
|
2011-05-13 17:41:02 +02:00
|
|
|
} else {
|
2017-06-12 14:23:34 +02:00
|
|
|
m_linkQmlDebuggingLibrary = map.value(QMAKE_QMLDEBUGLIB_KEY, false).toBool();
|
2011-05-13 17:41:02 +02:00
|
|
|
}
|
2017-06-12 14:23:34 +02:00
|
|
|
m_separateDebugInfo = map.value(QMAKE_SEPARATEDEBUGINFO_KEY, false).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
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
////
|
|
|
|
|
// QMakeStepConfigWidget
|
|
|
|
|
////
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
|
2018-09-20 11:19:41 +02:00
|
|
|
: BuildStepConfigWidget(step), m_ui(new Internal::Ui::QMakeStep), m_step(step)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2011-05-25 11:23:25 +02:00
|
|
|
m_ui->setupUi(this);
|
2011-05-30 13:01:33 +02:00
|
|
|
|
|
|
|
|
m_ui->qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments());
|
|
|
|
|
m_ui->qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
|
2014-10-15 17:07:43 +02:00
|
|
|
m_ui->qtQuickCompilerCheckBox->setChecked(m_step->useQtQuickCompiler());
|
2015-02-19 17:22:24 +01:00
|
|
|
m_ui->separateDebugInfoCheckBox->setChecked(m_step->separateDebugInfo());
|
2016-08-03 17:55:54 +02:00
|
|
|
const QPixmap warning = Utils::Icons::WARNING.pixmap();
|
2015-10-19 12:55:13 +02:00
|
|
|
m_ui->qmlDebuggingWarningIcon->setPixmap(warning);
|
|
|
|
|
m_ui->qtQuickCompilerWarningIcon->setPixmap(warning);
|
2011-05-30 13:01:33 +02:00
|
|
|
|
|
|
|
|
qmakeBuildConfigChanged();
|
|
|
|
|
|
|
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
updateQmlDebuggingOption();
|
2014-10-15 17:07:43 +02:00
|
|
|
updateQtQuickCompilerOption();
|
2011-05-30 13:01:33 +02:00
|
|
|
|
2016-05-24 23:21:57 +03:00
|
|
|
connect(m_ui->qmakeAdditonalArgumentsLineEdit, &QLineEdit::textEdited,
|
|
|
|
|
this, &QMakeStepConfigWidget::qmakeArgumentsLineEdited);
|
|
|
|
|
connect(m_ui->buildConfigurationComboBox,
|
|
|
|
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
|
this, &QMakeStepConfigWidget::buildConfigurationSelected);
|
2014-11-14 10:12:04 +01:00
|
|
|
connect(m_ui->qmlDebuggingLibraryCheckBox, &QCheckBox::toggled,
|
|
|
|
|
this, &QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked);
|
|
|
|
|
connect(m_ui->qmlDebuggingLibraryCheckBox, &QCheckBox::clicked,
|
2017-12-08 15:41:49 +03:00
|
|
|
this, [this] { askForRebuild(tr("QML Debugging")); });
|
2014-10-15 17:07:43 +02:00
|
|
|
connect(m_ui->qtQuickCompilerCheckBox, &QAbstractButton::toggled,
|
|
|
|
|
this, &QMakeStepConfigWidget::useQtQuickCompilerChecked);
|
2014-11-14 10:12:04 +01:00
|
|
|
connect(m_ui->qtQuickCompilerCheckBox, &QCheckBox::clicked,
|
2017-12-08 15:41:49 +03:00
|
|
|
this, [this] { askForRebuild(tr("QML Debugging")); });
|
2015-02-19 17:22:24 +01:00
|
|
|
connect(m_ui->separateDebugInfoCheckBox, &QAbstractButton::toggled,
|
|
|
|
|
this, &QMakeStepConfigWidget::separateDebugInfoChecked);
|
|
|
|
|
connect(m_ui->separateDebugInfoCheckBox, &QCheckBox::clicked,
|
2017-12-08 15:41:49 +03:00
|
|
|
this, [this] { askForRebuild(tr("QMake Configuration")); });
|
2016-05-24 23:21:57 +03:00
|
|
|
connect(step, &QMakeStep::userArgumentsChanged,
|
|
|
|
|
this, &QMakeStepConfigWidget::userArgumentsChanged);
|
|
|
|
|
connect(step, &QMakeStep::linkQmlDebuggingLibraryChanged,
|
|
|
|
|
this, &QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged);
|
2014-11-13 12:38:59 +01:00
|
|
|
connect(step->project(), &Project::projectLanguagesUpdated,
|
|
|
|
|
this, &QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged);
|
2014-10-15 17:07:43 +02:00
|
|
|
connect(step, &QMakeStep::useQtQuickCompilerChanged,
|
|
|
|
|
this, &QMakeStepConfigWidget::useQtQuickCompilerChanged);
|
2015-02-19 17:22:24 +01:00
|
|
|
connect(step, &QMakeStep::separateDebugInfoChanged,
|
|
|
|
|
this, &QMakeStepConfigWidget::separateDebugInfoChanged);
|
2016-05-24 23:21:57 +03:00
|
|
|
connect(step->qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmakeBuildConfigurationChanged,
|
|
|
|
|
this, &QMakeStepConfigWidget::qmakeBuildConfigChanged);
|
|
|
|
|
connect(step->target(), &Target::kitChanged, this, &QMakeStepConfigWidget::qtVersionChanged);
|
|
|
|
|
connect(QtVersionManager::instance(), &QtVersionManager::dumpUpdatedFor,
|
|
|
|
|
this, &QMakeStepConfigWidget::qtVersionChanged);
|
2017-03-17 00:27:13 +02:00
|
|
|
auto chooser = new Core::VariableChooser(m_ui->qmakeAdditonalArgumentsLineEdit);
|
|
|
|
|
chooser->addMacroExpanderProvider([step] { return step->macroExpander(); });
|
|
|
|
|
chooser->addSupportedWidget(m_ui->qmakeAdditonalArgumentsLineEdit);
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-25 11:23:25 +02:00
|
|
|
QMakeStepConfigWidget::~QMakeStepConfigWidget()
|
|
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-30 13:57:41 +01:00
|
|
|
void QMakeStepConfigWidget::qtVersionChanged()
|
2009-10-29 19:42:56 +01:00
|
|
|
{
|
2009-12-03 18:37:27 +01:00
|
|
|
updateSummaryLabel();
|
2009-11-25 20:08:39 +01:00
|
|
|
updateEffectiveQMakeCall();
|
2011-04-14 15:00:42 +02:00
|
|
|
updateQmlDebuggingOption();
|
2014-11-25 18:23:15 +01:00
|
|
|
updateQtQuickCompilerOption();
|
2009-10-29 19:42:56 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void QMakeStepConfigWidget::qmakeBuildConfigChanged()
|
2009-08-06 15:31:32 +02:00
|
|
|
{
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration *bc = m_step->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;
|
2011-05-25 11:23:25 +02:00
|
|
|
m_ui->buildConfigurationComboBox->setCurrentIndex(debug? 0 : 1);
|
2009-12-03 18:37:27 +01:00
|
|
|
m_ignoreChange = false;
|
|
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
}
|
2009-08-06 15:31:32 +02:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void QMakeStepConfigWidget::userArgumentsChanged()
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2011-05-25 11:23:25 +02:00
|
|
|
m_ui->qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments());
|
2009-12-03 18:37:27 +01:00
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
2009-08-06 15:31:32 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-12 16:24:00 +01:00
|
|
|
void QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged()
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2011-05-25 11:23:25 +02:00
|
|
|
m_ui->qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
|
2011-01-12 16:24:00 +01:00
|
|
|
|
|
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
2011-04-14 15:00:42 +02:00
|
|
|
updateQmlDebuggingOption();
|
2011-01-12 16:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-15 17:07:43 +02:00
|
|
|
void QMakeStepConfigWidget::useQtQuickCompilerChanged()
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
updateQtQuickCompilerOption();
|
2014-11-25 18:23:15 +01:00
|
|
|
updateQmlDebuggingOption();
|
2014-10-15 17:07:43 +02:00
|
|
|
}
|
|
|
|
|
|
2015-02-19 17:22:24 +01:00
|
|
|
void QMakeStepConfigWidget::separateDebugInfoChanged()
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void QMakeStepConfigWidget::qmakeArgumentsLineEdited()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-11-30 16:34:30 +01:00
|
|
|
m_ignoreChange = true;
|
2011-05-25 11:23:25 +02:00
|
|
|
m_step->setUserArguments(m_ui->qmakeAdditonalArgumentsLineEdit->text());
|
2009-11-30 16:34:30 +01:00
|
|
|
m_ignoreChange = false;
|
2009-08-12 13:21:41 +02:00
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
updateSummaryLabel();
|
2009-08-12 13:21:41 +02:00
|
|
|
updateEffectiveQMakeCall();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void QMakeStepConfigWidget::buildConfigurationSelected()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-12-03 18:37:27 +01:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration *bc = m_step->qmakeBuildConfiguration();
|
2016-04-20 09:21:28 +02:00
|
|
|
BaseQtVersion::QmakeBuildConfigs buildConfiguration = bc->qmakeBuildConfiguration();
|
2011-05-25 11:23:25 +02:00
|
|
|
if (m_ui->buildConfigurationComboBox->currentIndex() == 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
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2011-01-12 16:24:00 +01:00
|
|
|
void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_step->setLinkQmlDebuggingLibrary(checked);
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
|
|
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
2011-04-14 15:00:42 +02:00
|
|
|
updateQmlDebuggingOption();
|
2014-10-15 17:07:43 +02:00
|
|
|
}
|
2011-09-01 16:14:21 +02:00
|
|
|
|
2017-12-08 15:41:49 +03:00
|
|
|
void QMakeStepConfigWidget::askForRebuild(const QString &title)
|
2014-10-15 17:07:43 +02:00
|
|
|
{
|
2018-07-12 23:59:51 +02:00
|
|
|
auto *question = new QMessageBox(Core::ICore::mainWindow());
|
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);
|
2016-04-20 12:49:25 +02:00
|
|
|
connect(question, &QDialog::finished, this, &QMakeStepConfigWidget::recompileMessageBoxFinished);
|
2011-09-01 16:14:21 +02:00
|
|
|
question->show();
|
2011-01-12 16:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-15 17:07:43 +02:00
|
|
|
void QMakeStepConfigWidget::useQtQuickCompilerChecked(bool checked)
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_step->setUseQtQuickCompiler(checked);
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
|
|
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
2014-11-25 18:23:15 +01:00
|
|
|
updateQmlDebuggingOption();
|
2014-10-15 17:07:43 +02:00
|
|
|
updateQtQuickCompilerOption();
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-19 17:22:24 +01:00
|
|
|
void QMakeStepConfigWidget::separateDebugInfoChecked(bool checked)
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_step->setSeparateDebugInfo(checked);
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
|
|
|
|
|
updateSummaryLabel();
|
|
|
|
|
updateEffectiveQMakeCall();
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
void QMakeStepConfigWidget::updateSummaryLabel()
|
2009-07-24 18:53:54 +02:00
|
|
|
{
|
2016-04-20 09:21:28 +02:00
|
|
|
BaseQtVersion *qtVersion = QtKitInformation::qtVersion(m_step->target()->kit());
|
2009-12-03 18:37:27 +01:00
|
|
|
if (!qtVersion) {
|
2011-09-09 09:54:37 +00:00
|
|
|
setSummaryText(tr("<b>qmake:</b> No Qt version set. Cannot run qmake."));
|
2009-11-30 16:34:30 +01:00
|
|
|
return;
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
// We don't want the full path to the .pro file
|
2018-05-14 21:59:18 +03:00
|
|
|
const QString args = m_step->allArguments(
|
|
|
|
|
qtVersion,
|
|
|
|
|
QMakeStep::ArgumentFlag::OmitProjectPath
|
|
|
|
|
| QMakeStep::ArgumentFlag::Expand);
|
2009-12-03 18:37:27 +01:00
|
|
|
// And we only use the .pro filename not the full path
|
2018-05-14 21:59:18 +03:00
|
|
|
const QString program = qtVersion->qmakeCommand().fileName();
|
2011-09-09 09:54:37 +00:00
|
|
|
setSummaryText(tr("<b>qmake:</b> %1 %2").arg(program, args));
|
2009-08-12 13:21:41 +02:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 15:00:42 +02:00
|
|
|
void QMakeStepConfigWidget::updateQmlDebuggingOption()
|
2011-01-12 16:24:00 +01:00
|
|
|
{
|
2011-04-14 15:00:42 +02:00
|
|
|
QString warningText;
|
2016-04-20 09:21:28 +02:00
|
|
|
bool supported = BaseQtVersion::isQmlDebuggingSupported(m_step->target()->kit(),
|
2015-02-18 15:56:03 +01:00
|
|
|
&warningText);
|
2014-11-25 18:23:15 +01:00
|
|
|
|
2013-06-13 17:10:32 +02:00
|
|
|
m_ui->qmlDebuggingLibraryCheckBox->setEnabled(supported);
|
2015-02-18 15:56:03 +01:00
|
|
|
m_ui->debuggingLibraryLabel->setText(tr("Enable QML debugging and profiling:"));
|
2011-04-14 15:00:42 +02:00
|
|
|
|
2013-06-13 17:10:32 +02:00
|
|
|
if (supported && m_step->linkQmlDebuggingLibrary())
|
2011-06-14 17:17:24 +02:00
|
|
|
warningText = tr("Might make your application vulnerable. Only use in a safe environment.");
|
2011-01-12 16:24:00 +01:00
|
|
|
|
2011-05-25 11:23:25 +02:00
|
|
|
m_ui->qmlDebuggingWarningText->setText(warningText);
|
|
|
|
|
m_ui->qmlDebuggingWarningIcon->setVisible(!warningText.isEmpty());
|
2015-02-18 15:56:03 +01:00
|
|
|
|
|
|
|
|
updateQtQuickCompilerOption(); // show or clear compiler warning text
|
2011-01-12 16:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-15 17:07:43 +02:00
|
|
|
void QMakeStepConfigWidget::updateQtQuickCompilerOption()
|
|
|
|
|
{
|
|
|
|
|
QString warningText;
|
2016-04-20 09:21:28 +02:00
|
|
|
bool supported = BaseQtVersion::isQtQuickCompilerSupported(m_step->target()->kit(),
|
2014-10-15 17:07:43 +02:00
|
|
|
&warningText);
|
|
|
|
|
m_ui->qtQuickCompilerCheckBox->setEnabled(supported);
|
|
|
|
|
m_ui->qtQuickCompilerLabel->setText(tr("Enable Qt Quick Compiler:"));
|
2015-02-18 15:56:03 +01:00
|
|
|
|
|
|
|
|
if (supported && m_step->useQtQuickCompiler() && m_step->linkQmlDebuggingLibrary())
|
|
|
|
|
warningText = tr("Disables QML debugging. QML profiling will still work.");
|
|
|
|
|
|
2014-10-15 17:07:43 +02:00
|
|
|
m_ui->qtQuickCompilerWarningText->setText(warningText);
|
|
|
|
|
m_ui->qtQuickCompilerWarningIcon->setVisible(!warningText.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-12 13:21:41 +02:00
|
|
|
void QMakeStepConfigWidget::updateEffectiveQMakeCall()
|
|
|
|
|
{
|
2016-04-20 09:21:28 +02:00
|
|
|
m_ui->qmakeArgumentsEdit->setPlainText(m_step->effectiveQMakeCall());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2011-09-01 16:14:21 +02:00
|
|
|
void QMakeStepConfigWidget::recompileMessageBoxFinished(int button)
|
|
|
|
|
{
|
|
|
|
|
if (button == QMessageBox::Yes) {
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration *bc = m_step->qmakeBuildConfiguration();
|
2011-09-01 16:14:21 +02:00
|
|
|
if (!bc)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::BuildStepList *> stepLists;
|
2013-09-05 14:36:20 +02:00
|
|
|
const Core::Id clean = ProjectExplorer::Constants::BUILDSTEPS_CLEAN;
|
|
|
|
|
const Core::Id build = ProjectExplorer::Constants::BUILDSTEPS_BUILD;
|
2012-01-13 14:20:45 +01:00
|
|
|
stepLists << bc->stepList(clean) << bc->stepList(build);
|
2013-09-05 14:36:20 +02:00
|
|
|
BuildManager::buildLists(stepLists, QStringList() << ProjectExplorerPlugin::displayNameForStepId(clean)
|
2012-01-13 14:20:45 +01:00
|
|
|
<< ProjectExplorerPlugin::displayNameForStepId(build));
|
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
|
|
|
{
|
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
|
|
|
registerStep<QMakeStep>(QMAKE_BS_ID);
|
|
|
|
|
setSupportedConfiguration(Constants::QMAKE_BC_ID);
|
|
|
|
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
2018-05-14 17:50:56 +02:00
|
|
|
setDisplayName(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
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
QMakeStepConfig::TargetArchConfig QMakeStepConfig::targetArchFor(const Abi &targetAbi, const BaseQtVersion *version)
|
|
|
|
|
{
|
|
|
|
|
QMakeStepConfig::TargetArchConfig arch = QMakeStepConfig::NoArch;
|
2017-06-12 14:23:34 +02:00
|
|
|
if (!version || version->type() != QtSupport::Constants::DESKTOPQT)
|
2015-03-04 17:14:28 +01:00
|
|
|
return arch;
|
2016-07-25 18:39:16 -07:00
|
|
|
if ((targetAbi.os() == ProjectExplorer::Abi::DarwinOS)
|
2015-03-04 17:14:28 +01:00
|
|
|
&& (targetAbi.binaryFormat() == ProjectExplorer::Abi::MachOFormat)) {
|
|
|
|
|
if (targetAbi.architecture() == ProjectExplorer::Abi::X86Architecture) {
|
|
|
|
|
if (targetAbi.wordWidth() == 32)
|
|
|
|
|
arch = QMakeStepConfig::X86;
|
|
|
|
|
else if (targetAbi.wordWidth() == 64)
|
|
|
|
|
arch = QMakeStepConfig::X86_64;
|
|
|
|
|
} else if (targetAbi.architecture() == ProjectExplorer::Abi::PowerPCArchitecture) {
|
|
|
|
|
if (targetAbi.wordWidth() == 32)
|
2016-06-14 15:14:04 -07:00
|
|
|
arch = QMakeStepConfig::PowerPC;
|
2015-03-04 17:14:28 +01:00
|
|
|
else if (targetAbi.wordWidth() == 64)
|
2016-06-14 15:14:04 -07:00
|
|
|
arch = QMakeStepConfig::PowerPC64;
|
2015-03-04 17:14:28 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return arch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QMakeStepConfig::OsType QMakeStepConfig::osTypeFor(const ProjectExplorer::Abi &targetAbi, const BaseQtVersion *version)
|
|
|
|
|
{
|
|
|
|
|
QMakeStepConfig::OsType os = QMakeStepConfig::NoOsType;
|
|
|
|
|
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;
|
2016-07-25 18:39:16 -07:00
|
|
|
if ((targetAbi.os() == ProjectExplorer::Abi::DarwinOS)
|
2015-03-04 17:14:28 +01:00
|
|
|
&& (targetAbi.binaryFormat() == ProjectExplorer::Abi::MachOFormat)) {
|
|
|
|
|
if (targetAbi.architecture() == ProjectExplorer::Abi::X86Architecture) {
|
|
|
|
|
os = QMakeStepConfig::IphoneSimulator;
|
|
|
|
|
} else if (targetAbi.architecture() == ProjectExplorer::Abi::ArmArchitecture) {
|
|
|
|
|
os = QMakeStepConfig::IphoneOS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return os;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList QMakeStepConfig::toArguments() const
|
|
|
|
|
{
|
|
|
|
|
QStringList arguments;
|
|
|
|
|
if (archConfig == X86)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=x86";
|
2015-03-04 17:14:28 +01:00
|
|
|
else if (archConfig == X86_64)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=x86_64";
|
2016-06-14 15:14:04 -07:00
|
|
|
else if (archConfig == PowerPC)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=ppc";
|
2016-06-14 15:14:04 -07:00
|
|
|
else if (archConfig == PowerPC64)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=ppc64";
|
2015-03-04 17:14:28 +01:00
|
|
|
|
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
|
|
|
|
|
|
|
|
if (linkQmlDebuggingQQ2)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=qml_debug";
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
if (useQtQuickCompiler)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=qtquickcompiler";
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
if (separateDebugInfo)
|
2017-06-12 14:23:34 +02:00
|
|
|
arguments << "CONFIG+=force_debug_info" << "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;
|
|
|
|
|
}
|