forked from qt-creator/qt-creator
Maemo: Fix misdetection of maemo tool chains
Task-number: QTCREATORBUG-6876 Change-Id: I6410a9894c2482d2b6ea7f2fba9b67f7fdb4fff6 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -61,12 +61,15 @@ static const char *const MAEMO_QT_VERSION_KEY = "Qt4ProjectManager.Maemo.QtVersi
|
||||
MaemoToolChain::MaemoToolChain(bool autodetected) :
|
||||
ProjectExplorer::GccToolChain(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID), autodetected),
|
||||
m_qtVersionId(-1)
|
||||
{ }
|
||||
{
|
||||
setQtVersionId(-1);
|
||||
}
|
||||
|
||||
MaemoToolChain::MaemoToolChain(const MaemoToolChain &tc) :
|
||||
ProjectExplorer::GccToolChain(tc),
|
||||
m_qtVersionId(tc.m_qtVersionId)
|
||||
{ }
|
||||
ProjectExplorer::GccToolChain(tc)
|
||||
{
|
||||
setQtVersionId(tc.m_qtVersionId);
|
||||
}
|
||||
|
||||
MaemoToolChain::~MaemoToolChain()
|
||||
{ }
|
||||
@@ -169,6 +172,19 @@ QString MaemoToolChain::legacyId() const
|
||||
.arg(debuggerCommand().toString());
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Abi> MaemoToolChain::findAbiForCompilerPath(const QString &path)
|
||||
{
|
||||
Q_UNUSED(path);
|
||||
if (m_qtVersionId < 0)
|
||||
return QList<ProjectExplorer::Abi>();
|
||||
|
||||
MaemoQtVersion *mqv = dynamic_cast<MaemoQtVersion *>(QtSupport::QtVersionManager::instance()->version(m_qtVersionId));
|
||||
if (!mqv)
|
||||
return QList<ProjectExplorer::Abi>();
|
||||
|
||||
return mqv->qtAbis();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// MaemoToolChainConfigWidget
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -280,7 +296,7 @@ QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::createToolChainList(c
|
||||
tcm->deregisterToolChain(tc);
|
||||
|
||||
const MaemoQtVersion * const mqv = dynamic_cast<MaemoQtVersion *>(v);
|
||||
if (!mqv || !mqv->isValid())
|
||||
if (!mqv || !mqv->isValid() || mqv->qtAbis().isEmpty())
|
||||
continue;
|
||||
|
||||
// (Re-)add toolchain:
|
||||
|
@@ -68,6 +68,9 @@ public:
|
||||
|
||||
QString legacyId() const;
|
||||
|
||||
protected:
|
||||
QList<ProjectExplorer::Abi> findAbiForCompilerPath(const QString &path);
|
||||
|
||||
private:
|
||||
explicit MaemoToolChain(bool);
|
||||
MaemoToolChain(const MaemoToolChain &);
|
||||
|
@@ -292,12 +292,14 @@ GccToolChain::GccToolChain(const QString &id, bool autodetect) :
|
||||
|
||||
GccToolChain::GccToolChain(const GccToolChain &tc) :
|
||||
ToolChain(tc),
|
||||
m_predefinedMacros(tc.predefinedMacros()),
|
||||
m_compilerPath(tc.compilerPath()),
|
||||
m_debuggerCommand(tc.debuggerCommand()),
|
||||
m_targetAbi(tc.m_targetAbi)
|
||||
{
|
||||
setCompilerPath(tc.m_compilerPath);
|
||||
}
|
||||
m_targetAbi(tc.m_targetAbi),
|
||||
m_supportedAbis(tc.m_supportedAbis),
|
||||
m_headerPathes(tc.m_headerPathes),
|
||||
m_version(tc.m_version)
|
||||
{ }
|
||||
|
||||
QString GccToolChain::defaultDisplayName() const
|
||||
{
|
||||
@@ -308,6 +310,14 @@ QString GccToolChain::defaultDisplayName() const
|
||||
ProjectExplorer::Abi::toString(m_targetAbi.wordWidth()));
|
||||
}
|
||||
|
||||
QList<Abi> GccToolChain::findAbiForCompilerPath(const QString &path)
|
||||
{
|
||||
if (path.isEmpty())
|
||||
return QList<Abi>();
|
||||
|
||||
return detectSupportedAbis();
|
||||
}
|
||||
|
||||
QString GccToolChain::legacyId() const
|
||||
{
|
||||
QString i = id();
|
||||
@@ -339,14 +349,12 @@ void GccToolChain::setTargetAbi(const Abi &abi)
|
||||
if (abi == m_targetAbi)
|
||||
return;
|
||||
|
||||
updateSupportedAbis();
|
||||
m_targetAbi = abi;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QList<Abi> GccToolChain::supportedAbis() const
|
||||
{
|
||||
updateSupportedAbis();
|
||||
return m_supportedAbis;
|
||||
}
|
||||
|
||||
@@ -450,24 +458,22 @@ void GccToolChain::setCompilerPath(const QString &path)
|
||||
bool resetDisplayName = displayName() == defaultDisplayName();
|
||||
|
||||
m_compilerPath = path;
|
||||
m_supportedAbis.clear();
|
||||
|
||||
Abi currentAbi = m_targetAbi;
|
||||
m_supportedAbis = findAbiForCompilerPath(m_compilerPath);
|
||||
|
||||
m_targetAbi = Abi();
|
||||
if (!m_compilerPath.isEmpty()) {
|
||||
updateSupportedAbis();
|
||||
if (!m_supportedAbis.isEmpty()) {
|
||||
if (m_supportedAbis.contains(currentAbi))
|
||||
m_targetAbi = currentAbi;
|
||||
else
|
||||
m_targetAbi = m_supportedAbis.at(0);
|
||||
}
|
||||
|
||||
if (resetDisplayName)
|
||||
setDisplayName(defaultDisplayName());
|
||||
if (!m_supportedAbis.isEmpty()) {
|
||||
if (m_supportedAbis.contains(currentAbi))
|
||||
m_targetAbi = currentAbi;
|
||||
else
|
||||
m_targetAbi = m_supportedAbis.at(0);
|
||||
}
|
||||
toolChainUpdated();
|
||||
|
||||
if (resetDisplayName)
|
||||
setDisplayName(defaultDisplayName()); // calls toolChainUpdated()!
|
||||
else
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QString GccToolChain::compilerPath() const
|
||||
|
@@ -80,7 +80,7 @@ public:
|
||||
|
||||
bool operator ==(const ToolChain &) const;
|
||||
|
||||
virtual void setCompilerPath(const QString &);
|
||||
void setCompilerPath(const QString &);
|
||||
QString compilerPath() const;
|
||||
|
||||
ToolChain *clone() const;
|
||||
@@ -89,7 +89,8 @@ protected:
|
||||
GccToolChain(const QString &id, bool autodetect);
|
||||
GccToolChain(const GccToolChain &);
|
||||
|
||||
QString defaultDisplayName() const;
|
||||
virtual QString defaultDisplayName() const;
|
||||
virtual QList<Abi> findAbiForCompilerPath(const QString &path);
|
||||
|
||||
virtual QList<Abi> detectSupportedAbis() const;
|
||||
virtual QString detectVersion() const;
|
||||
|
Reference in New Issue
Block a user