forked from qt-creator/qt-creator
Add support for 64-bit QNX platforms
Change the code so that it detects a lot things that were previously hard-coded. Replace QnxArchitecture with Abi. There doesn't appear to be a good reason to have a separate type. The removal of Arch from qtversion.xml breaks backward compatibility. Change-Id: Ic4f3a2de64f3f875841b73e9b12bbe0ea454eee8 Reviewed-by: Dan Cape <dcape@qnx.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -50,6 +50,7 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
@@ -107,16 +108,6 @@ FileName QnxConfiguration::qccCompilerPath() const
|
|||||||
return m_qccCompiler;
|
return m_qccCompiler;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName QnxConfiguration::armDebuggerPath() const
|
|
||||||
{
|
|
||||||
return m_armlev7Debugger;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileName QnxConfiguration::x86DebuggerPath() const
|
|
||||||
{
|
|
||||||
return m_x86Debugger;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<EnvironmentItem> QnxConfiguration::qnxEnv() const
|
QList<EnvironmentItem> QnxConfiguration::qnxEnv() const
|
||||||
{
|
{
|
||||||
return m_qnxEnv;
|
return m_qnxEnv;
|
||||||
@@ -137,9 +128,7 @@ QVariantMap QnxConfiguration::toMap() const
|
|||||||
|
|
||||||
bool QnxConfiguration::isValid() const
|
bool QnxConfiguration::isValid() const
|
||||||
{
|
{
|
||||||
return !m_qccCompiler.isEmpty()
|
return !m_qccCompiler.isEmpty() && !m_targets.isEmpty();
|
||||||
&& !m_armlev7Debugger.isEmpty()
|
|
||||||
&& !m_x86Debugger.isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QnxConfiguration::displayName() const
|
QString QnxConfiguration::displayName() const
|
||||||
@@ -166,32 +155,8 @@ bool QnxConfiguration::activate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and register toolchain
|
foreach (const Target &target, m_targets)
|
||||||
QnxToolChain *armTc = createToolChain(ArmLeV7,
|
createTools(target);
|
||||||
QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
|
||||||
"QCC for %1 (armv7)").arg(displayName()),
|
|
||||||
sdpPath().toString());
|
|
||||||
QnxToolChain *x86Tc = createToolChain(X86,
|
|
||||||
QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
|
||||||
"QCC for %1 (x86)").arg(displayName()),
|
|
||||||
sdpPath().toString());
|
|
||||||
|
|
||||||
// Create and register debuggers
|
|
||||||
QVariant armDebuggerId = createDebuggerItem(ArmLeV7,
|
|
||||||
QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
|
||||||
"Debugger for %1 (armv7)").arg(displayName()));
|
|
||||||
|
|
||||||
QVariant x86DebuggerId = createDebuggerItem(X86,
|
|
||||||
QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
|
||||||
"Debugger for %1 (x86)").arg(displayName()));
|
|
||||||
|
|
||||||
// Create and register kits
|
|
||||||
createKit(ArmLeV7, armTc, armDebuggerId,
|
|
||||||
QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
|
||||||
"Kit for %1 (armv7)").arg(displayName()));
|
|
||||||
createKit(X86, x86Tc, x86DebuggerId,
|
|
||||||
QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
|
||||||
"Kit for %1 (x86)").arg(displayName()));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -207,8 +172,7 @@ void QnxConfiguration::deactivate()
|
|||||||
|
|
||||||
foreach (DebuggerItem debuggerItem,
|
foreach (DebuggerItem debuggerItem,
|
||||||
DebuggerItemManager::debuggers()) {
|
DebuggerItemManager::debuggers()) {
|
||||||
if (debuggerItem.command() == armDebuggerPath() ||
|
if (findTargetByDebuggerPath(debuggerItem.command()))
|
||||||
debuggerItem.command() == x86DebuggerPath())
|
|
||||||
debuggersToRemove.append(debuggerItem);
|
debuggersToRemove.append(debuggerItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +195,7 @@ bool QnxConfiguration::isActive() const
|
|||||||
const bool hasToolChain = ToolChainManager::toolChain(Utils::equal(&ToolChain::compilerCommand,
|
const bool hasToolChain = ToolChainManager::toolChain(Utils::equal(&ToolChain::compilerCommand,
|
||||||
qccCompilerPath()));
|
qccCompilerPath()));
|
||||||
const bool hasDebugger = Utils::contains(DebuggerItemManager::debuggers(), [this](const DebuggerItem &di) {
|
const bool hasDebugger = Utils::contains(DebuggerItemManager::debuggers(), [this](const DebuggerItem &di) {
|
||||||
return di.command() == armDebuggerPath() || di.command() == x86DebuggerPath();
|
return findTargetByDebuggerPath(di.command());
|
||||||
});
|
});
|
||||||
|
|
||||||
return hasToolChain && hasDebugger;
|
return hasToolChain && hasDebugger;
|
||||||
@@ -239,7 +203,11 @@ bool QnxConfiguration::isActive() const
|
|||||||
|
|
||||||
bool QnxConfiguration::canCreateKits() const
|
bool QnxConfiguration::canCreateKits() const
|
||||||
{
|
{
|
||||||
return isValid() && (qnxQtVersion(ArmLeV7) || qnxQtVersion(X86));
|
if (!isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return Utils::anyOf(m_targets,
|
||||||
|
[this](const Target &target) -> bool { return qnxQtVersion(target); });
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName QnxConfiguration::sdpPath() const
|
FileName QnxConfiguration::sdpPath() const
|
||||||
@@ -247,15 +215,17 @@ FileName QnxConfiguration::sdpPath() const
|
|||||||
return envFile().parentDir();
|
return envFile().parentDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxQtVersion* QnxConfiguration::qnxQtVersion(QnxArchitecture arch) const
|
QnxQtVersion *QnxConfiguration::qnxQtVersion(const Target &target) const
|
||||||
{
|
{
|
||||||
QnxQtVersion *qnxQt;
|
|
||||||
foreach (BaseQtVersion *version,
|
foreach (BaseQtVersion *version,
|
||||||
QtVersionManager::instance()->versions(Utils::equal(&BaseQtVersion::type,
|
QtVersionManager::instance()->versions(Utils::equal(&BaseQtVersion::type,
|
||||||
QString::fromLatin1(Constants::QNX_QNX_QT)))) {
|
QString::fromLatin1(Constants::QNX_QNX_QT)))) {
|
||||||
qnxQt = dynamic_cast<QnxQtVersion*>(version);
|
QnxQtVersion *qnxQt = dynamic_cast<QnxQtVersion *>(version);
|
||||||
if (qnxQt && qnxQt->architecture() == arch) {
|
if (qnxQt && FileName::fromString(qnxQt->sdkPath()) == sdpPath()) {
|
||||||
return qnxQt;
|
foreach (const Abi &qtAbi, version->qtAbis()) {
|
||||||
|
if ((qtAbi == target.m_abi) && (qnxQt->cpuDir() == target.cpuDir()))
|
||||||
|
return qnxQt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,44 +236,54 @@ QList<ToolChain *> QnxConfiguration::autoDetect(const QList<ToolChain *> &alread
|
|||||||
{
|
{
|
||||||
QList<ToolChain *> result;
|
QList<ToolChain *> result;
|
||||||
|
|
||||||
result += findToolChain(alreadyKnown, ArmLeV7);
|
foreach (const Target &target, m_targets)
|
||||||
result += findToolChain(alreadyKnown, X86);
|
result += findToolChain(alreadyKnown, target.m_abi);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QnxConfiguration::createDebuggerItem(QnxArchitecture arch, const QString &displayName)
|
void QnxConfiguration::createTools(const Target &target)
|
||||||
|
{
|
||||||
|
QnxToolChain *tc = createToolChain(target);
|
||||||
|
QVariant debuggerId = createDebugger(target);
|
||||||
|
createKit(target, tc, debuggerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant QnxConfiguration::createDebugger(const Target &target)
|
||||||
{
|
{
|
||||||
FileName command = (arch == X86) ? x86DebuggerPath() : armDebuggerPath();
|
|
||||||
Debugger::DebuggerItem debugger;
|
Debugger::DebuggerItem debugger;
|
||||||
debugger.setCommand(command);
|
debugger.setCommand(target.m_debuggerPath);
|
||||||
debugger.setEngineType(Debugger::GdbEngineType);
|
debugger.reinitializeFromFile();
|
||||||
debugger.setAbi(Abi(arch == Qnx::ArmLeV7 ? Abi::ArmArchitecture : Abi::X86Architecture,
|
|
||||||
Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 32));
|
|
||||||
debugger.setAutoDetected(true);
|
debugger.setAutoDetected(true);
|
||||||
debugger.setUnexpandedDisplayName(displayName);
|
debugger.setUnexpandedDisplayName(
|
||||||
|
QCoreApplication::translate(
|
||||||
|
"Qnx::Internal::QnxConfiguration",
|
||||||
|
"Debugger for %1 (%2)")
|
||||||
|
.arg(displayName())
|
||||||
|
.arg(target.shortDescription()));
|
||||||
return Debugger::DebuggerItemManager::registerDebugger(debugger);
|
return Debugger::DebuggerItemManager::registerDebugger(debugger);
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxToolChain *QnxConfiguration::createToolChain(QnxArchitecture arch, const QString &displayName,
|
QnxToolChain *QnxConfiguration::createToolChain(const Target &target)
|
||||||
const QString &ndkPath)
|
|
||||||
{
|
{
|
||||||
QnxToolChain *toolChain = new QnxToolChain(ToolChain::AutoDetection);
|
QnxToolChain *toolChain = new QnxToolChain(ToolChain::AutoDetection);
|
||||||
toolChain->resetToolChain(m_qccCompiler);
|
toolChain->resetToolChain(qccCompilerPath());
|
||||||
toolChain->setLanguage(ToolChain::Language::Cxx);
|
toolChain->setLanguage(ToolChain::Language::Cxx);
|
||||||
toolChain->setTargetAbi(Abi((arch == Qnx::ArmLeV7) ? Abi::ArmArchitecture : Abi::X86Architecture,
|
toolChain->setTargetAbi(target.m_abi);
|
||||||
Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 32));
|
toolChain->setDisplayName(
|
||||||
toolChain->setDisplayName(displayName);
|
QCoreApplication::translate(
|
||||||
toolChain->setNdkPath(ndkPath);
|
"Qnx::Internal::QnxConfiguration",
|
||||||
|
"QCC for %1 (%2)")
|
||||||
|
.arg(displayName())
|
||||||
|
.arg(target.shortDescription()));
|
||||||
|
toolChain->setNdkPath(sdpPath().toString());
|
||||||
ToolChainManager::registerToolChain(toolChain);
|
ToolChainManager::registerToolChain(toolChain);
|
||||||
return toolChain;
|
return toolChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ToolChain *> QnxConfiguration::findToolChain(const QList<ToolChain *> &alreadyKnown,
|
QList<ToolChain *> QnxConfiguration::findToolChain(const QList<ToolChain *> &alreadyKnown,
|
||||||
QnxArchitecture arch)
|
const Abi &abi)
|
||||||
{
|
{
|
||||||
Abi abi((arch == Qnx::ArmLeV7) ? Abi::ArmArchitecture : Abi::X86Architecture,
|
|
||||||
Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 32);
|
|
||||||
return Utils::filtered(alreadyKnown, [this, abi](ToolChain *tc) {
|
return Utils::filtered(alreadyKnown, [this, abi](ToolChain *tc) {
|
||||||
return tc->typeId() == Constants::QNX_TOOLCHAIN_ID
|
return tc->typeId() == Constants::QNX_TOOLCHAIN_ID
|
||||||
&& tc->targetAbi() == abi
|
&& tc->targetAbi() == abi
|
||||||
@@ -311,12 +291,12 @@ QList<ToolChain *> QnxConfiguration::findToolChain(const QList<ToolChain *> &alr
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Kit *QnxConfiguration::createKit(QnxArchitecture arch,
|
ProjectExplorer::Kit *QnxConfiguration::createKit(
|
||||||
QnxToolChain *toolChain,
|
const Target &target,
|
||||||
const QVariant &debuggerItemId,
|
QnxToolChain *toolChain,
|
||||||
const QString &displayName)
|
const QVariant &debugger)
|
||||||
{
|
{
|
||||||
QnxQtVersion *qnxQt = qnxQtVersion(arch);
|
QnxQtVersion *qnxQt = qnxQtVersion(target);
|
||||||
// Do not create incomplete kits if no qt qnx version found
|
// Do not create incomplete kits if no qt qnx version found
|
||||||
if (!qnxQt)
|
if (!qnxQt)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -327,26 +307,18 @@ Kit *QnxConfiguration::createKit(QnxArchitecture arch,
|
|||||||
ToolChainKitInformation::setToolChain(kit, toolChain);
|
ToolChainKitInformation::setToolChain(kit, toolChain);
|
||||||
ToolChainKitInformation::clearToolChain(kit, ToolChain::Language::C);
|
ToolChainKitInformation::clearToolChain(kit, ToolChain::Language::C);
|
||||||
|
|
||||||
if (debuggerItemId.isValid())
|
if (debugger.isValid())
|
||||||
DebuggerKitInformation::setDebugger(kit, debuggerItemId);
|
DebuggerKitInformation::setDebugger(kit, debugger);
|
||||||
|
|
||||||
if (arch == X86) {
|
|
||||||
QmakeProjectManager::QmakeKitInformation::setMkspec(
|
|
||||||
kit, FileName::fromLatin1("qnx-x86-qcc"));
|
|
||||||
} else {
|
|
||||||
if (qnxQt->qtVersion() >= QtVersionNumber(5, 3, 0)) {
|
|
||||||
QmakeProjectManager::QmakeKitInformation::setMkspec(
|
|
||||||
kit, FileName::fromLatin1("qnx-armle-v7-qcc"));
|
|
||||||
} else {
|
|
||||||
QmakeProjectManager::QmakeKitInformation::setMkspec(
|
|
||||||
kit, FileName::fromLatin1("qnx-armv7le-qcc"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_QNX_OS_TYPE);
|
DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_QNX_OS_TYPE);
|
||||||
// TODO: Add sysroot?
|
// TODO: Add sysroot?
|
||||||
|
|
||||||
kit->setUnexpandedDisplayName(displayName);
|
kit->setUnexpandedDisplayName(
|
||||||
|
QCoreApplication::translate(
|
||||||
|
"Qnx::Internal::QnxConfiguration",
|
||||||
|
"Kit for %1 (%2)")
|
||||||
|
.arg(displayName())
|
||||||
|
.arg(target.shortDescription()));
|
||||||
kit->setIconPath(FileName::fromString(QLatin1String(Constants::QNX_CATEGORY_ICON)));
|
kit->setIconPath(FileName::fromString(QLatin1String(Constants::QNX_CATEGORY_ICON)));
|
||||||
|
|
||||||
kit->setAutoDetected(true);
|
kit->setAutoDetected(true);
|
||||||
@@ -371,13 +343,9 @@ QStringList QnxConfiguration::validationErrors() const
|
|||||||
errorStrings << QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
errorStrings << QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
||||||
"- No GCC compiler found.");
|
"- No GCC compiler found.");
|
||||||
|
|
||||||
if (m_armlev7Debugger.isEmpty())
|
if (m_targets.isEmpty())
|
||||||
errorStrings << QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
errorStrings << QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
||||||
"- No GDB debugger found for armvle7.");
|
"- No targets found.");
|
||||||
|
|
||||||
if (m_x86Debugger.isEmpty())
|
|
||||||
errorStrings << QCoreApplication::translate("Qnx::Internal::QnxConfiguration",
|
|
||||||
"- No GDB debugger found for x86.");
|
|
||||||
|
|
||||||
return errorStrings;
|
return errorStrings;
|
||||||
}
|
}
|
||||||
@@ -389,16 +357,19 @@ void QnxConfiguration::setVersion(const QnxVersionNumber &version)
|
|||||||
|
|
||||||
void QnxConfiguration::readInformation()
|
void QnxConfiguration::readInformation()
|
||||||
{
|
{
|
||||||
QString qConfigPath = sdpPath().toString() + QLatin1String("/.qnx/qconfig");
|
QString qConfigPath = FileName(m_qnxConfiguration).appendPath("qconfig").toString();
|
||||||
QList <ConfigInstallInformation> installInfoList = QnxUtils::installedConfigs(qConfigPath);
|
QList <ConfigInstallInformation> installInfoList = QnxUtils::installedConfigs(qConfigPath);
|
||||||
if (installInfoList.isEmpty())
|
if (installInfoList.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: For now (6.6) it should be one installation file. The code need to handle cases
|
foreach (const ConfigInstallInformation &info, installInfoList) {
|
||||||
// where the SDP support many target/host installations (i.e many installation files).
|
if (m_qnxHost == FileName::fromString(info.host)
|
||||||
const ConfigInstallInformation installInfo = installInfoList.first();
|
&& m_qnxTarget == FileName::fromString(info.target)) {
|
||||||
m_configName = installInfo.name;
|
m_configName = info.name;
|
||||||
setVersion(QnxVersionNumber(installInfo.version));
|
setVersion(QnxVersionNumber(info.version));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxConfiguration::setDefaultConfiguration(const Utils::FileName &envScript)
|
void QnxConfiguration::setDefaultConfiguration(const Utils::FileName &envScript)
|
||||||
@@ -407,33 +378,105 @@ void QnxConfiguration::setDefaultConfiguration(const Utils::FileName &envScript)
|
|||||||
m_envFile = envScript;
|
m_envFile = envScript;
|
||||||
m_qnxEnv = QnxUtils::qnxEnvironmentFromEnvFile(m_envFile.toString());
|
m_qnxEnv = QnxUtils::qnxEnvironmentFromEnvFile(m_envFile.toString());
|
||||||
foreach (const EnvironmentItem &item, m_qnxEnv) {
|
foreach (const EnvironmentItem &item, m_qnxEnv) {
|
||||||
if (item.name == QLatin1String("QNX_TARGET"))
|
if (item.name == QLatin1String("QNX_CONFIGURATION"))
|
||||||
|
m_qnxConfiguration = FileName::fromString(item.value);
|
||||||
|
else if (item.name == QLatin1String("QNX_TARGET"))
|
||||||
m_qnxTarget = FileName::fromString(item.value);
|
m_qnxTarget = FileName::fromString(item.value);
|
||||||
|
|
||||||
else if (item.name == QLatin1String("QNX_HOST"))
|
else if (item.name == QLatin1String("QNX_HOST"))
|
||||||
m_qnxHost = FileName::fromString(item.value);
|
m_qnxHost = FileName::fromString(item.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName qccPath = FileName::fromString(HostOsInfo::withExecutableSuffix(
|
FileName qccPath = FileName::fromString(HostOsInfo::withExecutableSuffix(
|
||||||
m_qnxHost.toString() + QLatin1String("/usr/bin/qcc")));
|
m_qnxHost.toString() + QLatin1String("/usr/bin/qcc")));
|
||||||
FileName armlev7GdbPath = FileName::fromString(HostOsInfo::withExecutableSuffix(
|
|
||||||
m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarm-gdb")));
|
|
||||||
if (!armlev7GdbPath.exists()) {
|
|
||||||
armlev7GdbPath = FileName::fromString(HostOsInfo::withExecutableSuffix(
|
|
||||||
m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarmv7-gdb")));
|
|
||||||
}
|
|
||||||
|
|
||||||
FileName x86GdbPath = FileName::fromString(HostOsInfo::withExecutableSuffix(
|
|
||||||
m_qnxHost.toString() + QLatin1String("/usr/bin/ntox86-gdb")));
|
|
||||||
|
|
||||||
if (qccPath.exists())
|
if (qccPath.exists())
|
||||||
m_qccCompiler = qccPath;
|
m_qccCompiler = qccPath;
|
||||||
|
|
||||||
if (armlev7GdbPath.exists())
|
updateTargets();
|
||||||
m_armlev7Debugger = armlev7GdbPath;
|
assignDebuggersToTargets();
|
||||||
|
|
||||||
if (x86GdbPath.exists())
|
// Remove debuggerless targets.
|
||||||
m_x86Debugger = x86GdbPath;
|
Utils::erase(m_targets, [](const Target &target) {
|
||||||
|
if (target.m_debuggerPath.isEmpty())
|
||||||
|
qWarning() << "No debugger found for" << target.m_path << "... discarded";
|
||||||
|
return target.m_debuggerPath.isEmpty();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const QnxConfiguration::Target *QnxConfiguration::findTargetByDebuggerPath(
|
||||||
|
const FileName &path) const
|
||||||
|
{
|
||||||
|
auto it = std::find_if(m_targets.begin(), m_targets.end(),
|
||||||
|
[path](const Target &target) { return target.m_debuggerPath == path; });
|
||||||
|
return it == m_targets.end() ? nullptr : &(*it);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QnxConfiguration::updateTargets()
|
||||||
|
{
|
||||||
|
m_targets.clear();
|
||||||
|
|
||||||
|
QDir targetsDir(m_qnxTarget.toString());
|
||||||
|
QStringList targetNames = targetsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
foreach (const QString &targetName, targetNames) {
|
||||||
|
FileName targetPath = FileName(m_qnxTarget).appendPath(targetName);
|
||||||
|
FileName libc = FileName(targetPath).appendPath("lib/libc.so");
|
||||||
|
if (libc.exists()) {
|
||||||
|
QList<Abi> abis = Abi::abisOfBinary(libc);
|
||||||
|
if (abis.count() > 0) {
|
||||||
|
if (abis.count() > 1)
|
||||||
|
qWarning() << libc << "has more than one ABI ... processing all";
|
||||||
|
|
||||||
|
foreach (const Abi &abi, abis)
|
||||||
|
m_targets.append(Target(abi, targetPath));
|
||||||
|
} else {
|
||||||
|
qWarning() << libc << "has no ABIs ... discarded";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void QnxConfiguration::assignDebuggersToTargets()
|
||||||
|
{
|
||||||
|
QDir hostUsrBinDir(FileName(m_qnxHost).appendPath("usr/bin").toString());
|
||||||
|
QStringList debuggerNames = hostUsrBinDir.entryList(
|
||||||
|
QStringList(HostOsInfo::withExecutableSuffix(QLatin1String("nto*-gdb"))),
|
||||||
|
QDir::Files);
|
||||||
|
foreach (const QString &debuggerName, debuggerNames) {
|
||||||
|
FileName debuggerPath = FileName::fromString(hostUsrBinDir.path())
|
||||||
|
.appendPath(debuggerName);
|
||||||
|
DebuggerItem item;
|
||||||
|
item.setCommand(debuggerPath);
|
||||||
|
item.reinitializeFromFile();
|
||||||
|
bool found = false;
|
||||||
|
foreach (const Abi &abi, item.abis()) {
|
||||||
|
for (Target &target : m_targets) {
|
||||||
|
if (target.m_abi.isCompatibleWith(abi)) {
|
||||||
|
found = true;
|
||||||
|
|
||||||
|
if (target.m_debuggerPath.isEmpty()) {
|
||||||
|
target.m_debuggerPath = debuggerPath;
|
||||||
|
} else {
|
||||||
|
qWarning() << debuggerPath << "has the same ABI as" << target.m_debuggerPath
|
||||||
|
<< "... discarded";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
qWarning() << "No target found for" << debuggerName << "... discarded";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QnxConfiguration::Target::shortDescription() const
|
||||||
|
{
|
||||||
|
return QnxUtils::cpuDirShortDescription(cpuDir());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QnxConfiguration::Target::cpuDir() const
|
||||||
|
{
|
||||||
|
return m_path.fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ public:
|
|||||||
Utils::FileName qnxTarget() const;
|
Utils::FileName qnxTarget() const;
|
||||||
Utils::FileName qnxHost() const;
|
Utils::FileName qnxHost() const;
|
||||||
Utils::FileName qccCompilerPath() const;
|
Utils::FileName qccCompilerPath() const;
|
||||||
Utils::FileName armDebuggerPath() const;
|
|
||||||
Utils::FileName x86DebuggerPath() const;
|
|
||||||
QList<Utils::EnvironmentItem> qnxEnv() const;
|
QList<Utils::EnvironmentItem> qnxEnv() const;
|
||||||
QnxVersionNumber version() const;
|
QnxVersionNumber version() const;
|
||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
@@ -75,25 +73,14 @@ public:
|
|||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
bool canCreateKits() const;
|
bool canCreateKits() const;
|
||||||
Utils::FileName sdpPath() const;
|
Utils::FileName sdpPath() const;
|
||||||
QnxQtVersion* qnxQtVersion(QnxArchitecture arch) const;
|
|
||||||
|
|
||||||
QList<ProjectExplorer::ToolChain *> autoDetect(
|
QList<ProjectExplorer::ToolChain *> autoDetect(
|
||||||
const QList<ProjectExplorer::ToolChain *> &alreadyKnown);
|
const QList<ProjectExplorer::ToolChain *> &alreadyKnown);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariant createDebuggerItem(Qnx::QnxArchitecture arch,
|
|
||||||
const QString &displayName);
|
|
||||||
QnxToolChain* createToolChain(Qnx::QnxArchitecture arch,
|
|
||||||
const QString &displayName,
|
|
||||||
const QString &ndkPath);
|
|
||||||
QList<ProjectExplorer::ToolChain *> findToolChain(
|
QList<ProjectExplorer::ToolChain *> findToolChain(
|
||||||
const QList<ProjectExplorer::ToolChain *> &alreadyKnown,
|
const QList<ProjectExplorer::ToolChain *> &alreadyKnown,
|
||||||
Qnx::QnxArchitecture arch);
|
const ProjectExplorer::Abi &abi);
|
||||||
|
|
||||||
ProjectExplorer::Kit *createKit(QnxArchitecture arch,
|
|
||||||
QnxToolChain *toolChain,
|
|
||||||
const QVariant &debuggerItemId,
|
|
||||||
const QString &displayName);
|
|
||||||
|
|
||||||
QStringList validationErrors() const;
|
QStringList validationErrors() const;
|
||||||
|
|
||||||
@@ -106,13 +93,44 @@ private:
|
|||||||
QString m_configName;
|
QString m_configName;
|
||||||
|
|
||||||
Utils::FileName m_envFile;
|
Utils::FileName m_envFile;
|
||||||
|
Utils::FileName m_qnxConfiguration;
|
||||||
Utils::FileName m_qnxTarget;
|
Utils::FileName m_qnxTarget;
|
||||||
Utils::FileName m_qnxHost;
|
Utils::FileName m_qnxHost;
|
||||||
Utils::FileName m_qccCompiler;
|
Utils::FileName m_qccCompiler;
|
||||||
Utils::FileName m_armlev7Debugger;
|
|
||||||
Utils::FileName m_x86Debugger;
|
|
||||||
QList<Utils::EnvironmentItem> m_qnxEnv;
|
QList<Utils::EnvironmentItem> m_qnxEnv;
|
||||||
QnxVersionNumber m_version;
|
QnxVersionNumber m_version;
|
||||||
|
|
||||||
|
class Target
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Target(const ProjectExplorer::Abi &abi, Utils::FileName &path)
|
||||||
|
: m_abi(abi), m_path(path)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString shortDescription() const;
|
||||||
|
QString cpuDir() const;
|
||||||
|
|
||||||
|
ProjectExplorer::Abi m_abi;
|
||||||
|
Utils::FileName m_path;
|
||||||
|
Utils::FileName m_debuggerPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
QList<Target> m_targets;
|
||||||
|
|
||||||
|
QnxQtVersion *qnxQtVersion(const Target &target) const;
|
||||||
|
|
||||||
|
void createTools(const Target &target);
|
||||||
|
QVariant createDebugger(const Target &target);
|
||||||
|
QnxToolChain *createToolChain(const Target &target);
|
||||||
|
ProjectExplorer::Kit *createKit(const Target &target,
|
||||||
|
QnxToolChain *toolChain,
|
||||||
|
const QVariant &debugger);
|
||||||
|
|
||||||
|
const Target *findTargetByDebuggerPath(const Utils::FileName &path) const;
|
||||||
|
|
||||||
|
void updateTargets();
|
||||||
|
void assignDebuggersToTargets();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
@@ -29,12 +29,6 @@
|
|||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
|
|
||||||
enum QnxArchitecture {
|
|
||||||
X86,
|
|
||||||
ArmLeV7,
|
|
||||||
UnknownArch
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
|
|
||||||
const char QNX_TARGET_KEY[] = "QNX_TARGET";
|
const char QNX_TARGET_KEY[] = "QNX_TARGET";
|
||||||
|
|||||||
@@ -30,25 +30,26 @@
|
|||||||
#include "qnxutils.h"
|
#include "qnxutils.h"
|
||||||
|
|
||||||
#include <coreplugin/featureprovider.h>
|
#include <coreplugin/featureprovider.h>
|
||||||
|
#include <proparser/profileevaluator.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static char SDK_PATH_KEY[] = "SDKPath";
|
static char SDK_PATH_KEY[] = "SDKPath";
|
||||||
static char ARCH_KEY[] = "Arch";
|
|
||||||
|
|
||||||
QnxQtVersion::QnxQtVersion() : m_arch(UnknownArch)
|
QnxQtVersion::QnxQtVersion()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
QnxQtVersion::QnxQtVersion(QnxArchitecture arch, const Utils::FileName &path, bool isAutoDetected,
|
QnxQtVersion::QnxQtVersion(const Utils::FileName &path, bool isAutoDetected,
|
||||||
const QString &autoDetectionSource) :
|
const QString &autoDetectionSource) :
|
||||||
QtSupport::BaseQtVersion(path, isAutoDetected, autoDetectionSource),
|
QtSupport::BaseQtVersion(path, isAutoDetected, autoDetectionSource)
|
||||||
m_arch(arch)
|
|
||||||
{
|
{
|
||||||
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
||||||
}
|
}
|
||||||
@@ -66,7 +67,8 @@ QString QnxQtVersion::type() const
|
|||||||
QString QnxQtVersion::description() const
|
QString QnxQtVersion::description() const
|
||||||
{
|
{
|
||||||
//: Qt Version is meant for QNX
|
//: Qt Version is meant for QNX
|
||||||
return QCoreApplication::translate("Qnx::Internal::QnxQtVersion", "QNX %1").arg(archString());
|
return QCoreApplication::translate("Qnx::Internal::QnxQtVersion", "QNX %1")
|
||||||
|
.arg(QnxUtils::cpuDirShortDescription(cpuDir()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<Core::Id> QnxQtVersion::availableFeatures() const
|
QSet<Core::Id> QnxQtVersion::availableFeatures() const
|
||||||
@@ -109,29 +111,22 @@ QString QnxQtVersion::qnxTarget() const
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxArchitecture QnxQtVersion::architecture() const
|
QString QnxQtVersion::cpuDir() const
|
||||||
{
|
{
|
||||||
return m_arch;
|
ensureMkSpecParsed();
|
||||||
|
return m_cpuDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QnxQtVersion::archString() const
|
void QnxQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
||||||
{
|
{
|
||||||
switch (m_arch) {
|
m_cpuDir = evaluator->value(QLatin1String("QNX_CPUDIR"));
|
||||||
case X86:
|
BaseQtVersion::parseMkSpec(evaluator);
|
||||||
return QLatin1String("x86");
|
|
||||||
case ArmLeV7:
|
|
||||||
return QLatin1String("ARMle-v7");
|
|
||||||
case UnknownArch:
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap QnxQtVersion::toMap() const
|
QVariantMap QnxQtVersion::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap result = BaseQtVersion::toMap();
|
QVariantMap result = BaseQtVersion::toMap();
|
||||||
result.insert(QLatin1String(SDK_PATH_KEY), sdkPath());
|
result.insert(QLatin1String(SDK_PATH_KEY), sdkPath());
|
||||||
result.insert(QLatin1String(ARCH_KEY), m_arch);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +134,6 @@ void QnxQtVersion::fromMap(const QVariantMap &map)
|
|||||||
{
|
{
|
||||||
BaseQtVersion::fromMap(map);
|
BaseQtVersion::fromMap(map);
|
||||||
setSdkPath(QDir::fromNativeSeparators(map.value(QLatin1String(SDK_PATH_KEY)).toString()));
|
setSdkPath(QDir::fromNativeSeparators(map.value(QLatin1String(SDK_PATH_KEY)).toString()));
|
||||||
m_arch = static_cast<QnxArchitecture>(map.value(QLatin1String(ARCH_KEY), UnknownArch).toInt());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ProjectExplorer::Abi> QnxQtVersion::detectQtAbis() const
|
QList<ProjectExplorer::Abi> QnxQtVersion::detectQtAbis() const
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class QnxQtVersion : public QtSupport::BaseQtVersion
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QnxQtVersion();
|
QnxQtVersion();
|
||||||
QnxQtVersion(QnxArchitecture arch, const Utils::FileName &path,
|
QnxQtVersion(const Utils::FileName &path,
|
||||||
bool isAutoDetected = false,
|
bool isAutoDetected = false,
|
||||||
const QString &autoDetectionSource = QString());
|
const QString &autoDetectionSource = QString());
|
||||||
QnxQtVersion *clone() const override;
|
QnxQtVersion *clone() const override;
|
||||||
@@ -54,8 +54,7 @@ public:
|
|||||||
QString qnxHost() const;
|
QString qnxHost() const;
|
||||||
QString qnxTarget() const;
|
QString qnxTarget() const;
|
||||||
|
|
||||||
QnxArchitecture architecture() const;
|
QString cpuDir() const;
|
||||||
QString archString() const;
|
|
||||||
|
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
void fromMap(const QVariantMap &map) override;
|
void fromMap(const QVariantMap &map) override;
|
||||||
@@ -73,14 +72,17 @@ public:
|
|||||||
QString sdkPath() const;
|
QString sdkPath() const;
|
||||||
void setSdkPath(const QString &sdkPath);
|
void setSdkPath(const QString &sdkPath);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void parseMkSpec(ProFileEvaluator *) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateEnvironment() const;
|
void updateEnvironment() const;
|
||||||
|
|
||||||
QList<Utils::EnvironmentItem> environment() const;
|
QList<Utils::EnvironmentItem> environment() const;
|
||||||
|
|
||||||
QnxArchitecture m_arch;
|
|
||||||
QString m_sdkPath;
|
QString m_sdkPath;
|
||||||
|
|
||||||
|
mutable QString m_cpuDir;
|
||||||
mutable bool m_environmentUpToDate = false;
|
mutable bool m_environmentUpToDate = false;
|
||||||
mutable QList<Utils::EnvironmentItem> m_qnxEnv;
|
mutable QList<Utils::EnvironmentItem> m_qnxEnv;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -74,9 +74,7 @@ QtSupport::BaseQtVersion *QnxQtVersionFactory::create(const Utils::FileName &qma
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (evaluator->contains(QLatin1String("QNX_CPUDIR"))) {
|
if (evaluator->contains(QLatin1String("QNX_CPUDIR"))) {
|
||||||
QString cpuDir = evaluator->value(QLatin1String("QNX_CPUDIR"));
|
return new QnxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
return new QnxQtVersion(QnxUtils::cpudirToArch(cpuDir), qmakePath,
|
|
||||||
isAutoDetected, autoDetectionSource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ static const QList<Abi> qccSupportedAbis()
|
|||||||
{
|
{
|
||||||
QList<Abi> abis;
|
QList<Abi> abis;
|
||||||
abis << Abi(Abi::ArmArchitecture, Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 32);
|
abis << Abi(Abi::ArmArchitecture, Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 32);
|
||||||
|
abis << Abi(Abi::ArmArchitecture, Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 64);
|
||||||
abis << Abi(Abi::X86Architecture, Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 32);
|
abis << Abi(Abi::X86Architecture, Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 32);
|
||||||
|
abis << Abi(Abi::X86Architecture, Abi::LinuxOS, Abi::GenericLinuxFlavor, Abi::ElfFormat, 64);
|
||||||
|
|
||||||
return abis;
|
return abis;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
@@ -51,14 +52,21 @@ QString QnxUtils::addQuotes(const QString &string)
|
|||||||
return QLatin1Char('"') + string + QLatin1Char('"');
|
return QLatin1Char('"') + string + QLatin1Char('"');
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxArchitecture QnxUtils::cpudirToArch(const QString &cpuDir)
|
QString QnxUtils::cpuDirShortDescription(const QString &cpuDir)
|
||||||
{
|
{
|
||||||
if (cpuDir == QLatin1String("x86"))
|
if (cpuDir == "armle-v7")
|
||||||
return X86;
|
return QLatin1String("32-bit ARM");
|
||||||
else if (cpuDir == QLatin1String("armle-v7"))
|
|
||||||
return ArmLeV7;
|
if (cpuDir == "aarch64le")
|
||||||
else
|
return QLatin1String("64-bit ARM");
|
||||||
return UnknownArch;
|
|
||||||
|
if (cpuDir == "x86")
|
||||||
|
return QLatin1String("32-bit x86");
|
||||||
|
|
||||||
|
if (cpuDir == "x86_64")
|
||||||
|
return QLatin1String("64-bit x86");
|
||||||
|
|
||||||
|
return cpuDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QnxUtils::searchPaths(QnxQtVersion *qtVersion)
|
QStringList QnxUtils::searchPaths(QnxQtVersion *qtVersion)
|
||||||
@@ -74,9 +82,9 @@ QStringList QnxUtils::searchPaths(QnxQtVersion *qtVersion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
searchPaths << qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_LIBS"));
|
searchPaths << qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_LIBS"));
|
||||||
searchPaths << qtVersion->qnxTarget() + QLatin1Char('/') + qtVersion->archString().toLower()
|
searchPaths << qtVersion->qnxTarget() + QLatin1Char('/') + qtVersion->cpuDir()
|
||||||
+ QLatin1String("/lib");
|
+ QLatin1String("/lib");
|
||||||
searchPaths << qtVersion->qnxTarget() + QLatin1Char('/') + qtVersion->archString().toLower()
|
searchPaths << qtVersion->qnxTarget() + QLatin1Char('/') + qtVersion->cpuDir()
|
||||||
+ QLatin1String("/usr/lib");
|
+ QLatin1String("/usr/lib");
|
||||||
|
|
||||||
return searchPaths;
|
return searchPaths;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class QnxUtils
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static QString addQuotes(const QString &string);
|
static QString addQuotes(const QString &string);
|
||||||
static Qnx::QnxArchitecture cpudirToArch(const QString &cpuDir);
|
static QString cpuDirShortDescription(const QString &cpuDir);
|
||||||
static QStringList searchPaths(Qnx::Internal::QnxQtVersion *qtVersion);
|
static QStringList searchPaths(Qnx::Internal::QnxQtVersion *qtVersion);
|
||||||
static QList<Utils::EnvironmentItem> qnxEnvironmentFromEnvFile(const QString &fileName);
|
static QList<Utils::EnvironmentItem> qnxEnvironmentFromEnvFile(const QString &fileName);
|
||||||
static QString envFilePath(const QString & ndkPath, const QString& targetVersion = QString());
|
static QString envFilePath(const QString & ndkPath, const QString& targetVersion = QString());
|
||||||
|
|||||||
Reference in New Issue
Block a user