2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
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
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2014-03-18 16:55:20 +01:00
|
|
|
#include <coreplugin/icontext.h>
|
2013-06-13 17:10:32 +02:00
|
|
|
#include <qtsupport/debugginghelperbuildtask.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>
|
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;
|
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";
|
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) :
|
2012-03-15 17:17:40 +01:00
|
|
|
AbstractProcessStep(bsl, Core::Id(QMAKE_BS_ID)),
|
2011-01-12 16:24:00 +01:00
|
|
|
m_forced(false),
|
2011-09-22 13:36:46 +02:00
|
|
|
m_needToRunQMake(false),
|
2014-10-15 17:07:43 +02:00
|
|
|
m_linkQmlDebuggingLibrary(DebugLink),
|
|
|
|
|
m_useQtQuickCompiler(false)
|
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) :
|
2010-07-16 14:00:41 +02:00
|
|
|
AbstractProcessStep(bsl, id),
|
2011-01-12 16:24:00 +01:00
|
|
|
m_forced(false),
|
2014-10-15 17:07:43 +02:00
|
|
|
m_linkQmlDebuggingLibrary(DebugLink),
|
|
|
|
|
m_useQtQuickCompiler(false)
|
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),
|
|
|
|
|
m_useQtQuickCompiler(bs->m_useQtQuickCompiler)
|
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
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QMakeStep::~QMakeStep()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
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())
|
2010-10-07 11:14:20 +02:00
|
|
|
arguments << QDir::toNativeSeparators(bc->subNodeBuild()->path());
|
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
|
|
|
|
2012-05-03 16:15:38 +02:00
|
|
|
arguments << deducedArguments();
|
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);
|
2011-10-20 18:37:35 +00:00
|
|
|
// moreArgumentsAfter
|
2012-05-03 16:15:38 +02:00
|
|
|
foreach (const QString &arg, deducedArgumentsAfter())
|
2012-08-23 15:53:58 +02:00
|
|
|
QtcProcess::addArg(&args, arg);
|
2010-10-19 11:14:03 +02:00
|
|
|
return args;
|
2010-08-11 15:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
2010-09-01 11:36:08 +02:00
|
|
|
///
|
|
|
|
|
/// moreArguments,
|
2013-11-01 13:11:06 +01:00
|
|
|
/// iphoneos/iphonesimulator for ios
|
2010-09-22 13:03:37 +02:00
|
|
|
/// QMAKE_VAR_QMLJSDEBUGGER_PATH
|
2012-05-03 16:15:38 +02:00
|
|
|
QStringList QMakeStep::deducedArguments()
|
2010-08-11 15:32:14 +02:00
|
|
|
{
|
|
|
|
|
QStringList arguments;
|
2012-04-24 15:49:09 +02:00
|
|
|
ProjectExplorer::ToolChain *tc
|
2012-09-03 18:31:44 +02:00
|
|
|
= ProjectExplorer::ToolChainKitInformation::toolChain(target()->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-01-17 10:33:45 +01:00
|
|
|
// explicitly add architecture to CONFIG
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
2014-08-04 15:17:28 +02:00
|
|
|
arguments << QmakeBuildConfiguration::deduceArgumnetsForTargetAbi(targetAbi, version);
|
2014-11-25 18:23:15 +01:00
|
|
|
if (linkQmlDebuggingLibrary() && version && !useQtQuickCompiler()) {
|
2013-11-01 16:07:24 +01:00
|
|
|
arguments << QLatin1String(Constants::QMAKEVAR_QUICK1_DEBUG);
|
|
|
|
|
if (version->qtVersion().majorVersion >= 5)
|
|
|
|
|
arguments << QLatin1String(Constants::QMAKEVAR_QUICK2_DEBUG);
|
2011-02-14 13:37:56 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-15 17:07:43 +02:00
|
|
|
if (useQtQuickCompiler() && version)
|
|
|
|
|
arguments << QLatin1String("CONFIG+=qtquickcompiler");
|
2011-10-20 18:37:35 +00:00
|
|
|
|
|
|
|
|
return arguments;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-17 10:33:45 +01:00
|
|
|
/// -after OBJECTS_DIR, MOC_DIR, UI_DIR, RCC_DIR
|
2012-05-03 16:15:38 +02:00
|
|
|
QStringList QMakeStep::deducedArgumentsAfter()
|
2011-10-20 18:37:35 +00:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
2012-06-25 09:29:59 +03:00
|
|
|
if (version && !version->supportsShadowBuilds()) {
|
2010-05-10 13:47:15 +02:00
|
|
|
// We have a target which does not allow shadow building.
|
|
|
|
|
// But we really don't want to have the build artefacts in the source dir
|
|
|
|
|
// so we try to hack around it, to make the common cases work.
|
2012-08-22 13:27:25 +02:00
|
|
|
// This is a HACK, remove once all make generators support
|
2010-05-10 13:47:15 +02:00
|
|
|
// shadow building
|
2011-10-20 18:37:35 +00:00
|
|
|
return QStringList() << QLatin1String("-after")
|
|
|
|
|
<< QLatin1String("OBJECTS_DIR=obj")
|
|
|
|
|
<< QLatin1String("MOC_DIR=moc")
|
|
|
|
|
<< QLatin1String("UI_DIR=ui")
|
|
|
|
|
<< QLatin1String("RCC_DIR=rcc");
|
2010-05-10 13:47:15 +02:00
|
|
|
}
|
2011-10-20 18:37:35 +00:00
|
|
|
return QStringList();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
bool QMakeStep::init()
|
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
|
|
|
|
2013-10-29 14:22:31 +01:00
|
|
|
QmakeProFileNode *node = static_cast<QmakeProject *>(qt4bc->target()->project())->rootQmakeProjectNode();
|
2010-10-05 17:34:28 +02:00
|
|
|
if (qt4bc->subNodeBuild())
|
|
|
|
|
node = qt4bc->subNodeBuild();
|
|
|
|
|
QString proFile = node->path();
|
|
|
|
|
|
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
|
|
|
|
2009-12-09 13:54:46 +01:00
|
|
|
return AbstractProcessStep::init();
|
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) {
|
2008-12-02 12:01:29 +01:00
|
|
|
fi.reportResult(true);
|
|
|
|
|
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);
|
2008-12-02 12:01:29 +01:00
|
|
|
fi.reportResult(true);
|
2013-02-12 12:56:02 +01:00
|
|
|
emit finished();
|
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
|
|
|
|
|
{
|
2011-05-13 17:41:02 +02:00
|
|
|
if (m_linkQmlDebuggingLibrary == DoLink)
|
|
|
|
|
return true;
|
|
|
|
|
if (m_linkQmlDebuggingLibrary == DoNotLink)
|
|
|
|
|
return false;
|
2014-03-18 16:55:20 +01:00
|
|
|
|
|
|
|
|
const Core::Context languages = project()->projectLanguages();
|
|
|
|
|
if (!languages.contains(ProjectExplorer::Constants::LANG_QMLJS))
|
|
|
|
|
return false;
|
2013-10-16 14:00:45 +02:00
|
|
|
return (qmakeBuildConfiguration()->buildType() & BuildConfiguration::Debug);
|
2011-01-12 16:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
|
|
|
|
|
{
|
2011-05-13 17:41:02 +02:00
|
|
|
if ((enable && (m_linkQmlDebuggingLibrary == DoLink))
|
|
|
|
|
|| (!enable && (m_linkQmlDebuggingLibrary == DoNotLink)))
|
2011-01-12 16:24:00 +01:00
|
|
|
return;
|
2011-05-13 17:41:02 +02:00
|
|
|
m_linkQmlDebuggingLibrary = enable ? DoLink : DoNotLink;
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
2011-05-13 17:41:02 +02:00
|
|
|
map.insert(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), m_linkQmlDebuggingLibrary == DebugLink);
|
|
|
|
|
map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary == DoLink);
|
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);
|
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();
|
2011-05-13 17:41:02 +02:00
|
|
|
if (map.value(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), false).toBool()) {
|
|
|
|
|
m_linkQmlDebuggingLibrary = DebugLink;
|
|
|
|
|
} else {
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool())
|
2011-05-13 17:41:02 +02:00
|
|
|
m_linkQmlDebuggingLibrary = DoLink;
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
else
|
2011-05-13 17:41:02 +02:00
|
|
|
m_linkQmlDebuggingLibrary = DoNotLink;
|
|
|
|
|
}
|
|
|
|
|
|
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)
|
2011-11-23 15:15:01 +00:00
|
|
|
: BuildStepConfigWidget(), m_ui(new Internal::Ui::QMakeStep), m_step(step),
|
2011-05-25 11:23:25 +02:00
|
|
|
m_ignoreChange(false)
|
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());
|
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);
|
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);
|
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
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
connect(question, SIGNAL(finished(int)), this, SLOT(recompileMessageBoxFinished(int)));
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
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(),
|
2014-11-25 18:23:15 +01:00
|
|
|
&warningText)
|
|
|
|
|
&& !m_step->useQtQuickCompiler();
|
|
|
|
|
|
2013-06-13 17:10:32 +02:00
|
|
|
m_ui->qmlDebuggingLibraryCheckBox->setEnabled(supported);
|
|
|
|
|
m_ui->debuggingLibraryLabel->setText(tr("Enable QML debugging:"));
|
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());
|
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:"));
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QMakeStepFactory::~QMakeStepFactory()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
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))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
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))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
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))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
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;
|
|
|
|
|
return 0;
|
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();
|
|
|
|
|
}
|