Skip to content
Snippets Groups Projects
Commit cdc54c3b authored by con's avatar con
Browse files

System includes and defines for gcce tool chain.

parent 66c2c7c1
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
namespace {
const char *GCCE_COMMAND = "arm-none-symbianelf-gcc.exe";
}
GCCEToolChain::GCCEToolChain(S60Devices::Device device) GCCEToolChain::GCCEToolChain(S60Devices::Device device)
: m_deviceId(device.id), : m_deviceId(device.id),
m_deviceName(device.name), m_deviceName(device.name),
...@@ -24,18 +28,88 @@ ToolChain::ToolChainType GCCEToolChain::type() const ...@@ -24,18 +28,88 @@ ToolChain::ToolChainType GCCEToolChain::type() const
QByteArray GCCEToolChain::predefinedMacros() QByteArray GCCEToolChain::predefinedMacros()
{ {
// TODO if (m_predefinedMacros.isEmpty()) {
QStringList arguments;
arguments << QLatin1String("-xc++")
<< QLatin1String("-E")
<< QLatin1String("-dM")
<< QLatin1String("-");
QProcess cpp;
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
addToEnvironment(env);
cpp.setEnvironment(env.toStringList());
cpp.start(QLatin1String(GCCE_COMMAND), arguments);
cpp.closeWriteChannel();
cpp.waitForFinished();
m_predefinedMacros = cpp.readAllStandardOutput();
}
return m_predefinedMacros; return m_predefinedMacros;
} }
QList<HeaderPath> GCCEToolChain::systemHeaderPaths() QList<HeaderPath> GCCEToolChain::systemHeaderPaths()
{ {
// TODO if (m_systemHeaderPaths.isEmpty()) {
QStringList arguments;
arguments << QLatin1String("-xc++")
<< QLatin1String("-E")
<< QLatin1String("-v")
<< QLatin1String("-");
QProcess cpp;
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
addToEnvironment(env);
cpp.setEnvironment(env.toStringList());
cpp.setReadChannelMode(QProcess::MergedChannels);
cpp.start(QLatin1String(GCCE_COMMAND), arguments);
cpp.closeWriteChannel();
cpp.waitForFinished();
QByteArray line;
while (cpp.canReadLine()) {
line = cpp.readLine();
if (line.startsWith("#include"))
break;
}
if (! line.isEmpty() && line.startsWith("#include")) {
HeaderPath::Kind kind = HeaderPath::UserHeaderPath;
while (cpp.canReadLine()) {
line = cpp.readLine();
if (line.startsWith("#include")) {
kind = HeaderPath::GlobalHeaderPath;
} else if (! line.isEmpty() && QChar(line.at(0)).isSpace()) {
HeaderPath::Kind thisHeaderKind = kind;
line = line.trimmed();
if (line.endsWith('\n'))
line.chop(1);
int index = line.indexOf(" (framework directory)");
if (index != -1) {
line = line.left(index);
thisHeaderKind = HeaderPath::FrameworkHeaderPath;
}
m_systemHeaderPaths.append(HeaderPath(QFile::decodeName(line), thisHeaderKind));
} else if (line.startsWith("End of search list.")) {
break;
} else {
qWarning() << "ignore line:" << line;
}
}
}
}
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\stdapis").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\stdapis\\sys").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\variant").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
return m_systemHeaderPaths; return m_systemHeaderPaths;
} }
void GCCEToolChain::addToEnvironment(ProjectExplorer::Environment &env) void GCCEToolChain::addToEnvironment(ProjectExplorer::Environment &env)
{ {
// TODO: do we need to set path to gcce?
env.prependOrSetPath(QString("%1\\epoc32\\tools").arg(m_deviceRoot)); // e.g. make.exe 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.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("EPOCDEVICE", QString("%1:%2").arg(m_deviceId, m_deviceName));
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
* predefined macros * predefined macros
* system includes * system includes
* GCCE tool chain:
* predefined macros
* system includes
* Run WINSCW executables * Run WINSCW executables
* Deploy gcce executables * Deploy gcce executables
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment