Commit 3c53e532 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

ToolChain: Add compilerCommand() method



Add a method returning the compiler command used. With this information
the buildsystem plugins can do better setup of the project.

Note that the compilerCommand refers to a C++ compiler!

Change-Id: Iad0bfa6a532cbdc38228db71599ab6192cb6127c
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@nokia.com>
parent b8ae31e6
......@@ -314,7 +314,7 @@ QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::createToolChainList(c
else if (v->supportsTargetId(Constants::MEEGO_DEVICE_TARGET_ID))
target = "Meego";
mTc->setDisplayName(tr("%1 GCC (%2)").arg(target).arg(MaemoGlobal::maddeRoot(mqv->qmakeCommand().toString())));
mTc->setCompilerPath(MaemoGlobal::targetRoot(mqv->qmakeCommand().toString()) + QLatin1String("/bin/gcc"));
mTc->setCompilerCommand(Utils::FileName::fromString(MaemoGlobal::targetRoot(mqv->qmakeCommand().toString()) + QLatin1String("/bin/gcc")));
mTc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(mqv->qtAbis().at(0)));
if (mTc->debuggerCommand().isEmpty())
mTc->setDebuggerCommand(Utils::FileName::fromString(MaemoGlobal::targetRoot(mqv->qmakeCommand().toString()) + QLatin1String("/bin/gdb")));
......
......@@ -135,6 +135,13 @@ void AbstractMsvcToolChain::setDebuggerCommand(const Utils::FileName &d)
toolChainUpdated();
}
Utils::FileName AbstractMsvcToolChain::compilerCommand() const
{
Utils::Environment env;
addToEnvironment(env);
return Utils::FileName::fromString(env.searchInPath("cl.exe"));
}
Utils::FileName AbstractMsvcToolChain::debuggerCommand() const
{
return m_debuggerCommand;
......
......@@ -58,6 +58,7 @@ public:
QString makeCommand() const;
void setDebuggerCommand(const Utils::FileName &d);
Utils::FileName compilerCommand() const;
Utils::FileName debuggerCommand() const;
IOutputParser *outputParser() const;
......
......@@ -64,9 +64,9 @@ static const char targetAbiKeyC[] = "ProjectExplorer.GccToolChain.TargetAbi";
static const char supportedAbisKeyC[] = "ProjectExplorer.GccToolChain.SupportedAbis";
static const char debuggerCommandKeyC[] = "ProjectExplorer.GccToolChain.Debugger";
static QByteArray runGcc(const QString &gcc, const QStringList &arguments, const QStringList &env)
static QByteArray runGcc(const Utils::FileName &gcc, const QStringList &arguments, const QStringList &env)
{
if (gcc.isEmpty() || !QFileInfo(gcc).isExecutable())
if (gcc.isEmpty() || !gcc.toFileInfo().isExecutable())
return QByteArray();
QProcess cpp;
......@@ -75,27 +75,27 @@ static QByteArray runGcc(const QString &gcc, const QStringList &arguments, const
environment.append(QLatin1String("LC_ALL=C"));
cpp.setEnvironment(environment);
cpp.start(gcc, arguments);
cpp.start(gcc.toString(), arguments);
if (!cpp.waitForStarted()) {
qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(gcc),
qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(gcc.toUserOutput()),
qPrintable(cpp.errorString()));
return QByteArray();
}
cpp.closeWriteChannel();
if (!cpp.waitForFinished()) {
Utils::SynchronousProcess::stopProcess(cpp);
qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(gcc));
qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(gcc.toUserOutput()));
return QByteArray();
}
if (cpp.exitStatus() != QProcess::NormalExit) {
qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(gcc));
qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(gcc.toUserOutput()));
return QByteArray();
}
return cpp.readAllStandardOutput() + '\n' + cpp.readAllStandardError();
}
static QByteArray gccPredefinedMacros(const QString &gcc, const QStringList &env)
static QByteArray gccPredefinedMacros(const Utils::FileName &gcc, const QStringList &env)
{
QStringList arguments;
arguments << QLatin1String("-xc++")
......@@ -120,7 +120,7 @@ static QByteArray gccPredefinedMacros(const QString &gcc, const QStringList &env
return predefinedMacros;
}
static QList<HeaderPath> gccHeaderPathes(const QString &gcc, const QStringList &env)
static QList<HeaderPath> gccHeaderPathes(const Utils::FileName &gcc, const QStringList &env)
{
QList<HeaderPath> systemHeaderPaths;
QStringList arguments;
......@@ -265,14 +265,14 @@ static QList<ProjectExplorer::Abi> guessGccAbi(const QString &m)
return abiList;
}
static QList<ProjectExplorer::Abi> guessGccAbi(const QString &path, const QStringList &env)
static QList<ProjectExplorer::Abi> guessGccAbi(const Utils::FileName &path, const QStringList &env)
{
QStringList arguments(QLatin1String("-dumpmachine"));
QString machine = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed();
return guessGccAbi(machine);
}
static QString gccVersion(const QString &path, const QStringList &env)
static QString gccVersion(const Utils::FileName &path, const QStringList &env)
{
QStringList arguments(QLatin1String("-dumpversion"));
return QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed();
......@@ -293,7 +293,7 @@ GccToolChain::GccToolChain(const QString &id, bool autodetect) :
GccToolChain::GccToolChain(const GccToolChain &tc) :
ToolChain(tc),
m_predefinedMacros(tc.predefinedMacros()),
m_compilerPath(tc.compilerPath()),
m_compilerCommand(tc.compilerPath()),
m_debuggerCommand(tc.debuggerCommand()),
m_targetAbi(tc.m_targetAbi),
m_supportedAbis(tc.m_supportedAbis),
......@@ -323,7 +323,7 @@ QString GccToolChain::legacyId() const
QString i = id();
i = i.left(i.indexOf(QLatin1Char(':')));
return QString::fromLatin1("%1:%2.%3.%4")
.arg(i).arg(m_compilerPath)
.arg(i).arg(m_compilerPath.toString())
.arg(m_targetAbi.toString()).arg(m_debuggerCommand.toString());
}
......@@ -393,7 +393,7 @@ QList<HeaderPath> GccToolChain::systemHeaderPaths() const
void GccToolChain::addToEnvironment(Utils::Environment &env) const
{
if (!m_compilerPath.isEmpty())
env.prependOrSetPath(QFileInfo(m_compilerPath).absolutePath());
env.prependOrSetPath(m_compilerPath.toString());
}
void GccToolChain::setDebuggerCommand(const Utils::FileName &d)
......@@ -422,7 +422,7 @@ Utils::FileName GccToolChain::mkspec() const
return Utils::FileName::fromString(QLatin1String("macx-g++"));
}
QList<Abi> gccAbiList = Abi::abisOfBinary(Utils::FileName::fromString(m_compilerPath));
QList<Abi> gccAbiList = Abi::abisOfBinary(m_compilerPath);
Abi gccAbi;
if (!gccAbiList.isEmpty())
gccAbi = gccAbiList.first();
......@@ -455,7 +455,7 @@ IOutputParser *GccToolChain::outputParser() const
return new GccParser;
}
void GccToolChain::setCompilerPath(const QString &path)
void GccToolChain::setCompilerCommand(const Utils::FileName &path)
{
if (path == m_compilerPath)
return;
......@@ -481,7 +481,7 @@ void GccToolChain::setCompilerPath(const QString &path)
toolChainUpdated();
}
QString GccToolChain::compilerPath() const
Utils::FileName GccToolChain::compilerCommand() const
{
return m_compilerPath;
}
......@@ -494,7 +494,7 @@ ToolChain *GccToolChain::clone() const
QVariantMap GccToolChain::toMap() const
{
QVariantMap data = ToolChain::toMap();
data.insert(QLatin1String(compilerPathKeyC), m_compilerPath);
data.insert(QLatin1String(compilerPathKeyC), m_compilerPath.toString());
data.insert(QLatin1String(targetAbiKeyC), m_targetAbi.toString());
QStringList abiList;
foreach (const ProjectExplorer::Abi &a, m_supportedAbis)
......@@ -509,7 +509,7 @@ bool GccToolChain::fromMap(const QVariantMap &data)
if (!ToolChain::fromMap(data))
return false;
m_compilerPath = data.value(QLatin1String(compilerPathKeyC)).toString();
m_compilerPath = Utils::FileName::fromString(data.value(QLatin1String(compilerPathKeyC)).toString());
m_targetAbi = Abi(data.value(QLatin1String(targetAbiKeyC)).toString());
QStringList abiList = data.value(QLatin1String(supportedAbisKeyC)).toStringList();
m_supportedAbis.clear();
......@@ -626,7 +626,7 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QSt
QList<ToolChain *> result;
const Utils::Environment systemEnvironment = Utils::Environment::systemEnvironment();
const QString compilerPath = systemEnvironment.searchInPath(compiler);
const Utils::FileName compilerPath = Utils::FileName::fromString(systemEnvironment.searchInPath(compiler));
if (compilerPath.isEmpty())
return result;
......@@ -652,7 +652,7 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QSt
if (tc.isNull())
return result;
tc->setCompilerPath(compilerPath);
tc->setCompilerCommand(compilerPath);
tc->setDebuggerCommand(debuggerPath);
tc->setTargetAbi(abi);
tc->setDisplayName(tc->defaultDisplayName()); // reset displayname
......@@ -701,10 +701,7 @@ void Internal::GccToolChainConfigWidget::apply()
GccToolChain *tc = static_cast<GccToolChain *>(toolChain());
Q_ASSERT(tc);
QString displayName = tc->displayName();
QString path = m_compilerPath->path();
if (path.isEmpty())
path = m_compilerPath->rawPath();
tc->setCompilerPath(path);
tc->setCompilerCommand(m_compilerPath->fileName());
tc->setTargetAbi(m_abiWidget->currentAbi());
tc->setDisplayName(displayName); // reset display name
tc->setDebuggerCommand(debuggerCommand());
......@@ -716,7 +713,7 @@ void Internal::GccToolChainConfigWidget::setFromToolchain()
// subwidgets are not yet connected!
bool blocked = blockSignals(true);
GccToolChain *tc = static_cast<GccToolChain *>(toolChain());
m_compilerPath->setPath(tc->compilerPath());
m_compilerPath->setFileName(tc->compilerCommand());
m_abiWidget->setAbis(tc->supportedAbis(), tc->targetAbi());
if (!m_isReadOnly && !m_compilerPath->path().isEmpty())
m_abiWidget->setEnabled(true);
......@@ -728,7 +725,7 @@ bool Internal::GccToolChainConfigWidget::isDirty() const
{
GccToolChain *tc = static_cast<GccToolChain *>(toolChain());
Q_ASSERT(tc);
return m_compilerPath->path() != tc->compilerPath()
return m_compilerPath->fileName() != tc->compilerCommand()
|| m_abiWidget->currentAbi() != tc->targetAbi();
}
......@@ -742,11 +739,11 @@ void Internal::GccToolChainConfigWidget::makeReadOnly()
void Internal::GccToolChainConfigWidget::handlePathChange()
{
QString path = m_compilerPath->path();
Utils::FileName path = m_compilerPath->fileName();
QList<Abi> abiList;
bool haveCompiler = false;
if (!path.isEmpty()) {
QFileInfo fi(path);
QFileInfo fi(path.toFileInfo());
haveCompiler = fi.isExecutable() && fi.isFile();
}
if (haveCompiler)
......
......@@ -81,8 +81,8 @@ public:
bool operator ==(const ToolChain &) const;
void setCompilerPath(const QString &);
QString compilerPath() const;
void setCompilerCommand(const Utils::FileName &);
Utils::FileName compilerCommand() const;
ToolChain *clone() const;
......@@ -103,7 +103,7 @@ private:
void updateSupportedAbis() const;
QString m_compilerPath;
Utils::FileName m_compilerPath;
Utils::FileName m_debuggerCommand;
Abi m_targetAbi;
......
......@@ -90,6 +90,7 @@ public:
virtual Utils::FileName mkspec() const = 0;
virtual Utils::FileName compilerCommand() const = 0;
virtual Utils::FileName debuggerCommand() const = 0;
virtual QString defaultMakeTarget() const;
virtual IOutputParser *outputParser() const = 0;
......
......@@ -44,7 +44,7 @@
namespace Qt4ProjectManager {
namespace Internal {
static QString gcceVersion(const QString &command)
static QString gcceVersion(const Utils::FileName &command)
{
if (command.isEmpty())
return QString();
......@@ -56,19 +56,19 @@ static QString gcceVersion(const QString &command)
env.set(QLatin1String("LC_ALL"), QLatin1String("C")); //override current locale settings
gxx.setEnvironment(env.toStringList());
gxx.setReadChannelMode(QProcess::MergedChannels);
gxx.start(command, arguments);
gxx.start(command.toString(), arguments);
if (!gxx.waitForStarted()) {
qWarning("Cannot start '%s': %s", qPrintable(command), qPrintable(gxx.errorString()));
qWarning("Cannot start '%s': %s", qPrintable(command.toUserOutput()), qPrintable(gxx.errorString()));
return QString();
}
gxx.closeWriteChannel();
if (!gxx.waitForFinished()) {
Utils::SynchronousProcess::stopProcess(gxx);
qWarning("Timeout running '%s'.", qPrintable(command));
qWarning("Timeout running '%s'.", qPrintable(command.toUserOutput()));
return QString();
}
if (gxx.exitStatus() != QProcess::NormalExit) {
qWarning("'%s' crashed.", qPrintable(command));
qWarning("'%s' crashed.", qPrintable(command.toUserOutput()));
return QString();
}
......@@ -110,7 +110,7 @@ void GcceToolChain::addToEnvironment(Utils::Environment &env) const
GccToolChain::addToEnvironment(env);
if (m_gcceVersion.isEmpty())
m_gcceVersion = gcceVersion(compilerPath());
m_gcceVersion = gcceVersion(compilerCommand());
if (m_gcceVersion.isEmpty())
return;
......@@ -118,7 +118,7 @@ void GcceToolChain::addToEnvironment(Utils::Environment &env) const
QString version = m_gcceVersion;
env.set(QString::fromLatin1("SBS_GCCE") + version.remove(QLatin1Char('.'))
+ QLatin1String("BIN"),
QDir::toNativeSeparators(QFileInfo(compilerPath()).absolutePath()));
compilerCommand().toUserOutput());
// Required for SBS, which checks the version output from its tools
// and gets confused by localized output.
env.set(QLatin1String("LANG"), QString(QLatin1Char('C')));
......@@ -143,10 +143,10 @@ QString GcceToolChain::defaultMakeTarget() const
return QLatin1String("gcce");
}
void GcceToolChain::setCompilerPath(const QString &path)
void GcceToolChain::setCompilerCommand(const Utils::FileName &path)
{
m_gcceVersion.clear();
GccToolChain::setCompilerPath(path);
GccToolChain::setCompilerCommand(path);
}
ProjectExplorer::ToolChain *GcceToolChain::clone() const
......@@ -185,19 +185,21 @@ QList<ProjectExplorer::ToolChain *> GcceToolChainFactory::autoDetect()
QFileInfo fi(path + QLatin1String("/bin/arm-none-symbianelf-g++.exe"));
if (fi.exists() && fi.isExecutable()) {
GcceToolChain *tc = new GcceToolChain(false);
tc->setCompilerPath(fi.absoluteFilePath());
tc->setCompilerCommand(Utils::FileName(fi));
tc->setDisplayName(tr("GCCE from Qt version"));
tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
result.append(tc);
}
}
QString fullPath = Utils::Environment::systemEnvironment().searchInPath(QLatin1String("arm-none-symbianelf-gcc"));
Utils::FileName fullPath =
Utils::FileName::fromString(Utils::Environment::systemEnvironment()
.searchInPath(QLatin1String("arm-none-symbianelf-gcc")));
QString version = gcceVersion(fullPath);
// If version is empty then this is not a GCC but e.g. bullseye!
if (!fullPath.isEmpty() && !version.isEmpty()) {
GcceToolChain *tc = new GcceToolChain(true);
tc->setCompilerPath(fullPath);
tc->setCompilerCommand(fullPath);
tc->setDisplayName(tr("GCCE (%1)").arg(version));
tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
if (tc->targetAbi() == ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture,
......
......@@ -54,7 +54,7 @@ public:
Utils::FileName mkspec() const;
QString defaultMakeTarget() const;
void setCompilerPath(const QString &);
void setCompilerCommand(const Utils::FileName &);
ProjectExplorer::ToolChain *clone() const;
......
......@@ -102,31 +102,30 @@ RvctToolChain::RvctToolChain(bool autodetected) :
RvctToolChain::RvctToolChain(const RvctToolChain &tc) :
ToolChain(tc),
m_compilerPath(tc.m_compilerPath),
m_compilerCommand(tc.m_compilerCommand),
m_environmentChanges(tc.m_environmentChanges),
m_armVersion(tc.m_armVersion),
m_debuggerCommand(tc.debuggerCommand())
{ }
RvctToolChain::RvctVersion RvctToolChain::version(const QString &rvctPath)
RvctToolChain::RvctVersion RvctToolChain::version(const Utils::FileName &rvctPath)
{
RvctToolChain::RvctVersion v;
QProcess armcc;
const QString binary = rvctPath;
armcc.start(binary, QStringList(QLatin1String("--version_number")));
armcc.start(rvctPath.toString(), QStringList(QLatin1String("--version_number")));
if (!armcc.waitForStarted()) {
qWarning("Unable to run rvct binary '%s' when trying to determine version.", qPrintable(binary));
qWarning("Unable to run rvct binary '%s' when trying to determine version.", qPrintable(rvctPath.toUserOutput()));
return v;
}
armcc.closeWriteChannel();
if (!armcc.waitForFinished()) {
Utils::SynchronousProcess::stopProcess(armcc);
qWarning("Timeout running rvct binary '%s' trying to determine version.", qPrintable(binary));
qWarning("Timeout running rvct binary '%s' trying to determine version.", qPrintable(rvctPath.toUserOutput()));
return v;
}
if (armcc.exitStatus() != QProcess::NormalExit) {
qWarning("A crash occurred when running rvct binary '%s' trying to determine version.", qPrintable(binary));
qWarning("A crash occurred when running rvct binary '%s' trying to determine version.", qPrintable(rvctPath.toUserOutput()));
return v;
}
QString versionLine = QString::fromLocal8Bit(armcc.readAllStandardOutput());
......@@ -162,7 +161,7 @@ ProjectExplorer::Abi RvctToolChain::targetAbi() const
bool RvctToolChain::isValid() const
{
return !m_compilerPath.isEmpty();
return !m_compilerCommand.isEmpty();
}
QByteArray RvctToolChain::predefinedMacros() const
......@@ -197,11 +196,11 @@ QList<ProjectExplorer::HeaderPath> RvctToolChain::systemHeaderPaths() const
void RvctToolChain::addToEnvironment(Utils::Environment &env) const
{
if (m_compilerPath.isEmpty())
if (m_compilerCommand.isEmpty())
return;
if (m_version.isNull())
setVersion(version(m_compilerPath));
setVersion(version(m_compilerCommand));
if (m_version.isNull())
return;
......@@ -209,11 +208,11 @@ void RvctToolChain::addToEnvironment(Utils::Environment &env) const
env.set(QLatin1String("QT_RVCT_VERSION"), QString::fromLatin1("%1.%2")
.arg(m_version.majorVersion).arg(m_version.minorVersion));
env.set(varName(QLatin1String("BIN")), QDir::toNativeSeparators(QFileInfo(m_compilerPath).absolutePath()));
env.set(varName(QLatin1String("BIN")), m_compilerCommand.toUserOutput());
// Add rvct to path and set locale to 'C'
if (!m_compilerPath.isEmpty())
env.prependOrSetPath(QFileInfo(m_compilerPath).absolutePath());
if (!m_compilerCommand.isEmpty())
env.prependOrSetPath(m_compilerCommand.toString());
env.set(QLatin1String("LANG"), QString(QLatin1Char('C')));
}
......@@ -250,7 +249,7 @@ bool RvctToolChain::operator ==(const ToolChain &other) const
if (!ToolChain::operator ==(other))
return false;
const RvctToolChain *otherPtr = dynamic_cast<const RvctToolChain *>(&other);
return m_compilerPath == otherPtr->m_compilerPath
return m_compilerCommand == otherPtr->m_compilerCommand
&& m_environmentChanges == otherPtr->m_environmentChanges
&& m_armVersion == otherPtr->m_armVersion
&& m_debuggerCommand == otherPtr->m_debuggerCommand;
......@@ -269,19 +268,19 @@ QList<Utils::EnvironmentItem> RvctToolChain::environmentChanges() const
return m_environmentChanges;
}
void RvctToolChain::setCompilerPath(const QString &path)
void RvctToolChain::setCompilerCommand(const Utils::FileName &path)
{
if (m_compilerPath == path)
if (m_compilerCommand == path)
return;
m_compilerPath = path;
m_compilerCommand = path;
m_version.reset();
toolChainUpdated();
}
QString RvctToolChain::compilerPath() const
Utils::FileName RvctToolChain::compilerCommand() const
{
return m_compilerPath;
return m_compilerCommand;
}
void RvctToolChain::setDebuggerCommand(const Utils::FileName &d)
......@@ -332,7 +331,7 @@ ProjectExplorer::ToolChain *RvctToolChain::clone() const
QVariantMap RvctToolChain::toMap() const
{
QVariantMap result = ToolChain::toMap();
result.insert(QLatin1String(rvctPathKeyC), m_compilerPath);
result.insert(QLatin1String(rvctPathKeyC), m_compilerCommand.toString());
QVariantMap tmp;
foreach (const Utils::EnvironmentItem &i, m_environmentChanges)
tmp.insert(i.name, i.value);
......@@ -346,7 +345,7 @@ bool RvctToolChain::fromMap(const QVariantMap &data)
{
if (!ToolChain::fromMap(data))
return false;
m_compilerPath = data.value(QLatin1String(rvctPathKeyC)).toString();
m_compilerCommand = Utils::FileName::fromString(data.value(QLatin1String(rvctPathKeyC)).toString());
m_environmentChanges.clear();
QVariantMap tmp = data.value(QLatin1String(rvctEnvironmentKeyC)).toMap();
......@@ -360,7 +359,7 @@ bool RvctToolChain::fromMap(const QVariantMap &data)
QString RvctToolChain::legacyId() const
{
const QChar dot = QLatin1Char('.');
return QLatin1String(Constants::RVCT_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerPath + dot
return QLatin1String(Constants::RVCT_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerCommand.toString() + dot
+ armVersionString(m_armVersion) + dot + m_debuggerCommand.toString();
}
......@@ -394,7 +393,7 @@ RvctToolChainConfigWidget::RvctToolChainConfigWidget(RvctToolChain *tc) :
connect(m_model, SIGNAL(userChangesChanged()), this, SLOT(emitDirty()));
m_ui->compilerPath->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui->compilerPath->setPath(tc->compilerPath());
m_ui->compilerPath->setFileName(tc->compilerCommand());
connect(m_ui->compilerPath, SIGNAL(changed(QString)), this, SLOT(emitDirty()));
m_ui->versionComboBox->setCurrentIndex(static_cast<int>(tc->armVersion()));
connect(m_ui->versionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(emitDirty()));
......@@ -413,7 +412,7 @@ void RvctToolChainConfigWidget::apply()
Q_ASSERT(tc);
QList<Utils::EnvironmentItem> changes = environmentChanges();
tc->setCompilerPath(m_ui->compilerPath->path());
tc->setCompilerCommand(m_ui->compilerPath->fileName());
tc->setArmVersion(static_cast<RvctToolChain::ArmVersion>(m_ui->versionComboBox->currentIndex()));
tc->setEnvironmentChanges(changes);
tc->setDebuggerCommand(debuggerCommand());
......@@ -428,7 +427,7 @@ void RvctToolChainConfigWidget::setFromToolChain()
m_model->setBaseEnvironment(baseEnvironment(tc));
m_ui->compilerPath->setPath(tc->compilerPath());
m_ui->compilerPath->setFileName(tc->compilerCommand());
m_ui->versionComboBox->setCurrentIndex(static_cast<int>(tc->armVersion()));
setDebuggerCommand(tc->debuggerCommand());
}
......@@ -438,7 +437,7 @@ bool RvctToolChainConfigWidget::isDirty() const
RvctToolChain *tc = static_cast<RvctToolChain *>(toolChain());
Q_ASSERT(tc);
return tc->compilerPath() != m_ui->compilerPath->path()
return tc->compilerCommand() != m_ui->compilerPath->fileName()
|| tc->armVersion() != static_cast<RvctToolChain::ArmVersion>(m_ui->versionComboBox->currentIndex())
|| tc->environmentChanges() != environmentChanges()
|| tc->debuggerCommand() != debuggerCommand();
......@@ -517,11 +516,11 @@ QList<ProjectExplorer::ToolChain *> RvctToolChainFactory::autoDetect()
QList<Utils::EnvironmentItem> changes = i.value();
changes.append(globalItems);
QString binary = QDir::fromNativeSeparators(valueOf(changes, QLatin1String("BIN")));
Utils::FileName binary = Utils::FileName::fromUserInput(valueOf(changes, QLatin1String("BIN")));
if (binary.isEmpty())
continue;
binary = binary + QLatin1Char('/') + QLatin1String(RVCT_BINARY);
QFileInfo fi(binary);
binary.appendPath(QLatin1String(RVCT_BINARY));
QFileInfo fi(binary.toFileInfo());
if (!fi.exists() || !fi.isExecutable())
continue;
......@@ -533,15 +532,16 @@ QList<ProjectExplorer::ToolChain *> RvctToolChainFactory::autoDetect()
const QString name = tr("RVCT (%1 %2.%3 Build %4)");
RvctToolChain *tc = new RvctToolChain(true);
tc->setCompilerPath(binary);
tc->setCompilerCommand(binary);
tc->setEnvironmentChanges(changes);
tc->setDisplayName(name.arg(armVersionString(tc->armVersion()))
.arg(v.majorVersion).arg(v.minorVersion).arg(v.build));
tc->setVersion(v);
tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
result.append(tc);
tc = new RvctToolChain(true);
tc->setCompilerPath(binary);
tc->setCompilerCommand(binary);
tc->setEnvironmentChanges(changes);
tc->setArmVersion(RvctToolChain::ARMv6);
tc->setDisplayName(name.arg(armVersionString(tc->armVersion()))
......
......@@ -77,7 +77,7 @@ public:
int build;
};
static RvctVersion version(const QString &rvctPath);
static RvctVersion version(const Utils::FileName &rvctPath);
enum ArmVersion { ARMv5, ARMv6 };
......@@ -102,11 +102,11 @@ public:
void setEnvironmentChanges(const QList<Utils::EnvironmentItem> &changes);
QList<Utils::EnvironmentItem> environmentChanges() const;
void setCompilerPath(const QString &path);
QString compilerPath() const;
void setCompilerCommand(const Utils::FileName &path);
Utils::FileName compilerCommand() const;
void setDebuggerCommand(const Utils::FileName &d);
virtual Utils::FileName debuggerCommand() const;
Utils::FileName debuggerCommand() const;