Commit d3e0ffef authored by Tobias Hunger's avatar Tobias Hunger Committed by Daniel Teske
Browse files

Add embedded linux target



... and required factories.

Change-Id: Id8a0e7a5a83d3c05e70d61d5023401be5e201c6c
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent c20aadc0
......@@ -60,9 +60,9 @@ public:
bool importEnabled, QList<BuildConfigurationInfo> importInfos);
QString buildNameForId(const QString &id) const;
QSet<QString> targetFeatures(const QString &id) const;
ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id);
ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id, const QList<BuildConfigurationInfo> &infos);
};
}
}
......
......@@ -1199,7 +1199,6 @@ QString BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, con
else if (file.endsWith(QLatin1String(".dll"))
|| file.endsWith(QString::fromLatin1(".so.") + versionString)
|| file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib")))
return info.absoluteFilePath();
}
}
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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.
**
** 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.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "embeddedlinuxtarget.h"
#include "remotelinux_constants.h"
#include "remotelinuxrunconfiguration.h"
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qt4projectmanager/qt4project.h>
#include <QtCore/QCoreApplication>
namespace RemoteLinux {
namespace Internal {
EmbeddedLinuxTarget::EmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id) :
Qt4ProjectManager::Qt4BaseTarget(parent, id),
m_buildConfigurationFactory(new Qt4ProjectManager::Qt4BuildConfigurationFactory)
{
setDisplayName(tr("Embedded Linux"));
}
EmbeddedLinuxTarget::~EmbeddedLinuxTarget()
{
delete m_buildConfigurationFactory;
}
ProjectExplorer::IBuildConfigurationFactory *EmbeddedLinuxTarget::buildConfigurationFactory() const
{
return m_buildConfigurationFactory;
}
QList<ProjectExplorer::RunConfiguration *> EmbeddedLinuxTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
{
QList<ProjectExplorer::RunConfiguration *> result;
foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
if (RemoteLinuxRunConfiguration *qt4c = qobject_cast<RemoteLinuxRunConfiguration *>(rc))
if (qt4c->proFilePath() == n->path())
result << rc;
return result;
}
void EmbeddedLinuxTarget::createApplicationProFiles()
{
removeUnconfiguredCustomExectutableRunConfigurations();
// We use the list twice
QList<Qt4ProjectManager::Qt4ProFileNode *> profiles = qt4Project()->applicationProFiles();
QStringList pathes;
foreach (Qt4ProjectManager::Qt4ProFileNode *pro, profiles)
pathes.append(pro->path());
foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) {
if (RemoteLinuxRunConfiguration *qt4rc = qobject_cast<RemoteLinuxRunConfiguration *>(rc))
pathes.removeAll(qt4rc->proFilePath());
}
// Only add new runconfigurations if there are none.
foreach (const QString &path, pathes) {
RemoteLinuxRunConfiguration *qt4rc =
new RemoteLinuxRunConfiguration(this,RemoteLinuxRunConfiguration::Id, path);
addRunConfiguration(qt4rc);
}
// Oh still none? Add a custom executable runconfiguration
if (runConfigurations().isEmpty())
addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(this));
}
} // namespace Internal
} // namespace RemoteLinux
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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.
**
** 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.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef EMBEDDEDLINUXTARGET_H
#define EMBEDDEDLINUXTARGET_H
#include <qt4projectmanager/qt4target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
namespace RemoteLinux {
namespace Internal {
class EmbeddedLinuxTargetFactory;
class EmbeddedLinuxTarget : public Qt4ProjectManager::Qt4BaseTarget
{
Q_OBJECT
public:
EmbeddedLinuxTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id);
~EmbeddedLinuxTarget();
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
void createApplicationProFiles();
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
private:
Qt4ProjectManager::Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
friend class EmbeddedLinuxTargetFactory;
};
} // namespace Internal
} // namespace RemoteLinux
#endif // EMBEDDEDLINUXTARGET_H
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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.
**
** 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.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "embeddedlinuxtargetfactory.h"
#include "remotelinuxdeployconfiguration.h"
#include "remotelinuxdeployconfigurationfactory.h"
#include "embeddedlinuxtarget.h"
#include "remotelinux_constants.h"
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <qt4projectmanager/buildconfigurationinfo.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <QtGui/QIcon>
namespace RemoteLinux {
namespace Internal {
EmbeddedLinuxTargetFactory::EmbeddedLinuxTargetFactory(QObject *parent) :
Qt4ProjectManager::Qt4BaseTargetFactory(parent)
{ }
EmbeddedLinuxTargetFactory::~EmbeddedLinuxTargetFactory()
{ }
QIcon EmbeddedLinuxTargetFactory::iconForId(const QString &id) const
{
if (id == QLatin1String(Constants::EMBEDDED_LINUX_TARGET_ID))
return QIcon(":/remotelinux/images/embeddedtarget.png");
return QIcon();
}
QString EmbeddedLinuxTargetFactory::buildNameForId(const QString &id) const
{
if (supportsTargetId(id))
return tr("embedded");
return QString();
}
QSet<QString> EmbeddedLinuxTargetFactory::targetFeatures(const QString & /*id*/) const
{
QSet<QString> features;
features << Qt4ProjectManager::Constants::MOBILE_TARGETFEATURE_ID;
features << Qt4ProjectManager::Constants::SHADOWBUILD_TARGETFEATURE_ID;
return features;
}
QStringList EmbeddedLinuxTargetFactory::supportedTargetIds(ProjectExplorer::Project *project) const
{
Q_UNUSED(project);
return QStringList() << RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID;
}
bool EmbeddedLinuxTargetFactory::supportsTargetId(const QString &id) const
{
return id == RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID;
}
QString EmbeddedLinuxTargetFactory::displayNameForId(const QString &id) const
{
if (id == RemoteLinux::Constants::EMBEDDED_LINUX_TARGET_ID)
return tr("Embedded Linux");
return QString();
}
bool EmbeddedLinuxTargetFactory::canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
ProjectExplorer::Target *EmbeddedLinuxTargetFactory::restore(ProjectExplorer::Project *parent, const QVariantMap &map)
{
Q_ASSERT(canRestore(parent, map));
EmbeddedLinuxTarget *t = new EmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent),
Constants::EMBEDDED_LINUX_TARGET_ID);
if (t->fromMap(map))
return t;
delete t;
return 0;
}
bool EmbeddedLinuxTargetFactory::canCreate(ProjectExplorer::Project *parent, const QString &id) const
{
Qt4ProjectManager::Qt4Project *project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent);
if (!project)
return false;
return supportsTargetId(id);
}
ProjectExplorer::Target *EmbeddedLinuxTargetFactory::create(ProjectExplorer::Project *parent,
const QString &id)
{
if (!canCreate(parent, id))
return 0;
QList<QtSupport::BaseQtVersion *> knownVersions =
QtSupport::QtVersionManager::instance()->versionsForTargetId(id);
if (knownVersions.isEmpty())
return 0;
QtSupport::BaseQtVersion *qtVersion = knownVersions.first();
QtSupport::BaseQtVersion::QmakeBuildConfigs config = qtVersion->defaultBuildConfig();
QList<Qt4ProjectManager::BuildConfigurationInfo> infos;
infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion, config, QString(), QString()));
infos.append(Qt4ProjectManager::BuildConfigurationInfo(qtVersion,
config ^ QtSupport::BaseQtVersion::DebugBuild,
QString(), QString()));
return create(parent, id, infos);
}
ProjectExplorer::Target *EmbeddedLinuxTargetFactory::create(ProjectExplorer::Project *parent,
const QString &id,
const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos)
{
if (!canCreate(parent, id) || infos.isEmpty())
return 0;
EmbeddedLinuxTarget *t = new EmbeddedLinuxTarget(static_cast<Qt4ProjectManager::Qt4Project *>(parent), id);
foreach (const Qt4ProjectManager::BuildConfigurationInfo &info, infos)
t->addQt4BuildConfiguration(msgBuildConfigurationName(info), QString(),
info.version, info.buildConfig,
info.additionalArguments, info.directory, info.importing);
t->addDeployConfiguration(
t->createDeployConfiguration(
RemoteLinuxDeployConfigurationFactory::genericDeployConfigurationId()));
t->createApplicationProFiles();
if (t->runConfigurations().isEmpty())
t->addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(t));
return t;
}
} // namespace Internal
} // namespace RemoteLinux
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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.
**
** 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.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef EMBEDDEDLINUXTARGETFACTORY_H
#define EMBEDDEDLINUXTARGETFACTORY_H
#include <qt4projectmanager/qt4basetargetfactory.h>
namespace RemoteLinux {
namespace Internal {
class EmbeddedLinuxTargetFactory : public Qt4ProjectManager::Qt4BaseTargetFactory
{
Q_OBJECT
public:
explicit EmbeddedLinuxTargetFactory(QObject *parent = 0);
~EmbeddedLinuxTargetFactory();
QIcon iconForId(const QString &id) const;
QString buildNameForId(const QString &id) const;
QSet<QString> targetFeatures(const QString &id) const;
QStringList supportedTargetIds(ProjectExplorer::Project *project) const;
bool supportsTargetId(const QString &id) const;
QString displayNameForId(const QString &id) const;
bool canRestore(ProjectExplorer::Project *parent, const QVariantMap &map) const;
ProjectExplorer::Target *restore(ProjectExplorer::Project *parent, const QVariantMap &map);
bool canCreate(ProjectExplorer::Project *parent, const QString &id) const;
ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id);
ProjectExplorer::Target *create(ProjectExplorer::Project *parent, const QString &id,
const QList<Qt4ProjectManager::BuildConfigurationInfo> &infos);
};
} // namespace Internal
} // namespace RemoteLinux
#endif // EMBEDDEDLINUXTARGETFACTORY_H
......@@ -5,6 +5,8 @@ include(../../qtcreatorplugin.pri)
include(remotelinux_dependencies.pri)
HEADERS += \
embeddedlinuxtarget.h \
embeddedlinuxtargetfactory.h \
embeddedlinuxqtversion.h \
embeddedlinuxqtversionfactory.h \
remotelinuxplugin.h \
......@@ -62,6 +64,8 @@ HEADERS += \
remotelinuxcustomcommanddeploymentstep.h
SOURCES += \
embeddedlinuxtarget.cpp \
embeddedlinuxtargetfactory.cpp \
embeddedlinuxqtversion.cpp \
embeddedlinuxqtversionfactory.cpp \
remotelinuxplugin.cpp \
......@@ -126,5 +130,7 @@ FORMS += \
profilesupdatedialog.ui \
startgdbserverdialog.ui
RESOURCES += remotelinux.qrc
DEFINES += QT_NO_CAST_TO_ASCII
DEFINES += REMOTELINUX_LIBRARY
<RCC>
<qresource prefix="/remotelinux">
<file>images/embeddedtarget.png</file>
</qresource>
</RCC>
......@@ -44,16 +44,14 @@ class RemoteLinuxDeployConfigurationFactory : public ProjectExplorer::DeployConf
public:
explicit RemoteLinuxDeployConfigurationFactory(QObject *parent = 0);
virtual QStringList availableCreationIds(ProjectExplorer::Target *parent) const;
virtual QString displayNameForId(const QString &id) const;
virtual bool canCreate(ProjectExplorer::Target *parent, const QString &id) const;
virtual ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, const QString &id);
virtual bool canRestore(ProjectExplorer::Target *parent,
const QVariantMap &map) const;
virtual ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent,
const QVariantMap &map);
virtual ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::DeployConfiguration *product);
QStringList availableCreationIds(ProjectExplorer::Target *parent) const;
QString displayNameForId(const QString &id) const;
bool canCreate(ProjectExplorer::Target *parent, const QString &id) const;
ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, const QString &id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::DeployConfiguration *product);
static QString genericDeployConfigurationId();
};
......
......@@ -33,6 +33,7 @@
#include "remotelinuxplugin.h"
#include "embeddedlinuxqtversionfactory.h"
#include "embeddedlinuxtargetfactory.h"
#include "deployablefile.h"
#include "genericlinuxdeviceconfigurationfactory.h"
#include "genericremotelinuxdeploystepfactory.h"
......@@ -78,6 +79,7 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
addAutoReleasedObject(new RemoteLinuxDeployConfigurationFactory);
addAutoReleasedObject(new GenericRemoteLinuxDeployStepFactory);
addAutoReleasedObject(new EmbeddedLinuxTargetFactory);
addAutoReleasedObject(new EmbeddedLinuxQtVersionFactory);
qRegisterMetaType<RemoteLinux::DeployableFile>("RemoteLinux::DeployableFile");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment