Commit eb91f084 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Symbian: Improve support for sbsv2

 * Export SBS_GCCE<VERSION>BIN containing the path to the GCCE compiler
   used.
parent 98a4e1fb
......@@ -33,6 +33,7 @@
#include <utils/qtcassert.h>
#include <QtCore/QDir>
#include <QtCore/QProcess>
#include <QtCore/QtDebug>
enum { debug = 0 };
......@@ -138,6 +139,9 @@ void GCCEToolChain::addToEnvironment(ProjectExplorer::Environment &env)
default:
break;
}
QString version = gcceVersion();
version = version.remove(QLatin1Char('.'));
env.set(QString::fromLatin1("SBS_GCCE") + version + QLatin1String("BIN"), QDir::toNativeSeparators(m_gcceBinPath));
}
QString GCCEToolChain::makeCommand() const
......@@ -154,3 +158,34 @@ bool GCCEToolChain::equals(ToolChain *otherIn) const
&& m_gcceBinPath == other->m_gcceBinPath
&& gcc() == other->gcc();
}
QString GCCEToolChain::gcceVersion() const
{
if (m_gcceVersion.isEmpty()) {
QString command = gcceCommand(m_gcceBinPath);
if (command.isEmpty())
return QString();
QProcess gxx;
QStringList arguments;
arguments << QLatin1String("--version");
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
env.set(QLatin1String("LC_ALL"), QLatin1String("C")); //override current locale settings
gxx.setEnvironment(env.toStringList());
gxx.setReadChannelMode(QProcess::MergedChannels);
gxx.start(command, arguments);
gxx.closeWriteChannel();
gxx.waitForFinished();
QString line;
if (gxx.canReadLine()) {
line = gxx.readLine();
qDebug() << "GCCVersion:" << line;
QRegExp version("\\s((\\d+)\\.(\\d+)\\.(\\d+))\\s");
if (line.indexOf(version) >= -1) {
qDebug() << " MATCHED!";
m_gcceVersion = version.cap(1);
}
}
}
return m_gcceVersion;
}
......@@ -58,9 +58,11 @@ protected:
virtual bool equals(ToolChain *other) const;
private:
QString gcceVersion() const;
const S60ToolChainMixin m_mixin;
const ProjectExplorer::ToolChain::ToolChainType m_type;
const QString m_gcceBinPath;
mutable QString m_gcceVersion;
};
} // namespace Internal
......
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