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
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
#include "makestep.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>
|
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
|
|
|
|
2015-11-23 16:41:54 +01:00
|
|
|
#include <coreplugin/coreicons.h>
|
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>
|
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>
|
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
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
QMakeStep::QMakeStep(BuildStepList *bsl) :
|
2015-06-18 15:14:06 +02:00
|
|
|
AbstractProcessStep(bsl, Core::Id(QMAKE_BS_ID))
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
ctor();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
QMakeStep::QMakeStep(BuildStepList *bsl, Core::Id id) :
|
2015-06-18 15:14:06 +02:00
|
|
|
AbstractProcessStep(bsl, id)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
|
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
QMakeStep::QMakeStep(BuildStepList *bsl, QMakeStep *bs) :
|
|
|
|
|
AbstractProcessStep(bsl, bs),
|
2011-01-12 16:24:00 +01:00
|
|
|
m_userArgs(bs->m_userArgs),
|
2016-04-20 09:21:28 +02:00
|
|
|
m_forced(bs->m_forced),
|
2014-10-15 17:07:43 +02:00
|
|
|
m_linkQmlDebuggingLibrary(bs->m_linkQmlDebuggingLibrary),
|
2015-02-19 17:22:24 +01:00
|
|
|
m_useQtQuickCompiler(bs->m_useQtQuickCompiler),
|
|
|
|
|
m_separateDebugInfo(bs->m_separateDebugInfo)
|
2009-10-27 14:16:28 +01:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::ctor()
|
|
|
|
|
{
|
2010-08-19 12:26:21 +02:00
|
|
|
//: QMakeStep default display name
|
|
|
|
|
setDefaultDisplayName(tr("qmake"));
|
2016-04-20 09:21:28 +02:00
|
|
|
|
|
|
|
|
connect(&m_inputWatcher, &QFutureWatcher<bool>::canceled,
|
|
|
|
|
this, [this]() {
|
|
|
|
|
if (m_commandFuture)
|
|
|
|
|
m_commandFuture->cancel();
|
|
|
|
|
});
|
|
|
|
|
connect(&m_commandWatcher, &QFutureWatcher<bool>::finished, this, &QMakeStep::runNextCommand);
|
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
|
2016-04-20 09:21:28 +02:00
|
|
|
QString QMakeStep::allArguments(const BaseQtVersion *v, bool shorted) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
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();
|
2010-10-19 11:14:03 +02:00
|
|
|
else if (shorted)
|
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))
|
|
|
|
|
arguments << QLatin1String("-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(); ) {
|
2011-06-01 15:03:44 +00:00
|
|
|
if (ait.value() == QLatin1String("-spec")) {
|
|
|
|
|
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())
|
2012-01-13 14:20:45 +01:00
|
|
|
arguments << QLatin1String("-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);
|
2010-10-19 11:14:03 +02:00
|
|
|
return 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
|
2015-03-04 17:14:28 +01:00
|
|
|
= ProjectExplorer::ToolChainKitInformation::toolChain(kit);
|
2012-01-17 10:33:45 +01:00
|
|
|
ProjectExplorer::Abi targetAbi;
|
|
|
|
|
if (tc)
|
|
|
|
|
targetAbi = tc->targetAbi();
|
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
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
|
2015-11-13 12:19:35 +01:00
|
|
|
bool QMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2016-04-20 09:21:28 +02:00
|
|
|
if (m_commandFuture)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration();
|
|
|
|
|
const BaseQtVersion *qtVersion = QtKitInformation::qtVersion(target()->kit());
|
2011-05-04 13:14:46 +02:00
|
|
|
|
|
|
|
|
if (!qtVersion)
|
|
|
|
|
return false;
|
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));
|
|
|
|
|
if (m_runMakeQmake) {
|
|
|
|
|
m_makeExecutable = makeCommand();
|
|
|
|
|
if (m_makeExecutable.isEmpty())
|
|
|
|
|
return false;
|
2016-06-13 17:01:40 +03:00
|
|
|
m_makeArguments = makeArguments();
|
2016-04-20 09:21:28 +02:00
|
|
|
} else {
|
|
|
|
|
m_makeExecutable.clear();
|
2016-06-13 17:01:40 +03:00
|
|
|
m_makeArguments.clear();
|
2016-04-20 09:21:28 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-10-05 17:38:45 +02:00
|
|
|
QString makefile = workingDirectory;
|
|
|
|
|
|
2016-04-20 09:21:28 +02:00
|
|
|
if (qmakeBc->subNodeBuild()) {
|
|
|
|
|
if (!qmakeBc->subNodeBuild()->makefile().isEmpty())
|
|
|
|
|
makefile.append(qmakeBc->subNodeBuild()->makefile());
|
2012-04-24 15:49:09 +02:00
|
|
|
else
|
2012-01-13 14:20:45 +01:00
|
|
|
makefile.append(QLatin1String("/Makefile"));
|
2016-04-20 09:21:28 +02:00
|
|
|
} else if (!qmakeBc->makefile().isEmpty()) {
|
2012-01-13 14:20:45 +01:00
|
|
|
makefile.append(QLatin1Char('/'));
|
2016-04-20 09:21:28 +02:00
|
|
|
makefile.append(qmakeBc->makefile());
|
2010-10-05 17:38:45 +02:00
|
|
|
} else {
|
2012-01-13 14:20:45 +01:00
|
|
|
makefile.append(QLatin1String("/Makefile"));
|
2010-10-05 17:38:45 +02:00
|
|
|
}
|
|
|
|
|
|
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();
|
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) {
|
|
|
|
|
addTask(t);
|
|
|
|
|
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
|
|
|
|
2010-10-05 17:34:28 +02:00
|
|
|
m_scriptTemplate = node->projectType() == ScriptTemplate;
|
2010-06-09 15:08:06 +02:00
|
|
|
|
2015-11-13 12:19:35 +01:00
|
|
|
return AbstractProcessStep::init(earlierSteps);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::run(QFutureInterface<bool> &fi)
|
|
|
|
|
{
|
2016-04-20 09:21:28 +02:00
|
|
|
m_inputFuture = fi;
|
|
|
|
|
m_inputWatcher.setFuture(m_inputFuture.future());
|
|
|
|
|
|
|
|
|
|
fi.setProgressRange(0, static_cast<int>(State::POST_PROCESS));
|
|
|
|
|
fi.setProgressValue(0);
|
2010-06-09 15:08:06 +02:00
|
|
|
if (m_scriptTemplate) {
|
2016-04-20 12:49:25 +02:00
|
|
|
reportRunResult(fi, 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) {
|
2010-07-15 10:29:38 +02:00
|
|
|
emit addOutput(tr("Configuration unchanged, skipping qmake step."), BuildStep::MessageOutput);
|
2016-04-20 12:49:25 +02:00
|
|
|
reportRunResult(fi, 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QMakeStep::forced()
|
|
|
|
|
{
|
|
|
|
|
return m_forced;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::BuildStepConfigWidget *QMakeStep::createConfigWidget()
|
|
|
|
|
{
|
|
|
|
|
return new QMakeStepConfigWidget(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QMakeStep::immutable() const
|
|
|
|
|
{
|
2009-07-27 16:36:27 +02:00
|
|
|
return false;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
2013-10-29 14:22:31 +01:00
|
|
|
QmakeProject *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;
|
|
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
QTC_ASSERT(!m_commandFuture || m_commandFuture->future().isFinished(), return);
|
|
|
|
|
delete m_commandFuture;
|
|
|
|
|
m_commandFuture = new QFutureInterface<bool>;
|
|
|
|
|
|
|
|
|
|
m_commandWatcher.setFuture(m_commandFuture->future());
|
|
|
|
|
AbstractProcessStep::run(*m_commandFuture);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::runNextCommand()
|
|
|
|
|
{
|
2016-04-28 16:36:16 +02:00
|
|
|
bool wasSuccess = true;
|
|
|
|
|
if (m_commandFuture) {
|
|
|
|
|
if (m_commandFuture->isCanceled())
|
|
|
|
|
wasSuccess = false;
|
|
|
|
|
else if (m_commandFuture->isFinished())
|
|
|
|
|
wasSuccess = m_commandFuture->future().result();
|
|
|
|
|
else
|
|
|
|
|
wasSuccess = false; // should not happen
|
|
|
|
|
}
|
2016-04-20 09:21:28 +02:00
|
|
|
|
|
|
|
|
delete m_commandFuture;
|
|
|
|
|
m_commandFuture = nullptr;
|
|
|
|
|
|
|
|
|
|
if (!wasSuccess)
|
|
|
|
|
m_nextState = State::POST_PROCESS;
|
|
|
|
|
|
|
|
|
|
m_inputFuture.setProgressValue(static_cast<int>(m_nextState));
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
{
|
|
|
|
|
GnuMakeParser *parser = new GnuMakeParser;
|
|
|
|
|
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;
|
|
|
|
|
reportRunResult(m_inputFuture, wasSuccess);
|
|
|
|
|
m_inputFuture = QFutureInterface<bool>();
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
MakeStep *ms = qobject_cast<BuildStepList *>(parent())->firstOfType<MakeStep>();
|
|
|
|
|
return ms ? ms->effectiveMakeCommand() : QString();
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-13 17:01:40 +03:00
|
|
|
QString QMakeStep::makeArguments() const
|
|
|
|
|
{
|
|
|
|
|
QString args;
|
|
|
|
|
if (QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration()) {
|
|
|
|
|
const QString makefile = qmakeBc->makefile();
|
|
|
|
|
if (!makefile.isEmpty()) {
|
|
|
|
|
Utils::QtcProcess::addArg(&args, "-f");
|
|
|
|
|
Utils::QtcProcess::addArg(&args, makefile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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());
|
|
|
|
|
QString qmake = qtVersion ? qtVersion->qmakeCommand().fileName() : QString();
|
|
|
|
|
if (qmake.isEmpty())
|
|
|
|
|
qmake = tr("<no Qt version>");
|
|
|
|
|
QString make = makeCommand();
|
|
|
|
|
if (make.isEmpty())
|
|
|
|
|
make = tr("<no Make step found>");
|
|
|
|
|
|
|
|
|
|
QString result = qmake + QLatin1Char(' ') + allArguments(qtVersion);
|
|
|
|
|
if (qtVersion->qtVersion() >= QtVersionNumber(5, 0, 0))
|
2016-06-13 17:01:40 +03:00
|
|
|
result.append(QString::fromLatin1(" && %1 %2").arg(make).arg(makeArguments()));
|
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());
|
|
|
|
|
for (QtcProcess::ConstArgIterator ait(allArguments(qt)); 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;
|
2012-08-23 15:53:58 +02:00
|
|
|
for (QtcProcess::ArgIterator ait(&additionalArguments); ait.next(); ) {
|
2011-06-01 15:03:44 +00:00
|
|
|
if (ait.value() == QLatin1String("-spec")) {
|
|
|
|
|
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());
|
|
|
|
|
map.insert(QLatin1String(QMAKE_ARGUMENTS_KEY), m_userArgs);
|
2015-10-01 15:41:04 +02:00
|
|
|
map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary);
|
2010-12-03 11:46:35 +01:00
|
|
|
map.insert(QLatin1String(QMAKE_FORCED_KEY), m_forced);
|
2014-11-25 18:23:15 +01:00
|
|
|
map.insert(QLatin1String(QMAKE_USE_QTQUICKCOMPILER), m_useQtQuickCompiler);
|
2015-02-19 17:22:24 +01:00
|
|
|
map.insert(QLatin1String(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
|
|
|
{
|
2010-10-19 11:14:03 +02:00
|
|
|
m_userArgs = map.value(QLatin1String(QMAKE_ARGUMENTS_KEY)).toString();
|
2010-12-03 11:46:35 +01:00
|
|
|
m_forced = map.value(QLatin1String(QMAKE_FORCED_KEY), false).toBool();
|
2014-11-25 18:23:15 +01:00
|
|
|
m_useQtQuickCompiler = map.value(QLatin1String(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.
|
2011-05-13 17:41:02 +02:00
|
|
|
if (map.value(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), false).toBool()) {
|
2015-10-01 15:41:04 +02:00
|
|
|
m_linkQmlDebuggingLibrary =
|
|
|
|
|
project()->projectLanguages().contains(ProjectExplorer::Constants::LANG_QMLJS) &&
|
|
|
|
|
(qmakeBuildConfiguration()->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild);
|
2011-05-13 17:41:02 +02:00
|
|
|
} else {
|
2015-10-01 15:41:04 +02:00
|
|
|
m_linkQmlDebuggingLibrary = map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool();
|
2011-05-13 17:41:02 +02:00
|
|
|
}
|
2015-02-19 17:22:24 +01:00
|
|
|
m_separateDebugInfo = map.value(QLatin1String(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)
|
2015-06-18 15:14:06 +02:00
|
|
|
: BuildStepConfigWidget(), 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());
|
2015-11-23 16:41:54 +01:00
|
|
|
const QPixmap warning = Core::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,
|
|
|
|
|
this, &QMakeStepConfigWidget::askForRebuild);
|
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,
|
|
|
|
|
this, &QMakeStepConfigWidget::askForRebuild);
|
2015-02-19 17:22:24 +01:00
|
|
|
connect(m_ui->separateDebugInfoCheckBox, &QAbstractButton::toggled,
|
|
|
|
|
this, &QMakeStepConfigWidget::separateDebugInfoChecked);
|
|
|
|
|
connect(m_ui->separateDebugInfoCheckBox, &QCheckBox::clicked,
|
|
|
|
|
this, &QMakeStepConfigWidget::askForRebuild);
|
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);
|
2009-12-03 18:37:27 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-25 11:23:25 +02:00
|
|
|
QMakeStepConfigWidget::~QMakeStepConfigWidget()
|
|
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
QString QMakeStepConfigWidget::summaryText() const
|
|
|
|
|
{
|
|
|
|
|
return m_summaryText;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-09 09:54:37 +00:00
|
|
|
QString QMakeStepConfigWidget::additionalSummaryText() const
|
|
|
|
|
{
|
|
|
|
|
return m_additionalSummaryText;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-03 18:37:27 +01:00
|
|
|
QString QMakeStepConfigWidget::displayName() const
|
|
|
|
|
{
|
|
|
|
|
return m_step->displayName();
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
2014-10-15 17:07:43 +02:00
|
|
|
void QMakeStepConfigWidget::askForRebuild()
|
|
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
QMessageBox *question = new QMessageBox(Core::ICore::mainWindow());
|
2011-09-01 16:14:21 +02:00
|
|
|
question->setWindowTitle(tr("QML Debugging"));
|
|
|
|
|
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
|
2016-04-20 09:21:28 +02:00
|
|
|
QString args = m_step->allArguments(qtVersion, true);
|
2009-12-03 18:37:27 +01:00
|
|
|
// And we only use the .pro filename not the full path
|
2015-01-10 23:40:32 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-09 09:54:37 +00:00
|
|
|
void QMakeStepConfigWidget::setSummaryText(const QString &text)
|
|
|
|
|
{
|
|
|
|
|
if (text == m_summaryText)
|
|
|
|
|
return;
|
|
|
|
|
m_summaryText = text;
|
|
|
|
|
emit updateSummary();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 16:25:48 +02:00
|
|
|
////
|
|
|
|
|
// QMakeStepFactory
|
|
|
|
|
////
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
QMakeStepFactory::QMakeStepFactory(QObject *parent) :
|
|
|
|
|
ProjectExplorer::IBuildStepFactory(parent)
|
2009-04-20 16:25:48 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-18 12:37:29 +02:00
|
|
|
QList<BuildStepInfo> QMakeStepFactory::availableSteps(BuildStepList *parent) const
|
2009-04-20 16:25:48 +02:00
|
|
|
{
|
2012-08-03 15:24:33 +02:00
|
|
|
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
2016-05-18 12:37:29 +02:00
|
|
|
return {};
|
2013-10-16 14:00:45 +02:00
|
|
|
if (!qobject_cast<QmakeBuildConfiguration *>(parent->parent()))
|
2016-05-18 12:37:29 +02:00
|
|
|
return {};
|
|
|
|
|
|
|
|
|
|
return {{ QMAKE_BS_ID, tr("qmake"), BuildStepInfo::UniqueStep }};
|
2009-04-20 16:25:48 +02:00
|
|
|
}
|
|
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
ProjectExplorer::BuildStep *QMakeStepFactory::create(BuildStepList *parent, Core::Id id)
|
2009-04-20 16:25:48 +02:00
|
|
|
{
|
2016-05-18 12:37:29 +02:00
|
|
|
Q_UNUSED(id)
|
2010-07-16 14:00:41 +02:00
|
|
|
return new QMakeStep(parent);
|
2009-10-27 14:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
ProjectExplorer::BuildStep *QMakeStepFactory::clone(BuildStepList *parent, ProjectExplorer::BuildStep *source)
|
2009-04-20 16:25:48 +02:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
return new QMakeStep(parent, qobject_cast<QMakeStep *>(source));
|
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;
|
|
|
|
|
if (!version || version->type() != QLatin1String(QtSupport::Constants::DESKTOPQT))
|
|
|
|
|
return arch;
|
|
|
|
|
if ((targetAbi.os() == ProjectExplorer::Abi::MacOS)
|
|
|
|
|
&& (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";
|
|
|
|
|
if (!version || version->type() != QLatin1String(IOSQT))
|
|
|
|
|
return os;
|
|
|
|
|
if ((targetAbi.os() == ProjectExplorer::Abi::MacOS)
|
|
|
|
|
&& (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)
|
|
|
|
|
arguments << QLatin1String("CONFIG+=x86");
|
|
|
|
|
else if (archConfig == X86_64)
|
|
|
|
|
arguments << QLatin1String("CONFIG+=x86_64");
|
2016-06-14 15:14:04 -07:00
|
|
|
else if (archConfig == PowerPC)
|
2015-03-04 17:14:28 +01:00
|
|
|
arguments << QLatin1String("CONFIG+=ppc");
|
2016-06-14 15:14:04 -07:00
|
|
|
else if (archConfig == PowerPC64)
|
2015-03-04 17:14:28 +01:00
|
|
|
arguments << QLatin1String("CONFIG+=ppc64");
|
|
|
|
|
|
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)
|
2016-04-18 16:47:04 +02:00
|
|
|
arguments << QLatin1String("CONFIG+=iphonesimulator") << QLatin1String("CONFIG+=simulator") /*since Qt 5.7*/;
|
2015-03-04 17:14:28 +01:00
|
|
|
else if (osType == IphoneOS)
|
2016-04-18 16:47:04 +02:00
|
|
|
arguments << QLatin1String("CONFIG+=iphoneos") << QLatin1String("CONFIG+=device") /*since Qt 5.7*/;
|
2015-03-04 17:14:28 +01:00
|
|
|
|
|
|
|
|
if (linkQmlDebuggingQQ2)
|
|
|
|
|
arguments << QLatin1String("CONFIG+=qml_debug");
|
|
|
|
|
|
|
|
|
|
if (useQtQuickCompiler)
|
|
|
|
|
arguments << QLatin1String("CONFIG+=qtquickcompiler");
|
|
|
|
|
|
|
|
|
|
if (separateDebugInfo)
|
|
|
|
|
arguments << QLatin1String("CONFIG+=force_debug_info")
|
|
|
|
|
<< QLatin1String("CONFIG+=separate_debug_info");
|
|
|
|
|
|
|
|
|
|
return arguments;
|
|
|
|
|
}
|