Add experimental Maemo support.

Includes Maemo tool chain, run configuration, run control,
manager, etc.

Adds the DebuggerManager to the object pool. This is ugly, but
nobody came up with anything better on short notice. To be
refactored.

Co-Authored-By: kh1
This commit is contained in:
ck
2009-10-16 17:33:12 +02:00
parent 6f5158fa8f
commit 6a49395e33
23 changed files with 2392 additions and 13 deletions

View File

@@ -113,7 +113,9 @@ public:
QString symbolFileName; QString symbolFileName;
QString serverStartScript; QString serverStartScript;
QString sysRoot; QString sysRoot;
QString debuggerCommand;
int toolChainType; int toolChainType;
QString remoteDumperLib;
QString dumperLibrary; QString dumperLibrary;
QStringList dumperLibraryLocations; QStringList dumperLibraryLocations;

View File

@@ -451,6 +451,7 @@ void DebuggerPlugin::shutdown()
delete m_locationMark; delete m_locationMark;
m_locationMark = 0; m_locationMark = 0;
removeObject(m_manager);
delete m_manager; delete m_manager;
m_manager = 0; m_manager = 0;
} }
@@ -545,6 +546,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
} }
m_manager = new DebuggerManager; m_manager = new DebuggerManager;
ExtensionSystem::PluginManager::instance()->addObject(m_manager);
const QList<Core::IOptionsPage *> engineOptionPages = const QList<Core::IOptionsPage *> engineOptionPages =
m_manager->initializeEngines(m_cmdLineEnabledEngines); m_manager->initializeEngines(m_cmdLineEnabledEngines);

View File

@@ -3796,47 +3796,56 @@ void GdbEngine::tryLoadDebuggingHelpers()
} }
m_debuggingHelperState = DebuggingHelperLoadTried; m_debuggingHelperState = DebuggingHelperLoadTried;
const QString dlopenLib =
(startParameters().startMode == StartRemote)
? startParameters().remoteDumperLib : lib;
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
if (m_dumperInjectionLoad) { if (m_dumperInjectionLoad) {
/// Launch asynchronous remote thread to load. /// Launch asynchronous remote thread to load.
SharedLibraryInjector injector(inferiorPid()); SharedLibraryInjector injector(inferiorPid());
QString errorMessage; QString errorMessage;
if (injector.remoteInject(lib, false, &errorMessage)) { if (injector.remoteInject(dlopenLib, false, &errorMessage)) {
debugMessage(tr("Dumper injection loading triggered (%1)...").arg(lib)); debugMessage(tr("Dumper injection loading triggered (%1)...").
arg(dlopenLib));
} else { } else {
debugMessage(tr("Dumper loading (%1) failed: %2").arg(lib, errorMessage)); debugMessage(tr("Dumper loading (%1) failed: %2").
arg(dlopenLib, errorMessage));
debugMessage(errorMessage); debugMessage(errorMessage);
manager()->showQtDumperLibraryWarning(errorMessage); manager()->showQtDumperLibraryWarning(errorMessage);
m_debuggingHelperState = DebuggingHelperUnavailable; m_debuggingHelperState = DebuggingHelperUnavailable;
return; return;
} }
} else { } else {
debugMessage(tr("Loading dumpers via debugger call (%1)...").arg(lib)); debugMessage(tr("Loading dumpers via debugger call (%1)...").
arg(dlopenLib));
postCommand(_("sharedlibrary .*")); // for LoadLibraryA postCommand(_("sharedlibrary .*")); // for LoadLibraryA
//postCommand(_("handle SIGSEGV pass stop print")); //postCommand(_("handle SIGSEGV pass stop print"));
//postCommand(_("set unwindonsignal off")); //postCommand(_("set unwindonsignal off"));
postCommand(_("call LoadLibraryA(\"") + GdbMi::escapeCString(lib) + _("\")"), postCommand(_("call LoadLibraryA(\"") + GdbMi::escapeCString(dlopenLib) + _("\")"),
CB(handleDebuggingHelperSetup)); CB(handleDebuggingHelperSetup));
postCommand(_("sharedlibrary ") + dotEscape(lib)); postCommand(_("sharedlibrary ") + dotEscape(dlopenLib));
} }
#elif defined(Q_OS_MAC) #elif defined(Q_OS_MAC)
//postCommand(_("sharedlibrary libc")); // for malloc //postCommand(_("sharedlibrary libc")); // for malloc
//postCommand(_("sharedlibrary libdl")); // for dlopen //postCommand(_("sharedlibrary libdl")); // for dlopen
postCommand(_("call (void)dlopen(\"") + GdbMi::escapeCString(lib) + _("\", " STRINGIFY(RTLD_NOW) ")"), postCommand(_("call (void)dlopen(\"") + GdbMi::escapeCString(dlopenLib)
+ _("\", " STRINGIFY(RTLD_NOW) ")"),
CB(handleDebuggingHelperSetup)); CB(handleDebuggingHelperSetup));
//postCommand(_("sharedlibrary ") + dotEscape(lib)); //postCommand(_("sharedlibrary ") + dotEscape(dlopenLib));
m_debuggingHelperState = DebuggingHelperLoadTried; m_debuggingHelperState = DebuggingHelperLoadTried;
#else #else
//postCommand(_("p dlopen")); //postCommand(_("p dlopen"));
QString flag = QString::number(RTLD_NOW); QString flag = QString::number(RTLD_NOW);
postCommand(_("sharedlibrary libc")); // for malloc postCommand(_("sharedlibrary libc")); // for malloc
postCommand(_("sharedlibrary libdl")); // for dlopen postCommand(_("sharedlibrary libdl")); // for dlopen
postCommand(_("call (void*)dlopen(\"") + GdbMi::escapeCString(lib) + _("\", " STRINGIFY(RTLD_NOW) ")"), postCommand(_("call (void*)dlopen(\"") + GdbMi::escapeCString(dlopenLib)
+ _("\", " STRINGIFY(RTLD_NOW) ")"),
CB(handleDebuggingHelperSetup)); CB(handleDebuggingHelperSetup));
// some older systems like CentOS 4.6 prefer this: // some older systems like CentOS 4.6 prefer this:
postCommand(_("call (void*)__dlopen(\"") + GdbMi::escapeCString(lib) + _("\", " STRINGIFY(RTLD_NOW) ")"), postCommand(_("call (void*)__dlopen(\"") + GdbMi::escapeCString(dlopenLib)
+ _("\", " STRINGIFY(RTLD_NOW) ")"),
CB(handleDebuggingHelperSetup)); CB(handleDebuggingHelperSetup));
postCommand(_("sharedlibrary ") + dotEscape(lib)); postCommand(_("sharedlibrary ") + dotEscape(dlopenLib));
#endif #endif
if (!m_dumperInjectionLoad) if (!m_dumperInjectionLoad)
tryQueryDebuggingHelpers(); tryQueryDebuggingHelpers();

View File

@@ -160,6 +160,8 @@ void RemoteGdbAdapter::startInferior()
m_engine->postCommand(_("set architecture %1") m_engine->postCommand(_("set architecture %1")
.arg(startParameters().remoteArchitecture)); .arg(startParameters().remoteArchitecture));
m_engine->postCommand(_("set sysroot %1").arg(startParameters().sysRoot)); m_engine->postCommand(_("set sysroot %1").arg(startParameters().sysRoot));
m_engine->postCommand(_("set solib-search-path %1").
arg(QFileInfo(startParameters().dumperLibrary).path()));
if (!startParameters().processArgs.isEmpty()) if (!startParameters().processArgs.isEmpty())
m_engine->postCommand(_("-exec-arguments ") m_engine->postCommand(_("-exec-arguments ")

View File

@@ -127,6 +127,8 @@ QString ToolChain::toolChainName(ToolChainType tc)
return QCoreApplication::translate("ToolChain", "RVCT (ARMV5)"); return QCoreApplication::translate("ToolChain", "RVCT (ARMV5)");
case RVCT_ARMV6: case RVCT_ARMV6:
return QCoreApplication::translate("ToolChain", "RVCT (ARMV6)"); return QCoreApplication::translate("ToolChain", "RVCT (ARMV6)");
case GCC_MAEMO:
return QCoreApplication::translate("ToolChain", "GCC for Maemo");
case OTHER: case OTHER:
return QCoreApplication::translate("ToolChain", "Other"); return QCoreApplication::translate("ToolChain", "Other");
case INVALID: case INVALID:

View File

@@ -83,7 +83,8 @@ public:
GCCE = 6, GCCE = 6,
RVCT_ARMV5 = 7, RVCT_ARMV5 = 7,
RVCT_ARMV6 = 8, RVCT_ARMV6 = 8,
LAST_VALID = 9, GCC_MAEMO = 9,
LAST_VALID = 10,
OTHER = 200, OTHER = 200,
UNKNOWN = 201, UNKNOWN = 201,
INVALID = 202 INVALID = 202

View File

@@ -25,5 +25,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependency name="CppEditor" version="1.3.80"/> <dependency name="CppEditor" version="1.3.80"/>
<dependency name="Help" version="1.3.80"/> <dependency name="Help" version="1.3.80"/>
<dependency name="Designer" version="1.3.80"/> <dependency name="Designer" version="1.3.80"/>
<dependency name="Debugger" version="1.3.80"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@@ -68,6 +68,12 @@ QStringList QMakeStep::arguments(const QString &buildConfiguration)
arguments << "-r"; arguments << "-r";
#ifdef Q_OS_WIN
ToolChain::ToolChainType type = m_pro->toolChainType(bc);
if (type == ToolChain::GCC_MAEMO)
arguments << QLatin1String("-unix");
#endif
if (bc->value("buildConfiguration").isValid()) { if (bc->value("buildConfiguration").isValid()) {
QStringList configarguments; QStringList configarguments;
QtVersion::QmakeBuildConfig defaultBuildConfiguration = m_pro->qtVersion(bc)->defaultBuildConfig(); QtVersion::QmakeBuildConfig defaultBuildConfiguration = m_pro->qtVersion(bc)->defaultBuildConfig();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

View File

@@ -0,0 +1,158 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "maemomanager.h"
#include "maemotoolchain.h"
#include "maemorunconfiguration.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/modemanager.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QList>
#include <QtCore/QMutexLocker>
#include <QtGui/QAction>
namespace Qt4ProjectManager {
namespace Internal {
QMutex MaemoManager::m_mutex;
MaemoManager *MaemoManager::m_instance = 0;
const QSize iconSize = QSize(24, 20);
MaemoManager::MaemoManager()
: QObject(0)
, m_runControlFactory(new MaemoRunControlFactory(this))
, m_runConfigurationFactory(new MaemoRunConfigurationFactory(this))
, m_qemuCommand(0)
{
icon.addFile(":/qt-maemo/images/qemu-run.png", iconSize);
icon.addFile(":/qt-maemo/images/qemu-stop.png", iconSize, QIcon::Normal,
QIcon::On);
ExtensionSystem::PluginManager::instance()->addObject(m_runControlFactory);
ExtensionSystem::PluginManager::instance()->addObject(m_runConfigurationFactory);
}
MaemoManager::~MaemoManager()
{
ExtensionSystem::PluginManager::instance()->removeObject(m_runControlFactory);
ExtensionSystem::PluginManager::instance()->removeObject(m_runConfigurationFactory);
}
MaemoManager *MaemoManager::instance()
{
if (!m_instance) {
QMutexLocker _(&m_mutex);
if (!m_instance)
m_instance = new MaemoManager;
}
return m_instance;
}
ProjectExplorer::ToolChain*
MaemoManager::maemoToolChain(const QtVersion *version) const
{
return new MaemoToolChain(version);
}
void
MaemoManager::addQemuSimulatorStarter(Project *project)
{
projects.insert(project);
if (m_qemuCommand) {
m_qemuCommand->action()->setVisible(true);
return;
}
Core::ICore *core = Core::ICore::instance();
Core::ModeManager *modeManager = core->modeManager();
Core::ActionManager *actionManager = core->actionManager();
QAction *action = new QAction("Qemu", this);
action->setIcon(icon.pixmap(iconSize));
action->setToolTip(tr("Start Qemu"));
m_qemuCommand = actionManager->registerAction(action, "qemu",
QList<int>() << Core::Constants::C_GLOBAL_ID);
modeManager->addAction(m_qemuCommand, 1);
m_qemuCommand->action()->setEnabled(true);
m_qemuCommand->setAttribute(Core::Command::CA_UpdateText);
m_qemuCommand->setAttribute(Core::Command::CA_UpdateIcon);
connect(m_qemuCommand->action(), SIGNAL(triggered()), this, SLOT(triggered()));
}
void
MaemoManager::removeQemuSimulatorStarter(Project *project)
{
projects.remove(project);
if (projects.isEmpty() && m_qemuCommand)
m_qemuCommand->action()->setVisible(false);
}
void
MaemoManager::setQemuSimulatorStarterEnabled(bool enable)
{
if (m_qemuCommand)
m_qemuCommand->action()->setEnabled(enable);
}
void
MaemoManager::triggered()
{
emit startStopQemu();
}
void
MaemoManager::updateQemuSimulatorStarter(bool running)
{
if (m_qemuCommand) {
QIcon::State state = QIcon::Off;
QString toolTip(tr("Start Qemu"));
if (running) {
state = QIcon::On;
toolTip = tr("Stop Qemu");
}
QAction *action = m_qemuCommand->action();
action->setToolTip(toolTip);
action->setIcon(icon.pixmap(iconSize, QIcon::Normal, state));
}
}
} // namespace Internal
} // namespace Qt4ProjectManager

View File

@@ -0,0 +1,103 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef MAEMOMANAGER_H
#define MAEMOMANAGER_H
#include "qtversionmanager.h"
#include <coreplugin/actionmanager/command.h>
#include <QtCore/QMutex>
#include <QtCore/QObject>
#include <QtCore/QSet>
#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE
namespace ProjectExplorer {
class Project;
class ToolChain;
}
using ProjectExplorer::Project;
using ProjectExplorer::ToolChain;
namespace Qt4ProjectManager {
class QtVersion;
namespace Internal {
class MaemoRunControlFactory;
class MaemoRunConfigurationFactory;
class MaemoManager : public QObject
{
Q_OBJECT
public:
static MaemoManager *instance();
void addVersion(const Qt4ProjectManager::QtVersion *version) { Q_UNUSED(version); }
ToolChain *maemoToolChain(const Qt4ProjectManager::QtVersion *version) const;
void addQemuSimulatorStarter(Project *project);
void removeQemuSimulatorStarter(Project *project);
void setQemuSimulatorStarterEnabled(bool state);
public slots:
void triggered();
void updateQemuSimulatorStarter(bool running);
signals:
void startStopQemu();
private:
MaemoManager();
~MaemoManager();
private:
static QMutex m_mutex;
static MaemoManager *m_instance;
MaemoRunControlFactory *m_runControlFactory;
MaemoRunConfigurationFactory *m_runConfigurationFactory;
QIcon icon;
int m_runCount;
QSet<Project*> projects;
Core::Command *m_qemuCommand;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // MAEMOMANAGER_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,228 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef MAEMORUNCONFIGURATION_H
#define MAEMORUNCONFIGURATION_H
#include <QtCore/QDateTime>
#include <QtGui/QWidget>
#include <debugger/debuggermanager.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/applicationlauncher.h>
namespace Qt4ProjectManager {
class Qt4Project;
namespace Internal {
class MaemoManager;
class MaemoToolChain;
using namespace ProjectExplorer;
typedef QSharedPointer<RunConfiguration> RunConfig;
#define USE_SSL_PASSWORD 0
class ErrorDumper : public QObject
{
Q_OBJECT
public:
ErrorDumper(QObject *parent = 0)
: QObject(parent) {}
public slots:
void printToStream(QProcess::ProcessError error);
};
class MaemoRunConfiguration : public RunConfiguration
{
Q_OBJECT
public:
MaemoRunConfiguration(Project *project, const QString &proFilePath);
~MaemoRunConfiguration();
QString type() const;
bool isEnabled() const;
QWidget *configurationWidget();
Qt4Project *project() const;
void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
void restore(const ProjectExplorer::PersistentSettingsReader &reader);
bool currentlyNeedsDeployment() const;
void wasDeployed();
bool hasDebuggingHelpers() const;
bool debuggingHelpersNeedDeployment() const;
void debuggingHelpersDeployed();
QString maddeRoot() const;
QString executable() const;
const QString sysRoot() const;
const QStringList arguments() const { return m_arguments; }
void setArguments(const QStringList &args);
QString simulator() const;
QString simulatorArgs() const;
QString simulatorPath() const;
QString visibleSimulatorParameter() const;
bool remoteHostIsSimulator() const { return m_remoteHostIsSimulator; }
const QString remoteHostName() const { return m_remoteHostName; }
const QString remoteUserName() const { return m_remoteUserName; }
int remotePort() const { return m_remotePort > 0 ? m_remotePort : 22; }
const QString remoteDir() const;
const QString sshCmd() const;
const QString scpCmd() const;
const QString gdbCmd() const;
const QString dumperLib() const;
void setRemoteHostIsSimulator(bool isSimulator);
void setRemoteHostName(const QString &hostName);
void setRemoteUserName(const QString &userName);
void setRemotePort(int port);
bool isQemuRunning() const;
#if USE_SSL_PASSWORD
// Only valid if remoteHostRequiresPassword() == true.
void setRemotePassword(const QString &password);
const QString remoteUserPassword() const { return m_remoteUserPassword; }
void setRemoteHostRequiresPassword(bool requiresPassword);
bool remoteHostRequiresPassword() const { return m_remoteHostRequiresPassword; }
#endif
signals:
void targetInformationChanged();
void cachedSimulatorInformationChanged();
void qemuProcessStatus(bool running);
private slots:
void invalidateCachedTargetInformation();
void setSimulatorPath(const QString &path);
void invalidateCachedSimulatorInformation();
void startStopQemu();
void qemuProcessFinished();
void enabledStateChanged();
private:
void updateTarget();
void updateSimulatorInformation();
const QString cmd(const QString &cmdName) const;
const MaemoToolChain *toolchain() const;
bool fileNeedsDeployment(const QString &path, const QDateTime &lastDeployed) const;
private:
// Keys for saving/loading attributes.
static const QString ArgumentsKey;
static const QString RemoteHostIsSimulatorKey;
static const QString RemoteHostRequiresPasswordKey;
static const QString RemoteHostNameKey;
static const QString RemoteUserNameKey;
static const QString RemoteUserPasswordKey;
static const QString RemotePortKey;
static const QString LastDeployedKey;
static const QString DebuggingHelpersLastDeployedKey;
QString m_executable;
QString m_proFilePath;
bool m_cachedTargetInformationValid;
QStringList m_arguments;
QString m_simulator;
QString m_simulatorArgs;
QString m_simulatorPath;
QString m_visibleSimulatorParameter;
bool m_cachedSimulatorInformationValid;
QString m_gdbPath;
// Information about the remote host.
bool m_remoteHostIsSimulator;
QString m_remoteHostName;
QString m_remoteUserName;
int m_remotePort;
QDateTime m_lastDeployed;
QDateTime m_debuggingHelpersLastDeployed;
QProcess *qemu;
ErrorDumper dumper;
#if USE_SSL_PASSWORD
QString m_remoteUserPassword;
bool m_remoteHostRequiresPassword;
#endif
};
class MaemoRunConfigurationFactory : public IRunConfigurationFactory
{
Q_OBJECT
public:
MaemoRunConfigurationFactory(QObject *parent);
~MaemoRunConfigurationFactory();
bool canRestore(const QString &type) const;
QStringList availableCreationTypes(Project *project) const;
QString displayNameForType(const QString &type) const;
RunConfig create(Project *project, const QString &type);
private slots:
void addedRunConfiguration(ProjectExplorer::Project* project);
void removedRunConfiguration(ProjectExplorer::Project* project);
void projectAdded(ProjectExplorer::Project* project);
void projectRemoved(ProjectExplorer::Project* project);
void currentProjectChanged(ProjectExplorer::Project* project);
};
class MaemoRunControlFactory : public IRunControlFactory
{
Q_OBJECT
public:
MaemoRunControlFactory(QObject *parent = 0);
bool canRun(const RunConfig &runConfiguration, const QString &mode) const;
RunControl* create(const RunConfig &runConfiguration, const QString &mode);
QString displayName() const;
QWidget *configurationWidget(const RunConfig &runConfiguration);
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // MAEMORUNCONFIGURATION_H

View File

@@ -0,0 +1,220 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "maemotoolchain.h"
#include "qtversionmanager.h"
#include <QtCore/QDir>
#include <QtCore/QtDebug>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
#ifdef Q_OS_WIN32
#define EXEC_SUFFIX ".exe"
#else
#define EXEC_SUFFIX ""
#endif
namespace {
const char *GCC_MAEMO_COMMAND = "arm-none-linux-gnueabi-gcc" EXEC_SUFFIX;
}
MaemoToolChain::MaemoToolChain(const Qt4ProjectManager::QtVersion *version)
: GccToolChain(QLatin1String(GCC_MAEMO_COMMAND))
, m_maddeInitialized(false)
, m_sysrootInitialized(false)
, m_simulatorInitialized(false)
, m_targetInitialized(false)
, m_toolchainInitialized(false)
, m_version(version)
{
}
MaemoToolChain::~MaemoToolChain()
{
}
ToolChain::ToolChainType MaemoToolChain::type() const
{
return ToolChain::GCC_MAEMO;
}
QList<HeaderPath> MaemoToolChain::systemHeaderPaths()
{
if (m_systemHeaderPaths.isEmpty()) {
GccToolChain::systemHeaderPaths();
m_systemHeaderPaths
.append(HeaderPath(QString("%1/usr/include").arg(sysrootRoot()),
HeaderPath::GlobalHeaderPath));
}
return m_systemHeaderPaths;
}
void MaemoToolChain::addToEnvironment(ProjectExplorer::Environment &env)
{
if (m_version) {
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin")
.arg(maddeRoot())));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin")
.arg(targetRoot())));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin")
.arg(toolchainRoot())));
#ifdef Q_OS_WIN
env.set("HOME", QDir::toNativeSeparators(maddeRoot()
+ QLatin1String("/home/") + QDir::home().dirName()));
#endif
}
}
QString MaemoToolChain::makeCommand() const
{
return QLatin1String("make" EXEC_SUFFIX);
}
bool MaemoToolChain::equals(ToolChain *other) const
{
MaemoToolChain *toolChain = static_cast<MaemoToolChain*> (other);
return (other->type() == type()
&& toolChain->sysrootRoot() == sysrootRoot()
&& toolChain->simulatorRoot() == simulatorRoot()
&& toolChain->targetRoot() == targetRoot()
&& toolChain->toolchainRoot() == toolchainRoot());
}
QString MaemoToolChain::maddeRoot() const
{
if (!m_maddeInitialized)
(const_cast<MaemoToolChain*> (this))->setMaddeRoot();
return m_maddeRoot;
}
QString MaemoToolChain::targetRoot() const
{
if (!m_targetInitialized)
(const_cast<MaemoToolChain*> (this))->setTargetRoot();
return m_targetRoot;
}
QString MaemoToolChain::sysrootRoot() const
{
if (!m_sysrootInitialized)
(const_cast<MaemoToolChain*> (this))->setSysrootAndToolchain();
return m_sysrootRoot;
}
QString MaemoToolChain::simulatorRoot() const
{
if (!m_simulatorInitialized)
(const_cast<MaemoToolChain*> (this))->setSimulatorRoot();
return m_simulatorRoot;
}
QString MaemoToolChain::toolchainRoot() const
{
if (!m_toolchainInitialized)
(const_cast<MaemoToolChain*> (this))->setSysrootAndToolchain();
return m_toolchainRoot;
}
void MaemoToolChain::setTargetRoot()
{
m_targetInitialized = true;
QString qmake = QDir::cleanPath(m_version->qmakeCommand());
m_targetRoot = qmake.remove(QLatin1String("/bin/qmake" EXEC_SUFFIX));
}
void MaemoToolChain::setMaddeRoot()
{
QDir dir(targetRoot());
dir.cdUp(); dir.cdUp();
m_maddeInitialized = true;
m_maddeRoot = dir.absolutePath();
}
void MaemoToolChain::setSimulatorRoot()
{
QString target = QDir::cleanPath(targetRoot());
target = target.mid(target.lastIndexOf(QLatin1Char('/')) + 1);
QFile file(maddeRoot() + QLatin1String("/cache/madde.conf"));
if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream stream(&file);
while (!stream.atEnd()) {
QString line = stream.readLine().trimmed();
if (!line.startsWith(QLatin1String("target")))
continue;
const QStringList &list = line.split(QLatin1Char(' '));
if (list.count() <= 1 || list.at(1) != target)
continue;
line = stream.readLine().trimmed();
while (!stream.atEnd() && line != QLatin1String("end")) {
if (line.startsWith(QLatin1String("runtime"))) {
const QStringList &list = line.split(QLatin1Char(' '));
if (list.count() > 1) {
m_simulatorRoot = maddeRoot()
+ QLatin1String("/runtimes/") + list.at(1).trimmed();
}
break;
}
line = stream.readLine().trimmed();
}
}
}
m_simulatorInitialized = true;
}
void MaemoToolChain::setSysrootAndToolchain()
{
QFile file(QDir::cleanPath(targetRoot()) + QLatin1String("/information"));
if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream stream(&file);
while (!stream.atEnd()) {
const QString &line = stream.readLine().trimmed();
const QStringList &list = line.split(QLatin1Char(' '));
if (list.count() <= 1)
continue;
if (list.at(0) == QLatin1String("sysroot")) {
m_sysrootRoot = maddeRoot() + QLatin1String("/sysroots/")
+ list.at(1);
}
if (list.at(0) == QLatin1String("toolchain")) {
m_toolchainRoot = maddeRoot() + QLatin1String("/toolchains/")
+ list.at(1);
}
}
}
m_sysrootInitialized = true;
m_toolchainInitialized = true;
}

View File

@@ -0,0 +1,87 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef MAEMOTOOLCHAIN_H
#define MAEMOTOOLCHAIN_H
#include <projectexplorer/toolchain.h>
namespace Qt4ProjectManager {
class QtVersion;
namespace Internal {
class MaemoToolChain : public ProjectExplorer::GccToolChain
{
public:
MaemoToolChain(const Qt4ProjectManager::QtVersion *version);
virtual ~MaemoToolChain();
QList<ProjectExplorer::HeaderPath> systemHeaderPaths();
void addToEnvironment(ProjectExplorer::Environment &env);
ProjectExplorer::ToolChain::ToolChainType type() const;
QString makeCommand() const;
QString maddeRoot() const;
QString targetRoot() const;
QString sysrootRoot() const;
QString simulatorRoot() const;
QString toolchainRoot() const;
protected:
bool equals(ToolChain *other) const;
private:
void setMaddeRoot();
void setTargetRoot();
void setSimulatorRoot();
void setSysrootAndToolchain();
private:
QString m_maddeRoot;
bool m_maddeInitialized;
QString m_sysrootRoot;
bool m_sysrootInitialized;
QString m_simulatorRoot;
bool m_simulatorInitialized;
QString m_targetRoot;
bool m_targetInitialized;
QString m_toolchainRoot;
bool m_toolchainInitialized;
const Qt4ProjectManager::QtVersion *m_version;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // MAEMOTOOLCHAIN_H

View File

@@ -0,0 +1,14 @@
SUPPORT_QT_MAEMO = $$(QTCREATOR_WITH_MAEMO)
!isEmpty(SUPPORT_QT_MAEMO) {
message("Adding experimental support for Qt/Maemo applications.")
DEFINES += QTCREATOR_WITH_MAEMO
HEADERS += \
$$PWD/maemorunconfiguration.h \
$$PWD/maemomanager.h \
$$PWD/maemotoolchain.h
SOURCES += \
$$PWD/maemorunconfiguration.cpp \
$$PWD/maemomanager.cpp \
$$PWD/maemotoolchain.cpp
RESOURCES += $$PWD/qt-maemo.qrc
}

View File

@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/qt-maemo">
<file>images/qemu-run.png</file>
<file>images/qemu-stop.png</file>
</qresource>
</RCC>

View File

@@ -88,6 +88,7 @@ RESOURCES += qt4projectmanager.qrc \
wizards/wizards.qrc wizards/wizards.qrc
include(../../shared/proparser/proparser.pri) include(../../shared/proparser/proparser.pri)
include(qt-s60/qt-s60.pri) include(qt-s60/qt-s60.pri)
include(qt-maemo/qt-maemo.pri)
include(customwidgetwizard/customwidgetwizard.pri) include(customwidgetwizard/customwidgetwizard.pri)
DEFINES += QT_NO_CAST_TO_ASCII DEFINES += QT_NO_CAST_TO_ASCII
OTHER_FILES += Qt4ProjectManager.pluginspec OTHER_FILES += Qt4ProjectManager.pluginspec

View File

@@ -51,6 +51,10 @@
#include "qt-s60/s60manager.h" #include "qt-s60/s60manager.h"
#endif #endif
#ifdef QTCREATOR_WITH_MAEMO
#include "qt-maemo/maemomanager.h"
#endif
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildmanager.h> #include <projectexplorer/buildmanager.h>
@@ -160,6 +164,10 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new S60Manager); addAutoReleasedObject(new S60Manager);
#endif #endif
#ifdef QTCREATOR_WITH_MAEMO
addAutoReleasedObject(MaemoManager::instance());
#endif
// TODO reenable // TODO reenable
//m_embeddedPropertiesPage = new EmbeddedPropertiesPage; //m_embeddedPropertiesPage = new EmbeddedPropertiesPage;
//addObject(m_embeddedPropertiesPage); //addObject(m_embeddedPropertiesPage);

View File

@@ -95,15 +95,21 @@ QString Qt4RunConfiguration::type() const
bool Qt4RunConfiguration::isEnabled() const bool Qt4RunConfiguration::isEnabled() const
{ {
#ifdef QTCREATOR_WITH_S60 #if defined(QTCREATOR_WITH_S60) || defined(QTCREATOR_WITH_MAEMO)
Qt4Project *pro = qobject_cast<Qt4Project*>(project()); Qt4Project *pro = qobject_cast<Qt4Project*>(project());
QTC_ASSERT(pro, return false); QTC_ASSERT(pro, return false);
ProjectExplorer::ToolChain::ToolChainType type = pro->toolChainType(pro->activeBuildConfiguration()); ProjectExplorer::ToolChain::ToolChainType type = pro->toolChainType(pro->activeBuildConfiguration());
#ifdef QTCREATOR_WITH_S60
if (type == ProjectExplorer::ToolChain::WINSCW if (type == ProjectExplorer::ToolChain::WINSCW
|| type == ProjectExplorer::ToolChain::GCCE || type == ProjectExplorer::ToolChain::GCCE
|| type == ProjectExplorer::ToolChain::RVCT_ARMV5 || type == ProjectExplorer::ToolChain::RVCT_ARMV5
|| type == ProjectExplorer::ToolChain::RVCT_ARMV6) || type == ProjectExplorer::ToolChain::RVCT_ARMV6)
return false; return false;
#endif
#ifdef QTCREATOR_WITH_MAEMO
if (type == ProjectExplorer::ToolChain::GCC_MAEMO)
return false;
#endif
#endif #endif
return true; return true;
} }

View File

@@ -35,6 +35,9 @@
#ifdef QTCREATOR_WITH_S60 #ifdef QTCREATOR_WITH_S60
#include "qt-s60/s60manager.h" #include "qt-s60/s60manager.h"
#endif #endif
#ifdef QTCREATOR_WITH_MAEMO
#include "qt-maemo/maemomanager.h"
#endif
#include <projectexplorer/debugginghelper.h> #include <projectexplorer/debugginghelper.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
@@ -1055,6 +1058,10 @@ ProjectExplorer::ToolChain *QtVersion::createToolChain(ProjectExplorer::ToolChai
} else if (type == ProjectExplorer::ToolChain::RVCT_ARMV5 } else if (type == ProjectExplorer::ToolChain::RVCT_ARMV5
|| type == ProjectExplorer::ToolChain::RVCT_ARMV6) { || type == ProjectExplorer::ToolChain::RVCT_ARMV6) {
tempToolchain = S60Manager::instance()->createRVCTToolChain(this, type); tempToolchain = S60Manager::instance()->createRVCTToolChain(this, type);
#endif
#ifdef QTCREATOR_WITH_MAEMO
} else if (type == ProjectExplorer::ToolChain::GCC_MAEMO) {
tempToolchain = MaemoManager::instance()->maemoToolChain(this);
#endif #endif
} else { } else {
qDebug()<<"Could not create ToolChain for"<<mkspec(); qDebug()<<"Could not create ToolChain for"<<mkspec();
@@ -1150,6 +1157,25 @@ QList<ProjectExplorer::ToolChain::ToolChainType> QtVersion::possibleToolChainTyp
<< ProjectExplorer::ToolChain::RVCT_ARMV5 << ProjectExplorer::ToolChain::RVCT_ARMV5
<< ProjectExplorer::ToolChain::RVCT_ARMV6 << ProjectExplorer::ToolChain::RVCT_ARMV6
<< ProjectExplorer::ToolChain::WINSCW; << ProjectExplorer::ToolChain::WINSCW;
#endif
#ifdef QTCREATOR_WITH_MAEMO
} else if (spec.contains("linux-g++-opengl")) {
bool maemo = false;
const QString baseDir = m_versionInfo.contains("QT_INSTALL_DATA") ?
m_versionInfo.value("QT_INSTALL_DATA") : QLatin1String("");
QFile qconfigpri(baseDir + QLatin1String("/mkspecs/qconfig.pri"));
if (qconfigpri.exists()) {
qconfigpri.open(QIODevice::ReadOnly | QIODevice::Text);
QTextStream stream(&qconfigpri);
while (!stream.atEnd()) {
QString line = stream.readLine().trimmed();
if (line.startsWith(QLatin1String("QT_ARCH"))
&& line.endsWith(QLatin1String("arm")))
maemo = true;
}
}
toolChains << (maemo ? ProjectExplorer::ToolChain::GCC_MAEMO
: ProjectExplorer::ToolChain::GCC);
#endif #endif
} else { } else {
toolChains << ProjectExplorer::ToolChain::GCC; toolChains << ProjectExplorer::ToolChain::GCC;