Propagate cpuDir into QnxToolChain

Add sdpPath and cpuDir comparison to QNX tool chain comparison.
Ensures that QnxConfiguration created tool chains don't get
removed just because they have the same ABI as another QNX
configuration created tool chain.

This should really be visible in the interface but that can be
done later since this isn't something that can currently happen
with official 6.6.0/7.0.0 SDPs.

Change-Id: Ibbb6a8aa645721028d1512460e51e59633b3cedc
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
James McDonnell
2017-03-29 17:32:11 -04:00
parent 848b8c0f44
commit e8b02713b1
3 changed files with 32 additions and 0 deletions

View File

@@ -276,6 +276,7 @@ QnxToolChain *QnxConfiguration::createToolChain(const Target &target)
.arg(displayName()) .arg(displayName())
.arg(target.shortDescription())); .arg(target.shortDescription()));
toolChain->setSdpPath(sdpPath().toString()); toolChain->setSdpPath(sdpPath().toString());
toolChain->setCpuDir(target.cpuDir());
toolChain->resetToolChain(qccCompilerPath()); toolChain->resetToolChain(qccCompilerPath());
ToolChainManager::registerToolChain(toolChain); ToolChainManager::registerToolChain(toolChain);
return toolChain; return toolChain;

View File

@@ -42,6 +42,7 @@ namespace Qnx {
namespace Internal { namespace Internal {
static const char CompilerSdpPath[] = "Qnx.QnxToolChain.NDKPath"; static const char CompilerSdpPath[] = "Qnx.QnxToolChain.NDKPath";
static const char CpuDirKey[] = "Qnx.QnxToolChain.CpuDir";
static QList<Abi> detectTargetAbis(const FileName &sdpPath) static QList<Abi> detectTargetAbis(const FileName &sdpPath)
{ {
@@ -146,6 +147,7 @@ QVariantMap QnxToolChain::toMap() const
{ {
QVariantMap data = GccToolChain::toMap(); QVariantMap data = GccToolChain::toMap();
data.insert(QLatin1String(CompilerSdpPath), m_sdpPath); data.insert(QLatin1String(CompilerSdpPath), m_sdpPath);
data.insert(QLatin1String(CpuDirKey), m_cpuDir);
return data; return data;
} }
@@ -155,6 +157,7 @@ bool QnxToolChain::fromMap(const QVariantMap &data)
return false; return false;
m_sdpPath = data.value(QLatin1String(CompilerSdpPath)).toString(); m_sdpPath = data.value(QLatin1String(CompilerSdpPath)).toString();
m_cpuDir = data.value(QLatin1String(CpuDirKey)).toString();
// Make the ABIs QNX specific (if they aren't already). // Make the ABIs QNX specific (if they aren't already).
setSupportedAbis(QnxUtils::convertAbis(supportedAbis())); setSupportedAbis(QnxUtils::convertAbis(supportedAbis()));
@@ -176,11 +179,34 @@ void QnxToolChain::setSdpPath(const QString &sdpPath)
toolChainUpdated(); toolChainUpdated();
} }
QString QnxToolChain::cpuDir() const
{
return m_cpuDir;
}
void QnxToolChain::setCpuDir(const QString &cpuDir)
{
if (m_cpuDir == cpuDir)
return;
m_cpuDir = cpuDir;
toolChainUpdated();
}
GccToolChain::DetectedAbisResult QnxToolChain::detectSupportedAbis() const GccToolChain::DetectedAbisResult QnxToolChain::detectSupportedAbis() const
{ {
return detectTargetAbis(FileName::fromString(m_sdpPath)); return detectTargetAbis(FileName::fromString(m_sdpPath));
} }
bool QnxToolChain::operator ==(const ToolChain &other) const
{
if (!GccToolChain::operator ==(other))
return false;
auto qnxTc = static_cast<const QnxToolChain *>(&other);
return m_sdpPath == qnxTc->m_sdpPath && m_cpuDir == qnxTc->m_cpuDir;
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// QnxToolChainFactory // QnxToolChainFactory
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -49,12 +49,17 @@ public:
QString sdpPath() const; QString sdpPath() const;
void setSdpPath(const QString &sdpPath); void setSdpPath(const QString &sdpPath);
QString cpuDir() const;
void setCpuDir(const QString &cpuDir);
bool operator ==(const ToolChain &) const override;
protected: protected:
virtual DetectedAbisResult detectSupportedAbis() const override; virtual DetectedAbisResult detectSupportedAbis() const override;
private: private:
QString m_sdpPath; QString m_sdpPath;
QString m_cpuDir;
}; };
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------