forked from qt-creator/qt-creator
Qnx: Use new AspectContainer base in QnxToolChain
Change-Id: I185c69c41e6350993f6e953200224e78575bdb93 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -238,8 +238,8 @@ Toolchains QnxConfiguration::createToolChains(const QnxTarget &target)
|
|||||||
toolChain->setDisplayName(Tr::tr("QCC for %1 (%2)")
|
toolChain->setDisplayName(Tr::tr("QCC for %1 (%2)")
|
||||||
.arg(m_configName)
|
.arg(m_configName)
|
||||||
.arg(target.shortDescription()));
|
.arg(target.shortDescription()));
|
||||||
toolChain->setSdpPath(m_envFile.parentDir());
|
toolChain->sdpPath.setValue(m_envFile.parentDir());
|
||||||
toolChain->setCpuDir(target.cpuDir());
|
toolChain->cpuDir.setValue(target.cpuDir());
|
||||||
toolChain->resetToolChain(m_qccCompiler);
|
toolChain->resetToolChain(m_qccCompiler);
|
||||||
ToolChainManager::registerToolChain(toolChain);
|
ToolChainManager::registerToolChain(toolChain);
|
||||||
|
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include <projectexplorer/abiwidget.h>
|
#include <projectexplorer/abiwidget.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/toolchainconfigwidget.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
@@ -20,9 +22,6 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Qnx::Internal {
|
namespace Qnx::Internal {
|
||||||
|
|
||||||
const char CompilerSdpPath[] = "Qnx.QnxToolChain.NDKPath";
|
|
||||||
const char CpuDirKey[] = "Qnx.QnxToolChain.CpuDir";
|
|
||||||
|
|
||||||
// QnxToolChainConfigWidget
|
// QnxToolChainConfigWidget
|
||||||
|
|
||||||
class QnxToolChainConfigWidget : public ToolChainConfigWidget
|
class QnxToolChainConfigWidget : public ToolChainConfigWidget
|
||||||
@@ -38,10 +37,9 @@ private:
|
|||||||
|
|
||||||
void handleSdpPathChange();
|
void handleSdpPathChange();
|
||||||
|
|
||||||
Utils::PathChooser *m_compilerCommand;
|
PathChooser *m_compilerCommand;
|
||||||
Utils::PathChooser *m_sdpPath;
|
PathChooser *m_sdpPath;
|
||||||
ProjectExplorer::AbiWidget *m_abiWidget;
|
ProjectExplorer::AbiWidget *m_abiWidget;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static Abis detectTargetAbis(const FilePath &sdpPath)
|
static Abis detectTargetAbis(const FilePath &sdpPath)
|
||||||
@@ -104,6 +102,18 @@ QnxToolChain::QnxToolChain()
|
|||||||
{
|
{
|
||||||
setOptionsReinterpreter(&reinterpretOptions);
|
setOptionsReinterpreter(&reinterpretOptions);
|
||||||
setTypeDisplayName(Tr::tr("QCC"));
|
setTypeDisplayName(Tr::tr("QCC"));
|
||||||
|
|
||||||
|
sdpPath.setSettingsKey("Qnx.QnxToolChain.NDKPath");
|
||||||
|
connect(&sdpPath, &BaseAspect::changed, this, &QnxToolChain::toolChainUpdated);
|
||||||
|
|
||||||
|
cpuDir.setSettingsKey("Qnx.QnxToolChain.CpuDir");
|
||||||
|
connect(&cpuDir, &BaseAspect::changed, this, &QnxToolChain::toolChainUpdated);
|
||||||
|
|
||||||
|
connect(this, &AspectContainer::fromMapFinished, this, [this] {
|
||||||
|
// Make the ABIs QNX specific (if they aren't already).
|
||||||
|
setSupportedAbis(QnxUtils::convertAbis(supportedAbis()));
|
||||||
|
setTargetAbi(QnxUtils::convertAbi(targetAbi()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ToolChainConfigWidget> QnxToolChain::createConfigurationWidget()
|
std::unique_ptr<ToolChainConfigWidget> QnxToolChain::createConfigurationWidget()
|
||||||
@@ -116,7 +126,7 @@ void QnxToolChain::addToEnvironment(Environment &env) const
|
|||||||
if (env.expandedValueForKey("QNX_HOST").isEmpty() ||
|
if (env.expandedValueForKey("QNX_HOST").isEmpty() ||
|
||||||
env.expandedValueForKey("QNX_TARGET").isEmpty() ||
|
env.expandedValueForKey("QNX_TARGET").isEmpty() ||
|
||||||
env.expandedValueForKey("QNX_CONFIGURATION_EXCLUSIVE").isEmpty())
|
env.expandedValueForKey("QNX_CONFIGURATION_EXCLUSIVE").isEmpty())
|
||||||
setQnxEnvironment(env, QnxUtils::qnxEnvironment(m_sdpPath));
|
setQnxEnvironment(env, QnxUtils::qnxEnvironment(sdpPath()));
|
||||||
|
|
||||||
GccToolChain::addToEnvironment(env);
|
GccToolChain::addToEnvironment(env);
|
||||||
}
|
}
|
||||||
@@ -131,54 +141,6 @@ QStringList QnxToolChain::suggestedMkspecList() const
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxToolChain::toMap(QVariantMap &data) const
|
|
||||||
{
|
|
||||||
GccToolChain::toMap(data);
|
|
||||||
data.insert(QLatin1String(CompilerSdpPath), m_sdpPath.toSettings());
|
|
||||||
data.insert(QLatin1String(CpuDirKey), m_cpuDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QnxToolChain::fromMap(const QVariantMap &data)
|
|
||||||
{
|
|
||||||
if (!GccToolChain::fromMap(data))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_sdpPath = FilePath::fromSettings(data.value(CompilerSdpPath));
|
|
||||||
m_cpuDir = data.value(QLatin1String(CpuDirKey)).toString();
|
|
||||||
|
|
||||||
// Make the ABIs QNX specific (if they aren't already).
|
|
||||||
setSupportedAbis(QnxUtils::convertAbis(supportedAbis()));
|
|
||||||
setTargetAbi(QnxUtils::convertAbi(targetAbi()));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePath QnxToolChain::sdpPath() const
|
|
||||||
{
|
|
||||||
return m_sdpPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QnxToolChain::setSdpPath(const FilePath &sdpPath)
|
|
||||||
{
|
|
||||||
if (m_sdpPath == sdpPath)
|
|
||||||
return;
|
|
||||||
m_sdpPath = sdpPath;
|
|
||||||
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
|
||||||
{
|
{
|
||||||
// "unknown-qnx-gnu"is needed to get the "--target=xxx" parameter sent code model,
|
// "unknown-qnx-gnu"is needed to get the "--target=xxx" parameter sent code model,
|
||||||
@@ -187,7 +149,7 @@ GccToolChain::DetectedAbisResult QnxToolChain::detectSupportedAbis() const
|
|||||||
//
|
//
|
||||||
// Without it on Windows Clang defaults to a MSVC mode, which breaks with
|
// Without it on Windows Clang defaults to a MSVC mode, which breaks with
|
||||||
// the QNX code, which is mostly GNU based.
|
// the QNX code, which is mostly GNU based.
|
||||||
return GccToolChain::DetectedAbisResult{detectTargetAbis(m_sdpPath), "unknown-qnx-gnu"};
|
return GccToolChain::DetectedAbisResult{detectTargetAbis(sdpPath()), "unknown-qnx-gnu"};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QnxToolChain::operator ==(const ToolChain &other) const
|
bool QnxToolChain::operator ==(const ToolChain &other) const
|
||||||
@@ -197,7 +159,7 @@ bool QnxToolChain::operator ==(const ToolChain &other) const
|
|||||||
|
|
||||||
auto qnxTc = static_cast<const QnxToolChain *>(&other);
|
auto qnxTc = static_cast<const QnxToolChain *>(&other);
|
||||||
|
|
||||||
return m_sdpPath == qnxTc->m_sdpPath && m_cpuDir == qnxTc->m_cpuDir;
|
return sdpPath() == qnxTc->sdpPath() && cpuDir() == qnxTc->cpuDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -268,7 +230,7 @@ void QnxToolChainConfigWidget::applyImpl()
|
|||||||
Q_ASSERT(tc);
|
Q_ASSERT(tc);
|
||||||
QString displayName = tc->displayName();
|
QString displayName = tc->displayName();
|
||||||
tc->setDisplayName(displayName); // reset display name
|
tc->setDisplayName(displayName); // reset display name
|
||||||
tc->setSdpPath(m_sdpPath->filePath());
|
tc->sdpPath.setValue(m_sdpPath->filePath());
|
||||||
tc->setTargetAbi(m_abiWidget->currentAbi());
|
tc->setTargetAbi(m_abiWidget->currentAbi());
|
||||||
tc->resetToolChain(m_compilerCommand->filePath());
|
tc->resetToolChain(m_compilerCommand->filePath());
|
||||||
}
|
}
|
||||||
|
@@ -4,10 +4,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/gcctoolchain.h>
|
#include <projectexplorer/gcctoolchain.h>
|
||||||
#include <projectexplorer/toolchainconfigwidget.h>
|
|
||||||
|
|
||||||
namespace ProjectExplorer { class AbiWidget; }
|
|
||||||
namespace Utils { class PathChooser; }
|
|
||||||
|
|
||||||
namespace Qnx::Internal {
|
namespace Qnx::Internal {
|
||||||
|
|
||||||
@@ -21,22 +17,13 @@ public:
|
|||||||
void addToEnvironment(Utils::Environment &env) const override;
|
void addToEnvironment(Utils::Environment &env) const override;
|
||||||
QStringList suggestedMkspecList() const override;
|
QStringList suggestedMkspecList() const override;
|
||||||
|
|
||||||
void toMap(QVariantMap &data) const override;
|
Utils::FilePathAspect sdpPath{this};
|
||||||
bool fromMap(const QVariantMap &data) override;
|
Utils::StringAspect cpuDir{this};
|
||||||
|
|
||||||
Utils::FilePath sdpPath() const;
|
|
||||||
void setSdpPath(const Utils::FilePath &sdpPath);
|
|
||||||
QString cpuDir() const;
|
|
||||||
void setCpuDir(const QString &cpuDir);
|
|
||||||
|
|
||||||
bool operator ==(const ToolChain &) const override;
|
bool operator ==(const ToolChain &) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DetectedAbisResult detectSupportedAbis() const override;
|
DetectedAbisResult detectSupportedAbis() const override;
|
||||||
|
|
||||||
private:
|
|
||||||
Utils::FilePath m_sdpPath;
|
|
||||||
QString m_cpuDir;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user