Add toolchain for WinScw, and be able to compile for winscw udeb.

This commit is contained in:
con
2009-05-28 18:36:52 +02:00
parent 3267a917a3
commit 02fb12d74d
10 changed files with 170 additions and 11 deletions

View File

@@ -73,6 +73,9 @@ public:
MinGW, MinGW,
MSVC, MSVC,
WINCE, WINCE,
#ifdef QTCREATOR_WITH_S60
WINSCW,
#endif
OTHER, OTHER,
UNKNOWN, UNKNOWN,
INVALID INVALID

View File

@@ -1,3 +1,11 @@
* When the refresh button in the SDK option page is pressed * When the refresh button in the SDK option page is pressed
the qtoptionspage is not updated to reflect the new versions the qtoptionspage is not updated to reflect the new versions
though we update them in S60Manager though we update them in S60Manager
* QtVersion:
* support the different tool chains
* WINSCW tool chain:
* predefined macros
* system includes
* get rid of hardcoded carbide path

View File

@@ -2,14 +2,14 @@ SUPPORT_QT_S60 = $$(QTCREATOR_WITH_S60)
!isEmpty(SUPPORT_QT_S60) { !isEmpty(SUPPORT_QT_S60) {
message("Adding experimental support for Qt/S60 applications.") message("Adding experimental support for Qt/S60 applications.")
DEFINES += QTCREATOR_WITH_S60 DEFINES += QTCREATOR_WITH_S60
SOURCES += $$PWD/s60devices.cpp \ SOURCES += $$PWD/s60devices.cpp \
$$PWD/s60devicespreferencepane.cpp \ $$PWD/s60devicespreferencepane.cpp \
$$PWD/s60manager.cpp $$PWD/s60manager.cpp \
$$PWD/winscwtoolchain.cpp
HEADERS += $$PWD/s60devices.h \ HEADERS += $$PWD/s60devices.h \
$$PWD/s60devicespreferencepane.h \ $$PWD/s60devicespreferencepane.h \
$$PWD/s60manager.h $$PWD/s60manager.h \
$$PWD/winscwtoolchain.h
FORMS += $$PWD/s60devicespreferencepane.ui
OTHER_FILES += qt-s60-todo.txt OTHER_FILES += qt-s60-todo.txt
} }

View File

@@ -129,12 +129,25 @@ QList<S60Devices::Device> S60Devices::devices() const
return m_devices; return m_devices;
} }
S60Devices::Device S60Devices::deviceForRoot(const QString &epocRoot) const S60Devices::Device S60Devices::deviceForId(const QString &id) const
{ {
foreach (const S60Devices::Device &i, m_devices) { foreach (const S60Devices::Device &i, m_devices) {
if (i.epocRoot == epocRoot) { if (i.id == id) {
return i; return i;
} }
} }
return Device(); return Device();
} }
QString S60Devices::cleanedRootPath(const QString &deviceRoot)
{
QString path = deviceRoot;
if (path.size() > 1 && path[1] == QChar(':')) {
path = path.mid(2);
}
if (!path.size() || path[path.size()-1] != QChar('\\')) {
path += QChar('\\');
}
return path;
}

View File

@@ -26,8 +26,9 @@ public:
QString errorString() const; QString errorString() const;
QList<Device> devices() const; QList<Device> devices() const;
bool detectQtForDevices(); bool detectQtForDevices();
Device deviceForRoot(const QString &epocRoot) const; Device deviceForId(const QString &id) const;
static QString cleanedRootPath(const QString &deviceRoot);
signals: signals:
void qtVersionsChanged(); void qtVersionsChanged();

View File

@@ -31,21 +31,26 @@
#include "s60devices.h" #include "s60devices.h"
#include "s60devicespreferencepane.h" #include "s60devicespreferencepane.h"
#include "qtversionmanager.h" #include "winscwtoolchain.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
S60Manager *S60Manager::m_instance = 0;
namespace { namespace {
static const char *S60_AUTODETECTION_SOURCE = "QTS60"; static const char *S60_AUTODETECTION_SOURCE = "QTS60";
} }
S60Manager *S60Manager::instance() { return m_instance; }
S60Manager::S60Manager(QObject *parent) S60Manager::S60Manager(QObject *parent)
: QObject(parent), : QObject(parent),
m_devices(new S60Devices(this)), m_devices(new S60Devices(this)),
m_devicesPreferencePane(new S60DevicesPreferencePane(m_devices, this)) m_devicesPreferencePane(new S60DevicesPreferencePane(m_devices, this))
{ {
m_instance = this;
m_devices->detectQtForDevices(); m_devices->detectQtForDevices();
ExtensionSystem::PluginManager::instance() ExtensionSystem::PluginManager::instance()
->addObject(m_devicesPreferencePane); ->addObject(m_devicesPreferencePane);
@@ -105,3 +110,9 @@ void S60Manager::updateQtVersions()
versionManager->addVersion(version); versionManager->addVersion(version);
} }
} }
ProjectExplorer::ToolChain *S60Manager::createWINSCWToolChain(const Qt4ProjectManager::QtVersion *version) const
{
QString id = version->autodetectionSource().mid(QString(S60_AUTODETECTION_SOURCE).length()+1);
return new WINSCWToolChain(m_devices->deviceForId(id));
}

View File

@@ -30,11 +30,15 @@
#ifndef S60MANAGER_H #ifndef S60MANAGER_H
#define S60MANAGER_H #define S60MANAGER_H
#include "qtversionmanager.h"
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <projectexplorer/toolchain.h>
#include <QtCore/QObject> #include <QtCore/QObject>
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
class S60Devices; class S60Devices;
@@ -46,16 +50,20 @@ class S60Manager : public QObject
public: public:
S60Manager(QObject *parent = 0); S60Manager(QObject *parent = 0);
~S60Manager(); ~S60Manager();
static S60Manager *instance();
ProjectExplorer::ToolChain *createWINSCWToolChain(const Qt4ProjectManager::QtVersion *version) const;
private slots: private slots:
void updateQtVersions(); void updateQtVersions();
private: private:
static S60Manager *m_instance;
S60Devices *m_devices; S60Devices *m_devices;
S60DevicesPreferencePane *m_devicesPreferencePane; S60DevicesPreferencePane *m_devicesPreferencePane;
}; };
#endif // S60MANAGER_H
} // namespace Internal } // namespace Internal
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager
#endif // S60MANAGER_H

View File

@@ -0,0 +1,69 @@
#include "winscwtoolchain.h"
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
WINSCWToolChain::WINSCWToolChain(S60Devices::Device device)
// TODO get rid of hardcoded carbide path
: m_carbidePath(QLatin1String("C:\\Apps\\Nokia\\Carbide.c++ v2.0")),
m_deviceId(device.id),
m_deviceName(device.name),
m_deviceRoot(device.epocRoot)
{
}
ToolChain::ToolChainType WINSCWToolChain::type() const
{
return ToolChain::WINSCW;
}
QByteArray WINSCWToolChain::predefinedMacros()
{
// TODO
return m_predefinedMacros;
}
QList<HeaderPath> WINSCWToolChain::systemHeaderPaths()
{
// TODO
return m_systemHeaderPaths;
}
void WINSCWToolChain::addToEnvironment(ProjectExplorer::Environment &env)
{
QStringList symIncludes = QStringList()
<< "\\MSL\\MSL_C\\MSL_Common\\Include"
<< "\\MSL\\MSL_C\\MSL_Win32\\Include"
<< "\\MSL\\MSL_CMSL_X86"
<< "\\MSL\\MSL_C++\\MSL_Common\\Include"
<< "\\MSL\\MSL_Extras\\MSL_Common\\Include"
<< "\\MSL\\MSL_Extras\\MSL_Win32\\Include"
<< "\\Win32-x86 Support\\Headers\\Win32 SDK";
for (int i = 0; i < symIncludes.size(); ++i)
symIncludes[i].prepend(QString("%1\\x86Build\\Symbian_Support").arg(m_carbidePath));
env.set("MWCSYM2INCLUDES", symIncludes.join(";"));
QStringList symLibraries = QStringList()
<< "\\Win32-x86 Support\\Libraries\\Win32 SDK"
<< "\\Runtime\\Runtime_x86\\Runtime_Win32\\Libs";
for (int i = 0; i < symLibraries.size(); ++i)
symLibraries[i].prepend(QString("%1\\x86Build\\Symbian_Support").arg(m_carbidePath));
env.set("MWSYM2LIBRARIES", symLibraries.join(";"));
env.set("MWSYM2LIBRARYFILES", "MSL_All_MSE_Symbian_D.lib;gdi32.lib;user32.lib;kernel32.lib");
env.prependOrSetPath(QString("%1\\x86Build\\Symbian_Tools\\Command_Line_Tools").arg(m_carbidePath)); // compiler
env.prependOrSetPath(QString("%1\\epoc32\\tools").arg(m_deviceRoot)); // e.g. make.exe
env.prependOrSetPath(QString("%1\\epoc32\\gcc\\bin").arg(m_deviceRoot)); // e.g. gcc.exe
env.set("EPOCDEVICE", QString("%1:%2").arg(m_deviceId, m_deviceName));
env.set("EPOCROOT", S60Devices::cleanedRootPath(m_deviceRoot));
}
QString WINSCWToolChain::makeCommand() const
{
return "make";
}
bool WINSCWToolChain::equals(ToolChain *other) const
{
return (m_deviceId == static_cast<WINSCWToolChain *>(other)->m_deviceId
&& m_deviceName == static_cast<WINSCWToolChain *>(other)->m_deviceName);
}

View File

@@ -0,0 +1,36 @@
#ifndef WINSCWTOOLCHAIN_H
#define WINSCWTOOLCHAIN_H
#include "s60devices.h"
#include <projectexplorer/toolchain.h>
namespace Qt4ProjectManager {
namespace Internal {
class WINSCWToolChain : public ProjectExplorer::ToolChain
{
public:
WINSCWToolChain(S60Devices::Device device);
QByteArray predefinedMacros();
QList<ProjectExplorer::HeaderPath> systemHeaderPaths();
void addToEnvironment(ProjectExplorer::Environment &env);
ProjectExplorer::ToolChain::ToolChainType type() const;
QString makeCommand() const;
protected:
bool equals(ToolChain *other) const;
private:
QString m_carbidePath;
QString m_deviceId;
QString m_deviceName;
QString m_deviceRoot;
QByteArray m_predefinedMacros;
QList<ProjectExplorer::HeaderPath> m_systemHeaderPaths;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // WINSCWTOOLCHAIN_H

View File

@@ -32,6 +32,10 @@
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include "profilereader.h" #include "profilereader.h"
#ifdef QTCREATOR_WITH_S60
#include "qt-s60/s60manager.h"
#endif
#include <projectexplorer/debugginghelper.h> #include <projectexplorer/debugginghelper.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/cesdkhandler.h> #include <projectexplorer/cesdkhandler.h>
@@ -913,6 +917,10 @@ void QtVersion::updateToolChain() const
} }
m_test = ProjectExplorer::ToolChain::createGccToolChain(qmake_cxx); m_test = ProjectExplorer::ToolChain::createGccToolChain(qmake_cxx);
//qDebug()<<"GCC ToolChain ("<<qmake_cxx<<")"; //qDebug()<<"GCC ToolChain ("<<qmake_cxx<<")";
#ifdef QTCREATOR_WITH_S60
} else if (t == ProjectExplorer::ToolChain::WINSCW) {
m_test = S60Manager::instance()->createWINSCWToolChain(this);
#endif
} else { } else {
qDebug()<<"Could not detect ToolChain for"<<mkspec(); qDebug()<<"Could not detect ToolChain for"<<mkspec();
qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines."; qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines.";
@@ -1007,6 +1015,8 @@ ProjectExplorer::ToolChain::ToolChainType QtVersion::toolchainType() const
return ProjectExplorer::ToolChain::WINCE; return ProjectExplorer::ToolChain::WINCE;
else if (spec.contains("linux-icc")) else if (spec.contains("linux-icc"))
return ProjectExplorer::ToolChain::LinuxICC; return ProjectExplorer::ToolChain::LinuxICC;
else if (spec.contains("abld"))
return ProjectExplorer::ToolChain::WINSCW;
else else
return ProjectExplorer::ToolChain::GCC; return ProjectExplorer::ToolChain::GCC;
} }