Commit cd53a562 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Symbian: Check for /dev/ttyUSB, fix GCCE toolchain.

Move code to locate gcce from S60Manager to CCE toolchain and make it
handle empty GCCE-root's correctly (locate compiler in path and
warn if none found). Set up environment correctly.
parent 0b470d1c
......@@ -133,6 +133,7 @@ protected:
virtual bool equals(ToolChain *other) const;
QByteArray m_predefinedMacros;
QList<HeaderPath> m_systemHeaderPaths;
QString gcc() const { return m_gcc; }
private:
QString m_gcc;
......
......@@ -40,17 +40,49 @@ enum { debug = 0 };
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
// Locate the compiler via path.
static QString gcceCommand(const QString &dir)
{
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
if (!dir.isEmpty())
env.prependOrSetPath(dir + QLatin1String("/bin"));
QString gcce = QLatin1String("arm-none-symbianelf-gcc");
#ifdef Q_OS_WIN
gcce += QLatin1String(".exe");
#endif
const QString rc = env.searchInPath(gcce);
if (rc.isEmpty()) {
const QString msg = QString::fromLatin1("GCCEToolChain: Unable to locate '%1' in '%2' (GCCE root: '%3')")
.arg(gcce, env.value(QLatin1String("PATH")), dir);
qWarning("%s", qPrintable(msg));
return gcce;
}
return rc;
}
// The GccToolChain base class constructor wants to know the gcc command
GCCEToolChain *GCCEToolChain::create(const S60Devices::Device &device,
const QString &gcceRoot,
ProjectExplorer::ToolChain::ToolChainType type)
{
const QString gccCommand = gcceCommand(gcceRoot);
const QFileInfo gccCommandFi(gccCommand);
const QString binPath = gccCommandFi.isRelative() ? QString() : gccCommandFi.absolutePath();
return new GCCEToolChain(device, binPath, gccCommand, type);
}
GCCEToolChain::GCCEToolChain(const S60Devices::Device &device,
const QString &gcceBinPath,
const QString &gcceCommand,
ProjectExplorer::ToolChain::ToolChainType type) :
GccToolChain(gcceCommand),
m_mixin(device),
m_type(type),
m_gcceCommand(gcceCommand)
m_gcceBinPath(gcceBinPath)
{
QTC_ASSERT(m_type == ProjectExplorer::ToolChain::GCCE || m_type == ProjectExplorer::ToolChain::GCCE_GNUPOC, return)
if (debug)
qDebug() << "GCCEToolChain on" << m_type << m_mixin.device();
qDebug() << "GCCEToolChain on" << m_type << gcceCommand << gcceBinPath << m_mixin.device();
}
ToolChain::ToolChainType GCCEToolChain::type() const
......@@ -89,14 +121,18 @@ QList<HeaderPath> GCCEToolChain::systemHeaderPaths()
void GCCEToolChain::addToEnvironment(ProjectExplorer::Environment &env)
{
if (debug)
qDebug() << "GCCEToolChain::addToEnvironment" << m_type << gcc() << m_gcceBinPath<< m_mixin.device();
if (!m_gcceBinPath.isEmpty())
env.prependOrSetPath(m_gcceBinPath);
switch (m_type) {
case ProjectExplorer::ToolChain::GCCE:
m_mixin.addEpocToEnvironment(&env);
env.prependOrSetPath(QFileInfo(m_gcceCommand).absolutePath());
case ProjectExplorer::ToolChain::GCCE_GNUPOC:
m_mixin.addGnuPocToEnvironment(&env);
break;
default:
m_mixin.addGnuPocToEnvironment(&env);
break;
}
}
......@@ -112,5 +148,6 @@ bool GCCEToolChain::equals(ToolChain *otherIn) const
return false;
const GCCEToolChain *other = static_cast<const GCCEToolChain *>(otherIn);
return m_mixin == other->m_mixin
&& m_gcceCommand == other->m_gcceCommand;
&& m_gcceBinPath == other->m_gcceBinPath
&& gcc() == other->gcc();
}
......@@ -39,10 +39,14 @@ namespace Internal {
class GCCEToolChain : public ProjectExplorer::GccToolChain
{
public:
explicit GCCEToolChain(const S60Devices::Device &device,
const QString &gcceBinPath,
const QString &gcceCommand,
ProjectExplorer::ToolChain::ToolChainType type);
public:
static GCCEToolChain *create(const S60Devices::Device &device,
const QString &gcceRoot,
ProjectExplorer::ToolChain::ToolChainType type);
QByteArray predefinedMacros();
virtual QList<ProjectExplorer::HeaderPath> systemHeaderPaths();
......@@ -56,7 +60,7 @@ protected:
private:
const S60ToolChainMixin m_mixin;
const ProjectExplorer::ToolChain::ToolChainType m_type;
const QString m_gcceCommand;
const QString m_gcceBinPath;
};
} // namespace Internal
......
......@@ -47,8 +47,7 @@
#include <QtGui/QMainWindow>
namespace {
const char *GCCE_COMMAND = "arm-none-symbianelf-gcc.exe";
const char *S60_AUTODETECTION_SOURCE = "QTS60";
const char S60_AUTODETECTION_SOURCE[] = "QTS60";
}
namespace Qt4ProjectManager {
......@@ -220,16 +219,13 @@ ProjectExplorer::ToolChain *S60Manager::createWINSCWToolChain(const Qt4ProjectMa
ProjectExplorer::ToolChain *S60Manager::createGCCEToolChain(const Qt4ProjectManager::QtVersion *version) const
{
Q_ASSERT(version);
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
env.prependOrSetPath(version->gcceDirectory()+"/bin");
QString gcceCommandPath= env.searchInPath(GCCE_COMMAND);
return new GCCEToolChain(deviceForQtVersion(version), gcceCommandPath, ProjectExplorer::ToolChain::GCCE);
return GCCEToolChain::create(deviceForQtVersion(version), version->gcceDirectory(), ProjectExplorer::ToolChain::GCCE);
}
ProjectExplorer::ToolChain *S60Manager::createGCCE_GnuPocToolChain(const Qt4ProjectManager::QtVersion *version) const
{
Q_ASSERT(version);
return new GCCEToolChain(deviceForQtVersion(version), QLatin1String("arm-none-symbianelf-g++"), ProjectExplorer::ToolChain::GCCE_GNUPOC);
return GCCEToolChain::create(deviceForQtVersion(version), version->gcceDirectory(), ProjectExplorer::ToolChain::GCCE_GNUPOC);
}
ProjectExplorer::ToolChain *S60Manager::createRVCTToolChain(
......
......@@ -431,16 +431,26 @@ SymbianDeviceManager::SymbianDeviceList SymbianDeviceManager::blueToothDevices()
// Bluetooth devices are created on connection. List the existing ones
// or at least the first one.
const QString prefix = QLatin1String(linuxBlueToothDeviceRootC);
const QString friendlyFormat = QLatin1String("Bluetooth device (%1)");
const QString blueToothfriendlyFormat = QLatin1String("Bluetooth device (%1)");
for (int d = 0; d < 4; d++) {
QScopedPointer<SymbianDeviceData> device(new SymbianDeviceData);
device->type = BlueToothCommunication;
device->portName = prefix + QString::number(d);
if (d == 0 || QFileInfo(device->portName).exists()) {
device->friendlyName = friendlyFormat.arg(device->portName);
device->friendlyName = blueToothfriendlyFormat.arg(device->portName);
rc.push_back(SymbianDevice(device.take()));
}
}
// New kernel versions support /dev/ttyUSB0, /dev/ttyUSB1. Trk responds
// on the latter (usually).
const QString ttyUSBDevice = QLatin1String("/dev/ttyUSB1");
if (QFileInfo(ttyUSBDevice).exists()) {
SymbianDeviceData *device = new SymbianDeviceData;
device->type = SerialPortCommunication;
device->portName = ttyUSBDevice;
device->friendlyName = QString::fromLatin1("USB/Serial device (%1)").arg(device->portName);
rc.push_back(SymbianDevice(device));
}
#endif
return rc;
}
......
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