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
|
|
|
|
2009-12-09 13:54:46 +01:00
|
|
|
#include "qmakeparser.h"
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakebuildconfiguration.h"
|
|
|
|
|
#include "qmakeproject.h"
|
|
|
|
|
#include "qmakeprojectmanagerconstants.h"
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "qmakekitinformation.h"
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakenodes.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>
|
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),
|
2010-12-03 11:46:35 +01:00
|
|
|
m_forced(bs->m_forced),
|
2011-01-12 16:24:00 +01:00
|
|
|
m_userArgs(bs->m_userArgs),
|
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"));
|
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
|
2010-10-19 11:14:03 +02:00
|
|
|
QString QMakeStep::allArguments(bool shorted)
|
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
|
|
|
|
2012-01-13 14:20:45 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2015-03-04 17:14:28 +01:00
|
|
|
QMakeStepConfig QMakeStep::deducedArguments()
|
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
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::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
|
|
|
{
|
2013-10-16 14:00:45 +02:00
|
|
|
QmakeBuildConfiguration *qt4bc = qmakeBuildConfiguration();
|
2012-09-03 18:31:44 +02:00
|
|
|
const QtSupport::BaseQtVersion *qtVersion = QtSupport::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-10-19 11:14:03 +02:00
|
|
|
QString args = allArguments();
|
2010-01-13 18:00:02 +01:00
|
|
|
QString workingDirectory;
|
2010-10-05 17:38:45 +02:00
|
|
|
|
2010-01-13 18:00:02 +01:00
|
|
|
if (qt4bc->subNodeBuild())
|
|
|
|
|
workingDirectory = qt4bc->subNodeBuild()->buildDir();
|
|
|
|
|
else
|
2013-08-16 17:45:16 +02:00
|
|
|
workingDirectory = qt4bc->buildDirectory().toString();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-08-23 15:53:58 +02:00
|
|
|
FileName program = qtVersion->qmakeCommand();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-10-05 17:38:45 +02:00
|
|
|
QString makefile = workingDirectory;
|
|
|
|
|
|
|
|
|
|
if (qt4bc->subNodeBuild()) {
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!qt4bc->subNodeBuild()->makefile().isEmpty())
|
2010-10-05 17:38:45 +02:00
|
|
|
makefile.append(qt4bc->subNodeBuild()->makefile());
|
2012-04-24 15:49:09 +02:00
|
|
|
else
|
2012-01-13 14:20:45 +01:00
|
|
|
makefile.append(QLatin1String("/Makefile"));
|
2010-10-05 17:38:45 +02:00
|
|
|
} else if (!qt4bc->makefile().isEmpty()) {
|
2012-01-13 14:20:45 +01:00
|
|
|
makefile.append(QLatin1Char('/'));
|
2010-10-05 17:38:45 +02:00
|
|
|
makefile.append(qt4bc->makefile());
|
|
|
|
|
} 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
|
2013-10-16 14:00:45 +02:00
|
|
|
bool makefileOutDated = (qt4bc->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();
|
|
|
|
|
pp->setMacroExpander(qt4bc->macroExpander());
|
|
|
|
|
pp->setWorkingDirectory(workingDirectory);
|
2011-11-25 13:19:58 +01:00
|
|
|
pp->setCommand(program.toString());
|
2010-11-12 17:23:55 +01:00
|
|
|
pp->setArguments(args);
|
|
|
|
|
pp->setEnvironment(qt4bc->environment());
|
2012-11-28 15:29:55 +01:00
|
|
|
pp->resolveAll();
|
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-01-08 12:49:00 +01:00
|
|
|
QmakeProFileNode *node = static_cast<QmakeProject *>(qt4bc->target()->project())->rootProjectNode();
|
2010-10-05 17:34:28 +02:00
|
|
|
if (qt4bc->subNodeBuild())
|
|
|
|
|
node = qt4bc->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)
|
|
|
|
|
{
|
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;
|
2009-12-09 13:54:46 +01:00
|
|
|
AbstractProcessStep::run(fi);
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-01 12:33:53 +02:00
|
|
|
QStringList QMakeStep::parserArguments()
|
|
|
|
|
{
|
|
|
|
|
QStringList result;
|
2012-08-23 15:53:58 +02:00
|
|
|
for (QtcProcess::ConstArgIterator ait(allArguments()); ait.next(); )
|
2011-03-18 20:03:22 +01:00
|
|
|
if (ait.isSimple())
|
|
|
|
|
result << ait.value();
|
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
|
|
|
}
|
|
|
|
|
|
2012-08-23 15:53:58 +02:00
|
|
|
FileName QMakeStep::mkspec()
|
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
|
|
|
|
2012-03-05 22:30:59 +01:00
|
|
|
connect(m_ui->qmakeAdditonalArgumentsLineEdit, SIGNAL(textEdited(QString)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(qmakeArgumentsLineEdited()));
|
2011-05-25 11:23:25 +02:00
|
|
|
connect(m_ui->buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(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);
|
2009-11-30 16:34:30 +01:00
|
|
|
connect(step, SIGNAL(userArgumentsChanged()),
|
|
|
|
|
this, SLOT(userArgumentsChanged()));
|
2011-01-12 16:24:00 +01:00
|
|
|
connect(step, SIGNAL(linkQmlDebuggingLibraryChanged()),
|
|
|
|
|
this, SLOT(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);
|
2013-10-16 14:00:45 +02:00
|
|
|
connect(step->qmakeBuildConfiguration(), SIGNAL(qmakeBuildConfigurationChanged()),
|
2009-12-03 18:37:27 +01:00
|
|
|
this, SLOT(qmakeBuildConfigChanged()));
|
2012-09-03 18:31:44 +02:00
|
|
|
connect(step->target(), SIGNAL(kitChanged()), this, SLOT(qtVersionChanged()));
|
2012-08-13 14:53:26 +02:00
|
|
|
connect(QtSupport::QtVersionManager::instance(), SIGNAL(dumpUpdatedFor(Utils::FileName)),
|
|
|
|
|
this, SLOT(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();
|
2011-05-20 21:40:53 +02:00
|
|
|
bool debug = bc->qmakeBuildConfiguration() & QtSupport::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();
|
2011-05-20 21:40:53 +02:00
|
|
|
QtSupport::BaseQtVersion::QmakeBuildConfigs buildConfiguration = bc->qmakeBuildConfiguration();
|
2011-05-25 11:23:25 +02:00
|
|
|
if (m_ui->buildConfigurationComboBox->currentIndex() == 0) { // debug
|
2011-05-24 19:08:31 +02:00
|
|
|
buildConfiguration = buildConfiguration | QtSupport::BaseQtVersion::DebugBuild;
|
|
|
|
|
} else {
|
|
|
|
|
buildConfiguration = buildConfiguration & ~QtSupport::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
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *qtVersion = QtSupport::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
|
2010-10-19 11:14:03 +02:00
|
|
|
QString args = m_step->allArguments(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;
|
2013-06-13 17:10:32 +02:00
|
|
|
bool supported = QtSupport::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;
|
|
|
|
|
bool supported = QtSupport::BaseQtVersion::isQtQuickCompilerSupported(m_step->target()->kit(),
|
|
|
|
|
&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()
|
|
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(m_step->target()->kit());
|
2011-06-14 17:17:24 +02:00
|
|
|
QString program = tr("<No Qt version>");
|
2011-05-04 13:14:46 +02:00
|
|
|
if (qtVersion)
|
2015-01-10 23:40:32 +02:00
|
|
|
program = qtVersion->qmakeCommand().fileName();
|
2011-05-25 11:23:25 +02:00
|
|
|
m_ui->qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + m_step->allArguments());
|
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
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
bool QMakeStepFactory::canCreate(BuildStepList *parent, Core::Id id) const
|
2009-04-20 16:25:48 +02:00
|
|
|
{
|
2012-08-03 15:24:33 +02:00
|
|
|
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
2010-03-16 14:36:59 +01:00
|
|
|
return false;
|
2013-10-16 14:00:45 +02:00
|
|
|
if (!qobject_cast<QmakeBuildConfiguration *>(parent->parent()))
|
2010-01-14 17:41:29 +01:00
|
|
|
return false;
|
2012-08-03 15:24:33 +02:00
|
|
|
return id == QMAKE_BS_ID;
|
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
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!canCreate(parent, id))
|
2016-04-20 15:22:10 +02:00
|
|
|
return nullptr;
|
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
|
|
|
bool QMakeStepFactory::canClone(BuildStepList *parent, BuildStep *source) const
|
2009-10-27 14:16:28 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
return canCreate(parent, source->id());
|
2009-04-20 16:25:48 +02: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
|
|
|
if (!canClone(parent, source))
|
2016-04-20 15:22:10 +02:00
|
|
|
return nullptr;
|
2010-07-16 14:00:41 +02:00
|
|
|
return new QMakeStep(parent, qobject_cast<QMakeStep *>(source));
|
2009-04-20 16:25:48 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
bool QMakeStepFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2012-03-15 17:17:40 +01:00
|
|
|
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
ProjectExplorer::BuildStep *QMakeStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
|
2009-04-20 16:25:48 +02:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!canRestore(parent, map))
|
2016-04-20 15:22:10 +02:00
|
|
|
return nullptr;
|
2010-07-16 14:00:41 +02:00
|
|
|
QMakeStep *bs = new QMakeStep(parent);
|
2010-01-14 17:41:29 +01:00
|
|
|
if (bs->fromMap(map))
|
|
|
|
|
return bs;
|
|
|
|
|
delete bs;
|
2016-04-20 15:22:10 +02:00
|
|
|
return nullptr;
|
2009-04-20 16:25:48 +02:00
|
|
|
}
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
QList<Core::Id> QMakeStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2012-08-03 15:24:33 +02:00
|
|
|
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
2013-10-16 14:00:45 +02:00
|
|
|
if (QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration *>(parent->parent()))
|
2010-03-16 14:36:59 +01:00
|
|
|
if (!bc->qmakeStep())
|
2012-03-15 17:17:40 +01:00
|
|
|
return QList<Core::Id>() << Core::Id(QMAKE_BS_ID);
|
|
|
|
|
return QList<Core::Id>();
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
2009-04-20 16:25:48 +02:00
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
QString QMakeStepFactory::displayNameForId(Core::Id id) const
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2012-08-03 15:24:33 +02:00
|
|
|
if (id == QMAKE_BS_ID)
|
2010-02-16 13:53:29 +01:00
|
|
|
return tr("qmake");
|
2010-01-14 17:41:29 +01:00
|
|
|
return QString();
|
|
|
|
|
}
|
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)
|
|
|
|
|
arch = QMakeStepConfig::PPC;
|
|
|
|
|
else if (targetAbi.wordWidth() == 64)
|
|
|
|
|
arch = QMakeStepConfig::PPC64;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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");
|
|
|
|
|
else if (archConfig == PPC)
|
|
|
|
|
arguments << QLatin1String("CONFIG+=ppc");
|
|
|
|
|
else if (archConfig == PPC64)
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|