2010-02-08 15:50:06 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2010-02-08 15:50:06 +01:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2010-02-08 15:50:06 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2010-02-08 15:50:06 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2010-02-08 15:50:06 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "qt4target.h"
|
2011-03-02 15:01:17 +01:00
|
|
|
#include "buildconfigurationinfo.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
#include "makestep.h"
|
|
|
|
|
#include "qmakestep.h"
|
|
|
|
|
#include "qt4project.h"
|
2011-03-02 15:01:17 +01:00
|
|
|
#include "qt4basetargetfactory.h"
|
2010-12-06 12:45:05 +01:00
|
|
|
#include "qt4projectconfigwidget.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2010-12-10 19:02:19 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2010-12-10 19:02:19 +01:00
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2010-03-30 18:45:04 +02:00
|
|
|
#include <projectexplorer/customexecutablerunconfiguration.h>
|
2011-02-01 18:36:00 +01:00
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2011-02-21 15:30:05 +01:00
|
|
|
#include <projectexplorer/task.h>
|
|
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
#include <utils/detailswidget.h>
|
|
|
|
|
|
|
|
|
|
#include <QtGui/QPushButton>
|
|
|
|
|
#include <QtGui/QMessageBox>
|
|
|
|
|
#include <QtGui/QCheckBox>
|
2011-03-15 18:22:12 +01:00
|
|
|
#include <QtGui/QComboBox>
|
2011-02-21 15:30:05 +01:00
|
|
|
#include <QtGui/QMainWindow>
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
using namespace Qt4ProjectManager;
|
|
|
|
|
using namespace Qt4ProjectManager::Internal;
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2010-12-10 19:02:19 +01:00
|
|
|
// Qt4BaseTargetFactory
|
2010-02-08 15:50:06 +01:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4BaseTargetFactory::Qt4BaseTargetFactory(QObject *parent) :
|
2010-02-08 15:50:06 +01:00
|
|
|
ITargetFactory(parent)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4BaseTargetFactory::~Qt4BaseTargetFactory()
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
|
|
|
|
|
2010-02-17 16:18:21 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
Qt4TargetSetupWidget *Qt4BaseTargetFactory::createTargetSetupWidget(const QString &id,
|
|
|
|
|
const QString &proFilePath,
|
|
|
|
|
const QtVersionNumber &number,
|
|
|
|
|
bool importEnabled,
|
|
|
|
|
QList<BuildConfigurationInfo> importInfos)
|
|
|
|
|
{
|
2011-02-24 12:33:01 +01:00
|
|
|
QList<BuildConfigurationInfo> infos = this->availableBuildConfigurations(id, proFilePath, number);
|
|
|
|
|
if (infos.isEmpty())
|
|
|
|
|
return 0;
|
|
|
|
|
return new Qt4DefaultTargetSetupWidget(this, id, proFilePath, infos, number, importEnabled, importInfos);
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
2011-03-02 15:01:17 +01:00
|
|
|
ProjectExplorer::Target *Qt4BaseTargetFactory::create(ProjectExplorer::Project *parent, const QString &id, Qt4TargetSetupWidget *widget)
|
2011-02-21 15:30:05 +01:00
|
|
|
{
|
|
|
|
|
if (!widget->isTargetSelected())
|
|
|
|
|
return 0;
|
|
|
|
|
Q_ASSERT(qobject_cast<Qt4DefaultTargetSetupWidget *>(widget));
|
|
|
|
|
Qt4DefaultTargetSetupWidget *w = static_cast<Qt4DefaultTargetSetupWidget *>(widget);
|
2011-03-15 18:22:12 +01:00
|
|
|
w->storeSettings();
|
2011-02-21 15:30:05 +01:00
|
|
|
return create(parent, id, w->buildConfigurationInfos());
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-23 13:32:42 +01:00
|
|
|
QList<BuildConfigurationInfo> Qt4BaseTargetFactory::availableBuildConfigurations(const QString &id, const QString &proFilePath, const QtVersionNumber &minimumQtVersion)
|
|
|
|
|
{
|
|
|
|
|
QList<BuildConfigurationInfo> infoList;
|
|
|
|
|
QList<QtVersion *> knownVersions = QtVersionManager::instance()->versionsForTargetId(id, minimumQtVersion);
|
|
|
|
|
|
|
|
|
|
foreach (QtVersion *version, knownVersions) {
|
|
|
|
|
if (!version->isValid() || !version->toolChainAvailable())
|
|
|
|
|
continue;
|
|
|
|
|
QtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
|
|
|
|
|
BuildConfigurationInfo info = BuildConfigurationInfo(version, config, QString(), QString());
|
|
|
|
|
info.directory = shadowBuildDirectory(proFilePath, id, msgBuildConfigurationName(info));
|
|
|
|
|
infoList.append(info);
|
|
|
|
|
|
|
|
|
|
info.buildConfig = config ^ QtVersion::DebugBuild;
|
|
|
|
|
info.directory = shadowBuildDirectory(proFilePath, id, msgBuildConfigurationName(info));
|
|
|
|
|
infoList.append(info);
|
|
|
|
|
}
|
|
|
|
|
return infoList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString sanitize(const QString &input)
|
|
|
|
|
{
|
|
|
|
|
QString result;
|
|
|
|
|
result.reserve(input.size());
|
|
|
|
|
foreach (const QChar &c, input) {
|
|
|
|
|
if ((c >= 'a' && c <='z')
|
|
|
|
|
|| (c >= 'A' && c <= 'Z')
|
|
|
|
|
|| (c >= '0' && c <= '9')
|
|
|
|
|
|| c == '-'
|
|
|
|
|
|| c == '_')
|
|
|
|
|
result.append(c);
|
|
|
|
|
else
|
|
|
|
|
result.append('_');
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString projectDirectory(const QString &proFile)
|
|
|
|
|
{
|
|
|
|
|
if (proFile.isEmpty())
|
|
|
|
|
return QString();
|
|
|
|
|
QFileInfo info(proFile);
|
|
|
|
|
return info.absoluteDir().path();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString Qt4BaseTargetFactory::shadowBuildDirectory(const QString &profilePath, const QString &id, const QString &suffix)
|
|
|
|
|
{
|
|
|
|
|
if (profilePath.isEmpty())
|
|
|
|
|
return QString();
|
|
|
|
|
QFileInfo info(profilePath);
|
|
|
|
|
|
|
|
|
|
QString base = QDir::cleanPath(projectDirectory(profilePath) + QLatin1String("/../") + info.baseName() + QLatin1String("-build-"));
|
|
|
|
|
return base + buildNameForId(id) + QLatin1String("-") + sanitize(suffix);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString Qt4BaseTargetFactory::buildNameForId(const QString &id) const
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(id);
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4BaseTargetFactory *Qt4BaseTargetFactory::qt4BaseTargetFactoryForId(const QString &id)
|
2010-03-26 10:26:28 +01:00
|
|
|
{
|
2010-12-10 19:02:19 +01:00
|
|
|
QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<Qt4BaseTargetFactory>();
|
|
|
|
|
foreach (Qt4BaseTargetFactory *fac, factories) {
|
|
|
|
|
if (fac->supportsTargetId(id))
|
|
|
|
|
return fac;
|
2010-03-26 10:26:28 +01:00
|
|
|
}
|
2010-02-08 15:50:06 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-18 09:59:49 +01:00
|
|
|
// Return name of a build configuration.
|
|
|
|
|
QString Qt4BaseTargetFactory::msgBuildConfigurationName(const BuildConfigurationInfo &info)
|
|
|
|
|
{
|
|
|
|
|
const QString qtVersionName = info.version->displayName();
|
|
|
|
|
return (info.buildConfig & QtVersion::DebugBuild) ?
|
|
|
|
|
//: Name of a debug build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
|
|
|
|
|
tr("%1 Debug").arg(qtVersionName) :
|
|
|
|
|
//: Name of a release build configuration to created by a project wizard, %1 being the Qt version name. We recommend not translating it.
|
|
|
|
|
tr("%1 Release").arg(qtVersionName);
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-11 15:58:33 +01:00
|
|
|
QList<ProjectExplorer::Task> Qt4BaseTargetFactory::reportIssues(const QString &proFile)
|
|
|
|
|
{
|
2011-03-16 17:36:01 +01:00
|
|
|
Q_UNUSED(proFile);
|
2011-03-11 15:58:33 +01:00
|
|
|
return QList<ProjectExplorer::Task>();
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
// -------------------------------------------------------------------------
|
2010-12-10 19:02:19 +01:00
|
|
|
// Qt4BaseTarget
|
2010-02-08 15:50:06 +01:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4BaseTarget::Qt4BaseTarget(Qt4Project *parent, const QString &id) :
|
|
|
|
|
ProjectExplorer::Target(parent, id)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
|
|
|
|
connect(this, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
2010-03-10 16:55:37 +01:00
|
|
|
this, SLOT(emitProFileEvaluateNeeded()));
|
2010-02-08 15:50:06 +01:00
|
|
|
connect(this, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
|
|
|
|
this, SIGNAL(environmentChanged()));
|
2010-02-15 17:33:56 +01:00
|
|
|
connect(this, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
|
|
|
|
|
this, SLOT(onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4BaseTarget::~Qt4BaseTarget()
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
ProjectExplorer::BuildConfigWidget *Qt4BaseTarget::createConfigWidget()
|
2010-12-06 12:45:05 +01:00
|
|
|
{
|
|
|
|
|
return new Qt4ProjectConfigWidget(this);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4BuildConfiguration *Qt4BaseTarget::activeBuildConfiguration() const
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
|
|
|
|
return static_cast<Qt4BuildConfiguration *>(Target::activeBuildConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
Qt4Project *Qt4BaseTarget::qt4Project() const
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
|
|
|
|
return static_cast<Qt4Project *>(project());
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
QList<ProjectExplorer::ToolChain *> Qt4BaseTarget::possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const
|
2010-12-10 19:02:19 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
QList<ProjectExplorer::ToolChain *> tmp;
|
|
|
|
|
QList<ProjectExplorer::ToolChain *> result;
|
2010-12-10 19:02:19 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(bc);
|
|
|
|
|
if (!qt4bc && !qt4bc->qtVersion()->isValid())
|
|
|
|
|
return tmp;
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::Abi> abiList = qt4bc->qtVersion()->qtAbis();
|
|
|
|
|
foreach (const ProjectExplorer::Abi &abi, abiList)
|
|
|
|
|
tmp.append(ProjectExplorer::ToolChainManager::instance()->findToolChains(abi));
|
|
|
|
|
|
|
|
|
|
foreach (ProjectExplorer::ToolChain *tc, tmp) {
|
|
|
|
|
if (result.contains(tc))
|
|
|
|
|
continue;
|
|
|
|
|
if (tc->restrictedToTargets().isEmpty() || tc->restrictedToTargets().contains(id()))
|
|
|
|
|
result.append(tc);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
2010-12-10 19:02:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4BaseTarget::removeUnconfiguredCustomExectutableRunConfigurations()
|
|
|
|
|
{
|
|
|
|
|
if (runConfigurations().count()) {
|
|
|
|
|
// Remove all run configurations which the new project wizard created
|
|
|
|
|
QList<ProjectExplorer::RunConfiguration*> toRemove;
|
|
|
|
|
foreach (ProjectExplorer::RunConfiguration * rc, runConfigurations()) {
|
|
|
|
|
ProjectExplorer::CustomExecutableRunConfiguration *cerc
|
|
|
|
|
= qobject_cast<ProjectExplorer::CustomExecutableRunConfiguration *>(rc);
|
|
|
|
|
if (cerc && !cerc->isConfigured())
|
|
|
|
|
toRemove.append(rc);
|
|
|
|
|
}
|
|
|
|
|
foreach (ProjectExplorer::RunConfiguration *rc, toRemove)
|
|
|
|
|
removeRunConfiguration(rc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Qt4BuildConfiguration *Qt4BaseTarget::addQt4BuildConfiguration(QString displayName, QtVersion *qtversion,
|
2010-02-08 15:50:06 +01:00
|
|
|
QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
2010-10-19 11:14:03 +02:00
|
|
|
QString additionalArguments,
|
2010-03-26 10:26:28 +01:00
|
|
|
QString directory)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
|
|
|
|
Q_ASSERT(qtversion);
|
|
|
|
|
bool debug = qmakeBuildConfiguration & QtVersion::DebugBuild;
|
|
|
|
|
|
|
|
|
|
// Add the buildconfiguration
|
|
|
|
|
Qt4BuildConfiguration *bc = new Qt4BuildConfiguration(this);
|
2010-08-19 12:26:21 +02:00
|
|
|
bc->setDefaultDisplayName(displayName);
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
|
|
|
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(buildSteps);
|
|
|
|
|
Q_ASSERT(cleanSteps);
|
|
|
|
|
|
|
|
|
|
QMakeStep *qmakeStep = new QMakeStep(buildSteps);
|
|
|
|
|
buildSteps->insertStep(0, qmakeStep);
|
|
|
|
|
|
|
|
|
|
MakeStep *makeStep = new MakeStep(buildSteps);
|
|
|
|
|
buildSteps->insertStep(1, makeStep);
|
2010-03-23 18:54:04 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
MakeStep* cleanStep = new MakeStep(cleanSteps);
|
2010-02-08 15:50:06 +01:00
|
|
|
cleanStep->setClean(true);
|
2010-10-19 11:14:03 +02:00
|
|
|
cleanStep->setUserArguments("clean");
|
2010-07-16 14:00:41 +02:00
|
|
|
cleanSteps->insertStep(0, cleanStep);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!additionalArguments.isEmpty())
|
|
|
|
|
qmakeStep->setUserArguments(additionalArguments);
|
|
|
|
|
|
|
|
|
|
// set some options for qmake and make
|
|
|
|
|
if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets
|
2010-10-19 11:14:03 +02:00
|
|
|
makeStep->setUserArguments(debug ? "debug" : "release");
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
bc->setQMakeBuildConfiguration(qmakeBuildConfiguration);
|
|
|
|
|
|
2011-03-16 17:59:43 +01:00
|
|
|
// Finally set the qt version & tool chain
|
2010-02-08 15:50:06 +01:00
|
|
|
bc->setQtVersion(qtversion);
|
2010-03-26 10:26:28 +01:00
|
|
|
if (!directory.isEmpty())
|
|
|
|
|
bc->setShadowBuildAndDirectory(directory != project()->projectDirectory(), directory);
|
2010-02-08 15:50:06 +01:00
|
|
|
addBuildConfiguration(bc);
|
|
|
|
|
|
|
|
|
|
return bc;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
void Qt4BaseTarget::onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
|
2010-02-15 17:33:56 +01:00
|
|
|
{
|
|
|
|
|
Q_ASSERT(bc);
|
|
|
|
|
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(bc);
|
|
|
|
|
Q_ASSERT(qt4bc);
|
|
|
|
|
connect(qt4bc, SIGNAL(buildDirectoryInitialized()),
|
|
|
|
|
this, SIGNAL(buildDirectoryInitialized()));
|
2010-12-06 13:29:18 +01:00
|
|
|
connect(qt4bc, SIGNAL(proFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration *)),
|
|
|
|
|
this, SLOT(onProFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration *)));
|
2010-02-15 17:33:56 +01:00
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
void Qt4BaseTarget::onProFileEvaluateNeeded(Qt4ProjectManager::Qt4BuildConfiguration *bc)
|
2010-02-16 13:05:32 +01:00
|
|
|
{
|
|
|
|
|
if (bc && bc == activeBuildConfiguration())
|
2010-03-10 16:55:37 +01:00
|
|
|
emit proFileEvaluateNeeded(this);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
void Qt4BaseTarget::emitProFileEvaluateNeeded()
|
2010-03-10 16:55:37 +01:00
|
|
|
{
|
|
|
|
|
emit proFileEvaluateNeeded(this);
|
2010-02-16 13:05:32 +01:00
|
|
|
}
|
2011-02-21 15:30:05 +01:00
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// Qt4TargetSetupWidget
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
2011-03-02 15:01:17 +01:00
|
|
|
Qt4TargetSetupWidget::Qt4TargetSetupWidget(QWidget *parent)
|
|
|
|
|
: QWidget(parent)
|
2011-02-21 15:30:05 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Qt4TargetSetupWidget::~Qt4TargetSetupWidget()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// Qt4DefaultTargetSetupWidget
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
2011-03-14 14:41:30 +01:00
|
|
|
QString issuesListToString(const QList<ProjectExplorer::Task> &issues)
|
|
|
|
|
{
|
|
|
|
|
QStringList lines;
|
|
|
|
|
foreach (const ProjectExplorer::Task &t, issues) {
|
|
|
|
|
// set severity:
|
|
|
|
|
QString severity;
|
|
|
|
|
if (t.type == ProjectExplorer::Task::Error)
|
|
|
|
|
severity = QCoreApplication::translate("Qt4DefaultTargetSetupWidget", "<b>Error:</b> ", "Severity is Task::Error");
|
|
|
|
|
else if (t.type == ProjectExplorer::Task::Warning)
|
|
|
|
|
severity = QCoreApplication::translate("Qt4DefaultTargetSetupWidget", "<b>Warning:</b> ", "Severity is Task::Warning");
|
|
|
|
|
lines.append(severity + t.description);
|
|
|
|
|
}
|
|
|
|
|
return lines.join("<br>");
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *factory,
|
|
|
|
|
const QString &id,
|
|
|
|
|
const QString &proFilePath,
|
2011-02-24 12:33:01 +01:00
|
|
|
const QList<BuildConfigurationInfo> &infos,
|
2011-02-21 15:30:05 +01:00
|
|
|
const QtVersionNumber &minimumQtVersion,
|
|
|
|
|
bool importEnabled,
|
2011-02-24 12:33:01 +01:00
|
|
|
const QList<BuildConfigurationInfo> &importInfos)
|
2011-02-21 15:30:05 +01:00
|
|
|
: Qt4TargetSetupWidget(),
|
|
|
|
|
m_id(id),
|
|
|
|
|
m_factory(factory),
|
|
|
|
|
m_proFilePath(proFilePath),
|
|
|
|
|
m_minimumQtVersion(minimumQtVersion),
|
|
|
|
|
m_importInfos(importInfos),
|
|
|
|
|
m_directoriesEnabled(true),
|
|
|
|
|
m_hasInSourceBuild(false),
|
|
|
|
|
m_ignoreChange(false),
|
|
|
|
|
m_showImport(importEnabled),
|
2011-03-15 18:22:12 +01:00
|
|
|
m_buildConfigurationTemplateUnchanged(true),
|
2011-03-29 19:41:33 +02:00
|
|
|
m_shadowBuildCheckBoxVisible(false),
|
2011-03-15 18:22:12 +01:00
|
|
|
m_selected(0),
|
|
|
|
|
m_qtVersionId(-1)
|
2011-02-21 15:30:05 +01:00
|
|
|
{
|
2011-03-15 18:22:12 +01:00
|
|
|
QSettings *s = Core::ICore::instance()->settings();
|
2011-02-21 15:30:05 +01:00
|
|
|
QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
|
|
|
|
|
|
|
|
|
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
|
|
|
|
QVBoxLayout *vboxLayout = new QVBoxLayout();
|
|
|
|
|
vboxLayout->setMargin(0);
|
|
|
|
|
setLayout(vboxLayout);
|
|
|
|
|
m_detailsWidget = new Utils::DetailsWidget(this);
|
|
|
|
|
m_detailsWidget->setSummaryText(factory->displayNameForId(id));
|
|
|
|
|
m_detailsWidget->setUseCheckBox(true);
|
|
|
|
|
m_detailsWidget->setChecked(true);
|
|
|
|
|
m_detailsWidget->setSummaryFontBold(true);
|
|
|
|
|
m_detailsWidget->setIcon(factory->iconForId(id));
|
2011-03-14 14:41:30 +01:00
|
|
|
m_detailsWidget->setAdditionalSummaryText(issuesListToString(factory->reportIssues(m_proFilePath)));
|
2011-02-21 15:30:05 +01:00
|
|
|
vboxLayout->addWidget(m_detailsWidget);
|
|
|
|
|
|
|
|
|
|
QWidget *widget = new QWidget;
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout;
|
|
|
|
|
widget->setLayout(layout);
|
|
|
|
|
|
|
|
|
|
m_importLayout = new QGridLayout;
|
|
|
|
|
m_importLayout->setMargin(0);
|
|
|
|
|
layout->addLayout(m_importLayout);
|
|
|
|
|
|
|
|
|
|
m_importLineLayout = new QHBoxLayout();
|
|
|
|
|
m_importLineLabel = new QLabel();
|
2011-03-16 17:47:05 +01:00
|
|
|
m_importLineLabel->setText(tr("Add build from:"));
|
2011-02-21 15:30:05 +01:00
|
|
|
m_importLineLayout->addWidget(m_importLineLabel);
|
|
|
|
|
|
|
|
|
|
m_importLinePath = new Utils::PathChooser();
|
|
|
|
|
m_importLinePath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
|
|
|
|
m_importLinePath->setPath(sourceDir);
|
|
|
|
|
m_importLineLayout->addWidget(m_importLinePath);
|
|
|
|
|
|
|
|
|
|
m_importLineButton = new QPushButton;
|
|
|
|
|
m_importLineButton->setText(tr("Add Build"));
|
|
|
|
|
m_importLineLayout->addWidget(m_importLineButton);
|
2011-03-17 20:26:00 +01:00
|
|
|
m_importLineLayout->addStretch();
|
2011-02-21 15:30:05 +01:00
|
|
|
layout->addLayout(m_importLineLayout);
|
|
|
|
|
|
2011-03-17 20:26:00 +01:00
|
|
|
m_importLineLabel->setVisible(false);
|
|
|
|
|
m_importLinePath->setVisible(false);
|
|
|
|
|
m_importLineButton->setVisible(m_showImport);
|
2011-02-21 15:30:05 +01:00
|
|
|
|
|
|
|
|
m_spacerTopWidget = new QWidget;
|
|
|
|
|
m_spacerTopWidget->setMinimumHeight(12);
|
|
|
|
|
layout->addWidget(m_spacerTopWidget);
|
|
|
|
|
|
2011-03-15 18:22:12 +01:00
|
|
|
m_buildConfigurationLabel = new QLabel;
|
2011-03-29 19:30:12 +02:00
|
|
|
m_buildConfigurationLabel->setText("Create Build Configurations:");
|
2011-03-15 18:22:12 +01:00
|
|
|
m_buildConfigurationLabel->setVisible(false);
|
|
|
|
|
|
|
|
|
|
m_buildConfigurationComboBox = new QComboBox;
|
|
|
|
|
m_buildConfigurationComboBox->addItem("per Qt Version a Debug and Release", PERQT);
|
|
|
|
|
m_buildConfigurationComboBox->addItem("for one Qt Version a Debug and Release", ONEQT);
|
|
|
|
|
m_buildConfigurationComboBox->addItem("manually", MANUALLY);
|
|
|
|
|
m_buildConfigurationComboBox->addItem("none", NONE);
|
|
|
|
|
|
|
|
|
|
if (m_importInfos.isEmpty())
|
|
|
|
|
m_buildConfigurationComboBox->setCurrentIndex(s->value("Qt4ProjectManager.TargetSetupPage.BuildTemplate", 0).toInt());
|
|
|
|
|
else
|
|
|
|
|
m_buildConfigurationComboBox->setCurrentIndex(3); // NONE
|
|
|
|
|
|
|
|
|
|
m_buildConfigurationComboBox->setVisible(false);
|
|
|
|
|
|
|
|
|
|
QHBoxLayout *hbox = new QHBoxLayout();
|
|
|
|
|
hbox->addWidget(m_buildConfigurationLabel);
|
|
|
|
|
hbox->addWidget(m_buildConfigurationComboBox);
|
|
|
|
|
hbox->addStretch();
|
|
|
|
|
layout->addLayout(hbox);
|
|
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
m_shadowBuildEnabled = new QCheckBox;
|
|
|
|
|
m_shadowBuildEnabled->setText(tr("Use Shadow Building"));
|
|
|
|
|
m_shadowBuildEnabled->setVisible(false);
|
2011-03-15 18:22:12 +01:00
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
layout->addWidget(m_shadowBuildEnabled);
|
|
|
|
|
|
2011-03-15 18:22:12 +01:00
|
|
|
m_versionLabel = new QLabel;
|
|
|
|
|
m_versionLabel->setText("Qt Version:");
|
|
|
|
|
m_versionLabel->setVisible(false);
|
|
|
|
|
m_versionComboBox = new QComboBox;
|
|
|
|
|
m_versionComboBox->setVisible(false);
|
|
|
|
|
hbox = new QHBoxLayout();
|
|
|
|
|
hbox->addWidget(m_versionLabel);
|
|
|
|
|
hbox->addWidget(m_versionComboBox);
|
|
|
|
|
hbox->addStretch();
|
|
|
|
|
layout->addLayout(hbox);
|
|
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
m_spacerBottomWidget = new QWidget;
|
|
|
|
|
m_spacerBottomWidget->setMinimumHeight(0);
|
|
|
|
|
layout->addWidget(m_spacerBottomWidget);
|
|
|
|
|
|
|
|
|
|
m_newBuildsLayout = new QGridLayout;
|
|
|
|
|
m_newBuildsLayout->setMargin(0);
|
|
|
|
|
layout->addLayout(m_newBuildsLayout);
|
|
|
|
|
|
|
|
|
|
m_spacerTopWidget->setVisible(false);
|
|
|
|
|
m_spacerBottomWidget->setVisible(false);
|
|
|
|
|
|
|
|
|
|
m_detailsWidget->setWidget(widget);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < m_importInfos.size(); ++i) {
|
|
|
|
|
if (m_importInfos.at(i).directory == sourceDir)
|
|
|
|
|
m_hasInSourceBuild = true;
|
|
|
|
|
m_importEnabled << true;
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-15 18:22:12 +01:00
|
|
|
if (m_hasInSourceBuild)
|
|
|
|
|
m_shadowBuildEnabled->setChecked(false);
|
|
|
|
|
else
|
|
|
|
|
m_shadowBuildEnabled->setChecked(s->value("Qt4ProjectManager.TargetSetupPage.ShadowBuilding", true).toBool());
|
|
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
m_selected += m_importInfos.size();
|
|
|
|
|
|
|
|
|
|
setupImportWidgets();
|
|
|
|
|
|
2011-02-24 12:33:01 +01:00
|
|
|
setBuildConfigurationInfos(infos);
|
2011-02-21 15:30:05 +01:00
|
|
|
|
2011-03-15 18:22:12 +01:00
|
|
|
int qtVersionId = s->value("Qt4ProjectManager.TargetSetupPage.QtVersionId", -1).toInt();
|
|
|
|
|
int index = m_versionComboBox->findData(qtVersionId);
|
|
|
|
|
if (index != -1)
|
|
|
|
|
m_versionComboBox->setCurrentIndex(index);
|
|
|
|
|
qtVersionChanged();
|
|
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
if (!m_importInfos.isEmpty())
|
|
|
|
|
m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
|
|
|
|
|
|
|
|
|
|
connect(m_importLineButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(addImportClicked()));
|
|
|
|
|
|
|
|
|
|
connect(m_detailsWidget, SIGNAL(checked(bool)),
|
2011-03-31 20:32:05 +02:00
|
|
|
this, SLOT(targetCheckBoxToggled(bool)));
|
2011-02-21 15:30:05 +01:00
|
|
|
connect(m_shadowBuildEnabled, SIGNAL(toggled(bool)),
|
|
|
|
|
this, SLOT(shadowBuildingToggled()));
|
2011-03-15 18:22:12 +01:00
|
|
|
connect(m_buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
this, SLOT(buildConfigurationComboBoxChanged()));
|
|
|
|
|
connect(m_versionComboBox, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
this, SLOT(qtVersionChanged()));
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Qt4DefaultTargetSetupWidget::~Qt4DefaultTargetSetupWidget()
|
|
|
|
|
{
|
2011-03-15 18:22:12 +01:00
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Qt4DefaultTargetSetupWidget::isTargetSelected() const
|
|
|
|
|
{
|
2011-03-15 18:22:12 +01:00
|
|
|
if (!m_detailsWidget->isChecked())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return !buildConfigurationInfos().isEmpty();
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::setTargetSelected(bool b)
|
|
|
|
|
{
|
|
|
|
|
// Only check target if there are build configurations possible
|
|
|
|
|
b == b && !buildConfigurationInfos().isEmpty();
|
2011-03-31 20:32:05 +02:00
|
|
|
m_ignoreChange = true;
|
2011-02-21 15:30:05 +01:00
|
|
|
m_detailsWidget->setChecked(b);
|
2011-03-31 20:32:05 +02:00
|
|
|
m_ignoreChange = false;
|
2011-02-21 15:30:05 +01:00
|
|
|
// We want the shadow build option to be visible
|
2011-03-15 18:22:12 +01:00
|
|
|
if (b && (m_shadowBuildEnabled->isVisibleTo(m_shadowBuildEnabled->parentWidget())
|
|
|
|
|
|| m_buildConfigurationComboBox->isVisibleTo(m_buildConfigurationComboBox->parentWidget())))
|
2011-02-21 15:30:05 +01:00
|
|
|
m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-31 20:32:05 +02:00
|
|
|
void Qt4DefaultTargetSetupWidget::targetCheckBoxToggled(bool b)
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
m_detailsWidget->widget()->setEnabled(b);
|
|
|
|
|
if (b) {
|
|
|
|
|
foreach (bool error, m_issues) {
|
|
|
|
|
if (error) {
|
|
|
|
|
m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
emit selectedToggled();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
QString Qt4DefaultTargetSetupWidget::displayNameFrom(const BuildConfigurationInfo &info)
|
|
|
|
|
{
|
|
|
|
|
QString buildType;
|
|
|
|
|
if ((info.buildConfig & QtVersion::BuildAll) == 0) {
|
|
|
|
|
if (info.buildConfig & QtVersion::DebugBuild)
|
|
|
|
|
//: Debug build
|
|
|
|
|
buildType = tr("debug");
|
|
|
|
|
else
|
|
|
|
|
//: release build
|
|
|
|
|
buildType = tr("release");
|
|
|
|
|
}
|
2011-02-25 15:27:13 +01:00
|
|
|
return info.version->displayName() + ' ' + buildType;
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::setProFilePath(const QString &proFilePath)
|
|
|
|
|
{
|
|
|
|
|
m_proFilePath = proFilePath;
|
2011-03-14 14:41:30 +01:00
|
|
|
m_detailsWidget->setAdditionalSummaryText(issuesListToString(m_factory->reportIssues(m_proFilePath)));
|
2011-02-21 15:30:05 +01:00
|
|
|
setBuildConfigurationInfos(m_factory->availableBuildConfigurations(m_id, proFilePath, m_minimumQtVersion), false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::setShadowBuildCheckBoxVisible(bool b)
|
|
|
|
|
{
|
2011-03-29 19:41:33 +02:00
|
|
|
m_shadowBuildCheckBoxVisible = b;
|
2011-02-21 15:30:05 +01:00
|
|
|
m_shadowBuildEnabled->setVisible(b);
|
2011-03-15 18:22:12 +01:00
|
|
|
bool anythingVisible = b || m_buildConfigurationComboBox->isVisible();
|
|
|
|
|
m_spacerTopWidget->setVisible(anythingVisible && !m_importInfos.isEmpty());
|
|
|
|
|
m_spacerBottomWidget->setVisible(anythingVisible);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::setBuildConfiguraionComboBoxVisible(bool b)
|
|
|
|
|
{
|
|
|
|
|
m_buildConfigurationLabel->setVisible(true);
|
|
|
|
|
m_buildConfigurationComboBox->setVisible(true);
|
|
|
|
|
bool anythingVisible = b || m_shadowBuildEnabled->isVisible();
|
|
|
|
|
m_spacerTopWidget->setVisible(anythingVisible && !m_importInfos.isEmpty());
|
|
|
|
|
m_spacerBottomWidget->setVisible(anythingVisible);
|
|
|
|
|
updateWidgetVisibility();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Qt4DefaultTargetSetupWidget::BuildConfigurationTemplate Qt4DefaultTargetSetupWidget::buildConfigurationTemplate() const
|
|
|
|
|
{
|
|
|
|
|
if (!m_buildConfigurationComboBox->isVisibleTo(m_buildConfigurationComboBox->parentWidget()))
|
|
|
|
|
return MANUALLY; // the default
|
|
|
|
|
return static_cast<BuildConfigurationTemplate>(m_buildConfigurationComboBox->itemData(m_buildConfigurationComboBox->currentIndex()).toInt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::setBuildConfigurationTemplate(Qt4DefaultTargetSetupWidget::BuildConfigurationTemplate value)
|
|
|
|
|
{
|
|
|
|
|
int index = m_buildConfigurationComboBox->findData(QVariant::fromValue(int(value)));
|
|
|
|
|
m_buildConfigurationComboBox->setCurrentIndex(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::storeSettings() const
|
|
|
|
|
{
|
|
|
|
|
bool importing = false;
|
|
|
|
|
for (int i=0; i < m_importEnabled.size(); ++i) {
|
|
|
|
|
if (m_importEnabled.at(i)) {
|
|
|
|
|
importing = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSettings *s = Core::ICore::instance()->settings();
|
|
|
|
|
s->setValue("Qt4ProjectManager.TargetSetupPage.ShadowBuilding", m_shadowBuildEnabled->isChecked());
|
|
|
|
|
int id = -1;
|
|
|
|
|
int ci = m_versionComboBox->currentIndex();
|
|
|
|
|
if (ci != -1)
|
|
|
|
|
id = m_versionComboBox->itemData(ci).toInt();
|
|
|
|
|
s->setValue("Qt4ProjectManager.TargetSetupPage.QtVersionId", id);
|
|
|
|
|
|
|
|
|
|
// if we are importing we don't save the template setting
|
|
|
|
|
// essentially we assume that the settings apply for the new project case
|
|
|
|
|
// and for the importing case "None" is likely the most sensible
|
|
|
|
|
if (!importing)
|
|
|
|
|
s->setValue("Qt4ProjectManager.TargetSetupPage.BuildTemplate", m_buildConfigurationComboBox->currentIndex());
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<BuildConfigurationInfo> Qt4DefaultTargetSetupWidget::buildConfigurationInfos() const
|
|
|
|
|
{
|
|
|
|
|
QList<BuildConfigurationInfo> infos;
|
|
|
|
|
for (int i = 0; i < m_importInfos.size(); ++i) {
|
|
|
|
|
if (m_importEnabled.at(i))
|
|
|
|
|
infos << m_importInfos.at(i);
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-15 18:22:12 +01:00
|
|
|
BuildConfigurationTemplate state = buildConfigurationTemplate();
|
|
|
|
|
if (state == NONE)
|
|
|
|
|
return infos;
|
2011-02-21 15:30:05 +01:00
|
|
|
|
2011-03-15 18:22:12 +01:00
|
|
|
int qtVersionId = -1;
|
|
|
|
|
if (state == ONEQT && m_versionComboBox->currentIndex() != -1)
|
|
|
|
|
qtVersionId = m_versionComboBox->itemData(m_versionComboBox->currentIndex()).toInt();
|
|
|
|
|
|
|
|
|
|
QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
|
2011-02-21 15:30:05 +01:00
|
|
|
int size = m_infos.size();
|
|
|
|
|
for (int i=0; i < size; ++i) {
|
2011-03-15 18:22:12 +01:00
|
|
|
if (state == PERQT || (m_enabled.at(i) && (state == MANUALLY || (state == ONEQT && m_infos.at(i).version->uniqueId() == qtVersionId)))) {
|
2011-02-21 15:30:05 +01:00
|
|
|
BuildConfigurationInfo info = m_infos.at(i);
|
2011-02-23 12:50:02 +01:00
|
|
|
if (!m_shadowBuildEnabled->isChecked())
|
2011-02-21 15:30:05 +01:00
|
|
|
info.directory = sourceDir;
|
|
|
|
|
infos << info;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return infos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::addImportClicked()
|
|
|
|
|
{
|
2011-03-17 20:26:00 +01:00
|
|
|
if (!m_importLineLabel->isVisible()) {
|
|
|
|
|
m_importLineLabel->setVisible(true);
|
|
|
|
|
m_importLinePath->setVisible(true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-02-21 15:30:05 +01:00
|
|
|
BuildConfigurationInfo info = BuildConfigurationInfo::checkForBuild(m_importLinePath->path(), m_proFilePath);
|
|
|
|
|
if (!info.isValid()) {
|
2011-03-24 19:27:29 +01:00
|
|
|
QMessageBox::critical(this,
|
2011-02-21 15:30:05 +01:00
|
|
|
tr("No build found"),
|
|
|
|
|
tr("No Build found in %1 matching project %2.").arg(m_importLinePath->path()).arg(m_proFilePath));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!info.version->supportsTargetId(m_id)) {
|
2011-03-23 12:39:34 +01:00
|
|
|
QMessageBox::critical(this,
|
2011-02-21 15:30:05 +01:00
|
|
|
tr("Incompatible build found"),
|
|
|
|
|
tr("The Build found in %1 is incompatible with this target").arg(m_importLinePath->path()));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-02-21 21:08:22 +01:00
|
|
|
|
2011-03-15 18:22:12 +01:00
|
|
|
// We switch from to "NONE" on importing if the user has not changed it
|
|
|
|
|
if (m_buildConfigurationTemplateUnchanged)
|
|
|
|
|
setBuildConfigurationTemplate(NONE);
|
2011-02-21 21:08:22 +01:00
|
|
|
|
2011-02-21 15:30:05 +01:00
|
|
|
++m_selected;
|
|
|
|
|
m_importEnabled << true;
|
|
|
|
|
|
|
|
|
|
m_importInfos << info;
|
|
|
|
|
|
|
|
|
|
createImportWidget(info, m_importEnabled.size() - 1);
|
|
|
|
|
emit newImportBuildConfiguration(info);
|
2011-03-15 18:22:12 +01:00
|
|
|
emit selectedToggled();
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<BuildConfigurationInfo> Qt4DefaultTargetSetupWidget::usedImportInfos()
|
|
|
|
|
{
|
|
|
|
|
QList<BuildConfigurationInfo> infos;
|
|
|
|
|
for (int i = 0; i < m_importInfos.size(); ++i) {
|
|
|
|
|
if (m_importEnabled.at(i))
|
|
|
|
|
infos << m_importInfos.at(i);
|
|
|
|
|
}
|
|
|
|
|
return infos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::setBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, bool resetEnabled)
|
|
|
|
|
{
|
|
|
|
|
m_infos = infos;
|
|
|
|
|
if (resetEnabled || m_infos.size() != m_enabled.size()) {
|
|
|
|
|
m_enabled.clear();
|
|
|
|
|
m_selected = 0;
|
|
|
|
|
QStringList existingBuilds;
|
|
|
|
|
for (int i = 0; i < m_importInfos.size(); ++i) {
|
|
|
|
|
const BuildConfigurationInfo &info = m_importInfos.at(i);
|
|
|
|
|
existingBuilds << info.directory;
|
|
|
|
|
if (m_importEnabled.at(i))
|
|
|
|
|
++m_selected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Default to importing existing builds and disable
|
|
|
|
|
// builds that would overwrite imports
|
|
|
|
|
for (int i=0; i < m_infos.size(); ++i) {
|
|
|
|
|
if (existingBuilds.contains(m_infos.at(i).directory) || m_hasInSourceBuild) {
|
|
|
|
|
m_enabled << false;
|
|
|
|
|
} else {
|
|
|
|
|
m_enabled << true;
|
|
|
|
|
++m_selected;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clearWidgets();
|
|
|
|
|
setupWidgets();
|
|
|
|
|
} else {
|
2011-03-11 15:58:33 +01:00
|
|
|
bool foundIssues = false;
|
2011-02-21 15:30:05 +01:00
|
|
|
m_ignoreChange = true;
|
|
|
|
|
QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
|
|
|
|
|
for (int i=0; i < m_checkboxes.size(); ++i) {
|
|
|
|
|
const BuildConfigurationInfo &info = m_infos.at(i);
|
|
|
|
|
|
|
|
|
|
m_checkboxes[i]->setText(displayNameFrom(info));
|
|
|
|
|
if (m_shadowBuildEnabled->isChecked())
|
|
|
|
|
m_pathChoosers[i]->setPath(info.directory);
|
|
|
|
|
else
|
|
|
|
|
m_pathChoosers[i]->setPath(sourceDir);
|
2011-03-16 17:55:10 +01:00
|
|
|
foundIssues |= reportIssues(i);
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
m_ignoreChange = false;
|
2011-03-31 20:32:05 +02:00
|
|
|
if (foundIssues && isTargetSelected())
|
2011-03-11 15:58:33 +01:00
|
|
|
m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
2011-03-15 18:22:12 +01:00
|
|
|
|
|
|
|
|
// update version combobox
|
|
|
|
|
int oldQtVersionId = -1;
|
|
|
|
|
if (m_versionComboBox->currentIndex() != -1)
|
|
|
|
|
oldQtVersionId = m_versionComboBox->itemData(m_versionComboBox->currentIndex()).toInt();
|
|
|
|
|
QList<QtVersion *> list;
|
|
|
|
|
foreach (const BuildConfigurationInfo &info, m_infos) {
|
|
|
|
|
if (!list.contains(info.version))
|
|
|
|
|
list << info.version;
|
|
|
|
|
}
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_versionComboBox->clear();
|
|
|
|
|
foreach (QtVersion *v, list) {
|
|
|
|
|
m_versionComboBox->addItem(v->displayName(), v->uniqueId());
|
|
|
|
|
if (v->uniqueId() == oldQtVersionId)
|
|
|
|
|
m_versionComboBox->setCurrentIndex(m_versionComboBox->count() - 1);
|
|
|
|
|
}
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
updateWidgetVisibility();
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::setupImportWidgets()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < m_importInfos.size(); ++i)
|
|
|
|
|
createImportWidget(m_importInfos.at(i), i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::createImportWidget(const BuildConfigurationInfo &info, int pos)
|
|
|
|
|
{
|
|
|
|
|
QCheckBox *checkBox = new QCheckBox;
|
|
|
|
|
checkBox->setText(tr("Import build from %1").arg(info.directory));
|
|
|
|
|
checkBox->setChecked(m_importEnabled.at(pos));
|
2011-03-22 12:44:29 +01:00
|
|
|
if (info.version)
|
|
|
|
|
checkBox->setToolTip(info.version->toHtml(false));
|
2011-02-21 15:30:05 +01:00
|
|
|
m_importLayout->addWidget(checkBox, pos, 0, 1, 2);
|
|
|
|
|
|
|
|
|
|
connect(checkBox, SIGNAL(toggled(bool)),
|
|
|
|
|
this, SLOT(importCheckBoxToggled(bool)));
|
|
|
|
|
|
|
|
|
|
m_importCheckBoxes.append(checkBox);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::setupWidgets()
|
|
|
|
|
{
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
|
2011-03-11 15:58:33 +01:00
|
|
|
bool foundIssues = false;
|
2011-02-21 15:30:05 +01:00
|
|
|
for (int i = 0; i < m_infos.size(); ++i) {
|
|
|
|
|
const BuildConfigurationInfo &info = m_infos.at(i);
|
|
|
|
|
QCheckBox *checkbox = new QCheckBox;
|
|
|
|
|
checkbox->setText(displayNameFrom(info));
|
|
|
|
|
checkbox->setChecked(m_enabled.at(i));
|
2011-03-22 12:44:29 +01:00
|
|
|
if (info.version)
|
|
|
|
|
checkbox->setToolTip(info.version->toHtml(false));
|
2011-02-21 15:30:05 +01:00
|
|
|
m_newBuildsLayout->addWidget(checkbox, i * 2, 0);
|
|
|
|
|
|
|
|
|
|
Utils::PathChooser *pathChooser = new Utils::PathChooser();
|
|
|
|
|
pathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
|
|
|
|
if (m_shadowBuildEnabled->isChecked())
|
|
|
|
|
pathChooser->setPath(info.directory);
|
|
|
|
|
else
|
|
|
|
|
pathChooser->setPath(sourceDir);
|
|
|
|
|
pathChooser->setReadOnly(!m_directoriesEnabled);
|
|
|
|
|
m_newBuildsLayout->addWidget(pathChooser, i * 2, 1);
|
|
|
|
|
|
|
|
|
|
QLabel *reportIssuesLabel = new QLabel;
|
|
|
|
|
reportIssuesLabel->setIndent(32);
|
|
|
|
|
m_newBuildsLayout->addWidget(reportIssuesLabel, i * 2 + 1, 0, 1, 2);
|
2011-03-15 18:22:12 +01:00
|
|
|
reportIssuesLabel->setVisible(false);
|
2011-02-21 15:30:05 +01:00
|
|
|
|
|
|
|
|
connect(checkbox, SIGNAL(toggled(bool)),
|
|
|
|
|
this, SLOT(checkBoxToggled(bool)));
|
|
|
|
|
|
|
|
|
|
connect(pathChooser, SIGNAL(changed(QString)),
|
|
|
|
|
this, SLOT(pathChanged()));
|
|
|
|
|
|
|
|
|
|
m_checkboxes.append(checkbox);
|
|
|
|
|
m_pathChoosers.append(pathChooser);
|
|
|
|
|
m_reportIssuesLabels.append(reportIssuesLabel);
|
2011-03-15 18:22:12 +01:00
|
|
|
m_issues.append(false);
|
|
|
|
|
bool issue = reportIssues(i);
|
|
|
|
|
foundIssues |= issue;
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
2011-03-31 20:32:05 +02:00
|
|
|
if (foundIssues && isTargetSelected())
|
2011-03-11 15:58:33 +01:00
|
|
|
m_detailsWidget->setState(Utils::DetailsWidget::Expanded);
|
2011-02-21 15:30:05 +01:00
|
|
|
m_ignoreChange = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::clearWidgets()
|
|
|
|
|
{
|
|
|
|
|
qDeleteAll(m_checkboxes);
|
|
|
|
|
m_checkboxes.clear();
|
|
|
|
|
qDeleteAll(m_pathChoosers);
|
|
|
|
|
m_pathChoosers.clear();
|
|
|
|
|
qDeleteAll(m_reportIssuesLabels);
|
|
|
|
|
m_reportIssuesLabels.clear();
|
2011-03-15 18:22:12 +01:00
|
|
|
m_issues.clear();
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::checkBoxToggled(bool b)
|
|
|
|
|
{
|
|
|
|
|
QCheckBox *box = qobject_cast<QCheckBox *>(sender());
|
|
|
|
|
if (!box)
|
|
|
|
|
return;
|
|
|
|
|
int index = m_checkboxes.indexOf(box);
|
|
|
|
|
if (index == -1)
|
|
|
|
|
return;
|
|
|
|
|
if (m_enabled[index] == b)
|
|
|
|
|
return;
|
|
|
|
|
m_selected += b ? 1 : -1;
|
|
|
|
|
m_enabled[index] = b;
|
|
|
|
|
if ((m_selected == 0 && !b) || (m_selected == 1 && b))
|
|
|
|
|
emit selectedToggled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::importCheckBoxToggled(bool b)
|
|
|
|
|
{
|
|
|
|
|
QCheckBox *box = qobject_cast<QCheckBox *>(sender());
|
|
|
|
|
if (!box)
|
|
|
|
|
return;
|
|
|
|
|
int index = m_importCheckBoxes.indexOf(box);
|
|
|
|
|
if (index == -1)
|
|
|
|
|
return;
|
|
|
|
|
if (m_importEnabled[index] == b)
|
|
|
|
|
return;
|
|
|
|
|
m_selected += b ? 1 : -1;
|
|
|
|
|
m_importEnabled[index] = b;
|
|
|
|
|
if ((m_selected == 0 && !b) || (m_selected == 1 && b))
|
|
|
|
|
emit selectedToggled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::pathChanged()
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(sender());
|
|
|
|
|
if (!pathChooser)
|
|
|
|
|
return;
|
|
|
|
|
int index = m_pathChoosers.indexOf(pathChooser);
|
|
|
|
|
if (index == -1)
|
|
|
|
|
return;
|
|
|
|
|
m_infos[index].directory = pathChooser->path();
|
|
|
|
|
reportIssues(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::shadowBuildingToggled()
|
|
|
|
|
{
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
bool b = m_shadowBuildEnabled->isChecked();
|
|
|
|
|
if (m_directoriesEnabled == b)
|
|
|
|
|
return;
|
|
|
|
|
m_directoriesEnabled = b;
|
|
|
|
|
QString sourceDir = QFileInfo(m_proFilePath).absolutePath();
|
|
|
|
|
for (int i = 0; i < m_pathChoosers.size(); ++i) {
|
|
|
|
|
Utils::PathChooser *pathChooser = m_pathChoosers.at(i);
|
|
|
|
|
pathChooser->setReadOnly(!b);
|
|
|
|
|
if (b)
|
|
|
|
|
pathChooser->setPath(m_infos.at(i).directory);
|
|
|
|
|
else
|
|
|
|
|
pathChooser->setPath(sourceDir);
|
|
|
|
|
reportIssues(i);
|
|
|
|
|
}
|
|
|
|
|
m_ignoreChange = false;
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-15 18:22:12 +01:00
|
|
|
void Qt4DefaultTargetSetupWidget::buildConfigurationComboBoxChanged()
|
|
|
|
|
{
|
|
|
|
|
m_buildConfigurationTemplateUnchanged = false;
|
|
|
|
|
updateWidgetVisibility();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::updateWidgetVisibility()
|
|
|
|
|
{
|
|
|
|
|
m_versionLabel->setVisible(false);
|
|
|
|
|
m_versionComboBox->setVisible(false);
|
|
|
|
|
BuildConfigurationTemplate state = buildConfigurationTemplate();
|
|
|
|
|
if (state == NONE || state == PERQT) {
|
|
|
|
|
foreach (QCheckBox *cb, m_checkboxes)
|
|
|
|
|
cb->setVisible(false);
|
|
|
|
|
foreach (Utils::PathChooser *pc, m_pathChoosers)
|
|
|
|
|
pc->setVisible(false);
|
|
|
|
|
foreach (QLabel *label, m_reportIssuesLabels)
|
|
|
|
|
label->setVisible(false);
|
|
|
|
|
} else if (state == MANUALLY) {
|
|
|
|
|
foreach (QCheckBox *cb, m_checkboxes)
|
|
|
|
|
cb->setVisible(true);
|
|
|
|
|
foreach (Utils::PathChooser *pc, m_pathChoosers)
|
|
|
|
|
pc->setVisible(true);
|
|
|
|
|
for (int i = 0; i < m_reportIssuesLabels.count(); ++i)
|
|
|
|
|
m_reportIssuesLabels.at(i)->setVisible(m_issues.at(i));
|
|
|
|
|
} else if (state == ONEQT) {
|
|
|
|
|
m_versionLabel->setVisible(true);
|
|
|
|
|
m_versionComboBox->setVisible(true);
|
|
|
|
|
qtVersionChanged();
|
|
|
|
|
}
|
2011-03-29 19:41:33 +02:00
|
|
|
m_shadowBuildEnabled->setVisible(m_shadowBuildCheckBoxVisible && (state != NONE));
|
2011-03-15 18:22:12 +01:00
|
|
|
emit selectedToggled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Qt4DefaultTargetSetupWidget::qtVersionChanged()
|
|
|
|
|
{
|
|
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
int id = -1;
|
|
|
|
|
if (m_versionComboBox->currentIndex() != -1)
|
|
|
|
|
id = m_versionComboBox->itemData(m_versionComboBox->currentIndex()).toInt();
|
|
|
|
|
if (buildConfigurationTemplate() != ONEQT)
|
|
|
|
|
return;
|
|
|
|
|
for (int i = 0; i < m_infos.size(); ++i) {
|
|
|
|
|
bool visible = m_infos.at(i).version->uniqueId() == id;
|
|
|
|
|
m_checkboxes.at(i)->setVisible(visible);
|
|
|
|
|
m_pathChoosers.at(i)->setVisible(visible);
|
|
|
|
|
m_reportIssuesLabels.at(i)->setVisible(m_issues.at(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-11 15:58:33 +01:00
|
|
|
bool Qt4DefaultTargetSetupWidget::reportIssues(int index)
|
2011-02-21 15:30:05 +01:00
|
|
|
{
|
|
|
|
|
QPair<ProjectExplorer::Task::TaskType, QString> issues = findIssues(m_infos.at(index));
|
|
|
|
|
QLabel *reportIssuesLabel = m_reportIssuesLabels.at(index);
|
|
|
|
|
reportIssuesLabel->setText(issues.second);
|
2011-03-15 18:22:12 +01:00
|
|
|
bool error = issues.first != ProjectExplorer::Task::Unknown;
|
|
|
|
|
reportIssuesLabel->setVisible(error);
|
|
|
|
|
m_issues[index] = error;
|
|
|
|
|
return error;
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QPair<ProjectExplorer::Task::TaskType, QString> Qt4DefaultTargetSetupWidget::findIssues(const BuildConfigurationInfo &info)
|
|
|
|
|
{
|
|
|
|
|
if (m_proFilePath.isEmpty())
|
|
|
|
|
return qMakePair(ProjectExplorer::Task::Unknown, QString());
|
|
|
|
|
|
|
|
|
|
QString buildDir = info.directory;
|
|
|
|
|
QtVersion *version = info.version;
|
|
|
|
|
|
2011-03-11 15:58:33 +01:00
|
|
|
QList<ProjectExplorer::Task> issues = version->reportIssues(m_proFilePath, buildDir, false);
|
2011-02-21 15:30:05 +01:00
|
|
|
|
|
|
|
|
QString text;
|
|
|
|
|
ProjectExplorer::Task::TaskType highestType = ProjectExplorer::Task::Unknown;
|
|
|
|
|
foreach (const ProjectExplorer::Task &t, issues) {
|
|
|
|
|
if (!text.isEmpty())
|
|
|
|
|
text.append(QLatin1String("<br>"));
|
|
|
|
|
// set severity:
|
|
|
|
|
QString severity;
|
|
|
|
|
if (t.type == ProjectExplorer::Task::Error) {
|
|
|
|
|
highestType = ProjectExplorer::Task::Error;
|
|
|
|
|
severity = tr("<b>Error:</b> ", "Severity is Task::Error");
|
|
|
|
|
} else if (t.type == ProjectExplorer::Task::Warning) {
|
|
|
|
|
if (highestType == ProjectExplorer::Task::Unknown)
|
|
|
|
|
highestType = ProjectExplorer::Task::Warning;
|
|
|
|
|
severity = tr("<b>Warning:</b> ", "Severity is Task::Warning");
|
|
|
|
|
}
|
|
|
|
|
text.append(severity + t.description);
|
|
|
|
|
}
|
|
|
|
|
if (!text.isEmpty())
|
|
|
|
|
text = QLatin1String("<nobr>") + text;
|
|
|
|
|
return qMakePair(highestType, text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// -----------------------
|
|
|
|
|
// BuildConfigurationInfo
|
|
|
|
|
// -----------------------
|
|
|
|
|
|
|
|
|
|
QList<BuildConfigurationInfo> BuildConfigurationInfo::filterBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, const QString &id)
|
|
|
|
|
{
|
|
|
|
|
QList<BuildConfigurationInfo> result;
|
|
|
|
|
foreach (const BuildConfigurationInfo &info, infos)
|
|
|
|
|
if (info.version->supportsTargetId(id))
|
|
|
|
|
result.append(info);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<BuildConfigurationInfo> BuildConfigurationInfo::importBuildConfigurations(const QString &proFilePath)
|
|
|
|
|
{
|
|
|
|
|
QList<BuildConfigurationInfo> result;
|
|
|
|
|
|
|
|
|
|
// Check for in source build first
|
|
|
|
|
QString sourceDir = QFileInfo(proFilePath).absolutePath();
|
2011-02-22 20:01:19 +01:00
|
|
|
BuildConfigurationInfo info = checkForBuild(sourceDir, proFilePath);
|
|
|
|
|
if (info.isValid())
|
|
|
|
|
result.append(info);
|
2011-02-21 15:30:05 +01:00
|
|
|
|
|
|
|
|
// If we found a in source build, we do not search for out of source builds
|
|
|
|
|
if (!result.isEmpty())
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
// Check for builds in build directoy
|
|
|
|
|
QList<Qt4BaseTargetFactory *> factories =
|
|
|
|
|
ExtensionSystem::PluginManager::instance()->getObjects<Qt4BaseTargetFactory>();
|
|
|
|
|
foreach (Qt4BaseTargetFactory *factory, factories) {
|
|
|
|
|
foreach (const QString &id, factory->supportedTargetIds(0)) {
|
2011-03-23 13:32:42 +01:00
|
|
|
QString expectedBuildprefix = factory->shadowBuildDirectory(proFilePath, id, "");
|
|
|
|
|
QString baseDir = QFileInfo(expectedBuildprefix).absolutePath();
|
|
|
|
|
foreach (const QString &dir, QDir(baseDir).entryList()) {
|
|
|
|
|
if (dir.startsWith(expectedBuildprefix)) {
|
|
|
|
|
BuildConfigurationInfo info = checkForBuild(dir, proFilePath);
|
|
|
|
|
if (info.isValid())
|
|
|
|
|
result.append(info);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-21 15:30:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildConfigurationInfo BuildConfigurationInfo::checkForBuild(const QString &directory, const QString &proFilePath)
|
|
|
|
|
{
|
|
|
|
|
QString makefile = directory + "/Makefile";
|
|
|
|
|
QString qmakeBinary = QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
|
|
|
|
if (qmakeBinary.isEmpty())
|
|
|
|
|
return BuildConfigurationInfo();
|
|
|
|
|
if (!QtVersionManager::makefileIsFor(makefile, proFilePath))
|
|
|
|
|
return BuildConfigurationInfo();
|
|
|
|
|
|
|
|
|
|
bool temporaryQtVersion = false;
|
|
|
|
|
QtVersion *version = QtVersionManager::instance()->qtVersionForQMakeBinary(qmakeBinary);
|
|
|
|
|
if (!version) {
|
|
|
|
|
version = new QtVersion(qmakeBinary);
|
|
|
|
|
temporaryQtVersion = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QPair<QtVersion::QmakeBuildConfigs, QString> makefileBuildConfig =
|
|
|
|
|
QtVersionManager::scanMakeFile(makefile, version->defaultBuildConfig());
|
|
|
|
|
|
|
|
|
|
QString additionalArguments = makefileBuildConfig.second;
|
|
|
|
|
QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
|
|
|
|
|
QString versionSpec = version->mkspec();
|
|
|
|
|
|
|
|
|
|
QString specArgument;
|
|
|
|
|
// Compare mkspecs and add to additional arguments
|
|
|
|
|
if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
|
|
|
|
|
// using the default spec, don't modify additional arguments
|
|
|
|
|
} else {
|
|
|
|
|
specArgument = "-spec " + Utils::QtcProcess::quoteArg(parsedSpec);
|
|
|
|
|
}
|
|
|
|
|
Utils::QtcProcess::addArgs(&specArgument, additionalArguments);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BuildConfigurationInfo info = BuildConfigurationInfo(version,
|
|
|
|
|
makefileBuildConfig.first,
|
|
|
|
|
specArgument,
|
|
|
|
|
directory,
|
|
|
|
|
true,
|
|
|
|
|
temporaryQtVersion);
|
|
|
|
|
return info;
|
|
|
|
|
}
|