forked from qt-creator/qt-creator
Qnx: Use Utils::Environment for qnx environment
Change-Id: I499ca9be0abc15fc0c57847ff288e80612a536fe Reviewed-by: Tobias Nätterlund <tobias.naetterlund@kdab.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
#include "blackberrycertificate.h"
|
#include "blackberrycertificate.h"
|
||||||
#include "blackberryconfiguration.h"
|
#include "blackberryconfiguration.h"
|
||||||
#include "blackberryconfigurationmanager.h"
|
#include "blackberryconfigurationmanager.h"
|
||||||
|
#include "blackberryndkprocess.h"
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
@@ -182,18 +183,7 @@ void BlackBerryCertificate::processError()
|
|||||||
|
|
||||||
QString BlackBerryCertificate::command() const
|
QString BlackBerryCertificate::command() const
|
||||||
{
|
{
|
||||||
QString command;
|
return BlackBerryNdkProcess::resolveNdkToolPath(QLatin1String("blackberry-keytool"));
|
||||||
// TOOD: Give user choice to select NDK from where to get commands
|
|
||||||
QMultiMap<QString, QString> qnxEnv = BlackBerryConfigurationManager::instance().defaultQnxEnv();
|
|
||||||
if (!qnxEnv.isEmpty()) {
|
|
||||||
command = qnxEnv.value(QLatin1String("QNX_HOST"))
|
|
||||||
+ QLatin1String("/usr/bin/blackberry-keytool");
|
|
||||||
|
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
|
||||||
command += QLatin1String(".bat");
|
|
||||||
}
|
|
||||||
|
|
||||||
return command;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -67,16 +67,25 @@ BlackBerryConfiguration::BlackBerryConfiguration(const FileName &ndkEnvFile, boo
|
|||||||
m_isAutoDetected = isAutoDetected;
|
m_isAutoDetected = isAutoDetected;
|
||||||
QString ndkPath = ndkEnvFile.parentDir().toString();
|
QString ndkPath = ndkEnvFile.parentDir().toString();
|
||||||
m_displayName = displayName.isEmpty() ? ndkPath.split(QDir::separator()).last() : displayName;
|
m_displayName = displayName.isEmpty() ? ndkPath.split(QDir::separator()).last() : displayName;
|
||||||
m_qnxEnv = QnxUtils::parseEnvironmentFile(m_ndkEnvFile.toString());
|
m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString());
|
||||||
|
|
||||||
|
QString ndkTarget;
|
||||||
|
QString qnxHost;
|
||||||
|
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
||||||
|
if (item.name == QLatin1String("QNX_TARGET"))
|
||||||
|
ndkTarget = item.value;
|
||||||
|
|
||||||
|
else if (item.name == QLatin1String("QNX_HOST"))
|
||||||
|
qnxHost = item.value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QString ndkTarget = m_qnxEnv.value(QLatin1String("QNX_TARGET"));
|
|
||||||
QString sep = QString::fromLatin1("%1qnx6").arg(QDir::separator());
|
QString sep = QString::fromLatin1("%1qnx6").arg(QDir::separator());
|
||||||
m_targetName = ndkTarget.split(sep).first().split(QDir::separator()).last();
|
m_targetName = ndkTarget.split(sep).first().split(QDir::separator()).last();
|
||||||
|
|
||||||
if (QDir(ndkTarget).exists())
|
if (QDir(ndkTarget).exists())
|
||||||
m_sysRoot = FileName::fromString(ndkTarget);
|
m_sysRoot = FileName::fromString(ndkTarget);
|
||||||
|
|
||||||
QString qnxHost = m_qnxEnv.value(QLatin1String("QNX_HOST"));
|
|
||||||
FileName qmake4Path = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qmake")));
|
FileName qmake4Path = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qmake")));
|
||||||
FileName qmake5Path = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qt5/qmake")));
|
FileName qmake5Path = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qt5/qmake")));
|
||||||
FileName gccPath = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qcc")));
|
FileName gccPath = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qcc")));
|
||||||
@@ -165,7 +174,7 @@ FileName BlackBerryConfiguration::sysRoot() const
|
|||||||
return m_sysRoot;
|
return m_sysRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMultiMap<QString, QString> BlackBerryConfiguration::qnxEnv() const
|
QList<Utils::EnvironmentItem> BlackBerryConfiguration::qnxEnv() const
|
||||||
{
|
{
|
||||||
return m_qnxEnv;
|
return m_qnxEnv;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
Utils::FileName deviceDebuger() const;
|
Utils::FileName deviceDebuger() const;
|
||||||
Utils::FileName simulatorDebuger() const;
|
Utils::FileName simulatorDebuger() const;
|
||||||
Utils::FileName sysRoot() const;
|
Utils::FileName sysRoot() const;
|
||||||
QMultiMap<QString, QString> qnxEnv() const;
|
QList<Utils::EnvironmentItem> qnxEnv() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
@@ -85,7 +85,7 @@ private:
|
|||||||
Utils::FileName m_deviceDebugger;
|
Utils::FileName m_deviceDebugger;
|
||||||
Utils::FileName m_simulatorDebugger;
|
Utils::FileName m_simulatorDebugger;
|
||||||
Utils::FileName m_sysRoot;
|
Utils::FileName m_sysRoot;
|
||||||
QMultiMap<QString, QString> m_qnxEnv;
|
QList<Utils::EnvironmentItem> m_qnxEnv;
|
||||||
|
|
||||||
void createConfigurationPerQtVersion(
|
void createConfigurationPerQtVersion(
|
||||||
const Utils::FileName &qmakePath, Qnx::QnxArchitecture arch);
|
const Utils::FileName &qmakePath, Qnx::QnxArchitecture arch);
|
||||||
|
|||||||
@@ -281,16 +281,16 @@ BlackBerryConfiguration *BlackBerryConfigurationManager::configurationFromEnvFil
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a valid qnxEnv map from a valid configuration;
|
// Returns a valid qnxEnv from a valid configuration;
|
||||||
// Needed by other classes to get blackberry process path (keys registration, debug token...)
|
// Needed by other classes to get blackberry process path (keys registration, debug token...)
|
||||||
QMultiMap<QString, QString> BlackBerryConfigurationManager::defaultQnxEnv()
|
QList<Utils::EnvironmentItem> BlackBerryConfigurationManager::defaultQnxEnv()
|
||||||
{
|
{
|
||||||
foreach (BlackBerryConfiguration *config, m_configs) {
|
foreach (BlackBerryConfiguration *config, m_configs) {
|
||||||
if (config->isActive() && !config->qnxEnv().isEmpty())
|
if (config->isActive() && config->qnxEnv().size())
|
||||||
return config->qnxEnv();
|
return config->qnxEnv();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QMultiMap<QString, QString>();
|
return QList<Utils::EnvironmentItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackBerryConfigurationManager::loadSettings()
|
void BlackBerryConfigurationManager::loadSettings()
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
QString defaultDebugTokenPath() const;
|
QString defaultDebugTokenPath() const;
|
||||||
void clearConfigurationSettings(BlackBerryConfiguration *config);
|
void clearConfigurationSettings(BlackBerryConfiguration *config);
|
||||||
|
|
||||||
QMultiMap<QString, QString> defaultQnxEnv();
|
QList<Utils::EnvironmentItem> defaultQnxEnv();
|
||||||
|
|
||||||
void loadAutoDetectedConfigurations();
|
void loadAutoDetectedConfigurations();
|
||||||
|
|
||||||
|
|||||||
@@ -62,10 +62,8 @@ BlackBerryDeviceConnection::BlackBerryDeviceConnection() :
|
|||||||
void BlackBerryDeviceConnection::connectDevice(const ProjectExplorer::IDevice::ConstPtr &device)
|
void BlackBerryDeviceConnection::connectDevice(const ProjectExplorer::IDevice::ConstPtr &device)
|
||||||
{
|
{
|
||||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||||
|
foreach (const Utils::EnvironmentItem &item, BlackBerryConfigurationManager::instance().defaultQnxEnv())
|
||||||
QMultiMap<QString, QString> qnxEnv = BlackBerryConfigurationManager::instance().defaultQnxEnv();
|
env.appendOrSet(item.name, item.value);
|
||||||
if (!qnxEnv.isEmpty())
|
|
||||||
QnxUtils::prependQnxMapToEnvironment(qnxEnv, env);
|
|
||||||
|
|
||||||
m_process->setEnvironment(env.toStringList());
|
m_process->setEnvironment(env.toStringList());
|
||||||
|
|
||||||
|
|||||||
@@ -56,13 +56,17 @@ BlackBerryNdkProcess::BlackBerryNdkProcess(const QString &command, QObject *pare
|
|||||||
const QString BlackBerryNdkProcess::resolveNdkToolPath(const QString &tool)
|
const QString BlackBerryNdkProcess::resolveNdkToolPath(const QString &tool)
|
||||||
{
|
{
|
||||||
QString toolPath;
|
QString toolPath;
|
||||||
QMultiMap<QString, QString> qnxEnv = BlackBerryConfigurationManager::instance().defaultQnxEnv();
|
QList<Utils::EnvironmentItem> qnxEnv = BlackBerryConfigurationManager::instance().defaultQnxEnv();
|
||||||
if (!qnxEnv.isEmpty()) {
|
foreach (const Utils::EnvironmentItem &item, qnxEnv) {
|
||||||
toolPath = qnxEnv.value(QLatin1String("QNX_HOST"))
|
if (item.name == QLatin1String("QNX_HOST") && !item.value.isEmpty()) {
|
||||||
+ (QLatin1String("/usr/bin/")) + tool;
|
toolPath = item.value
|
||||||
|
+ (QLatin1String("/usr/bin/")) + tool;
|
||||||
|
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
if (Utils::HostOsInfo::isWindowsHost())
|
||||||
toolPath += QLatin1String(".bat");
|
toolPath += QLatin1String(".bat");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return toolPath;
|
return toolPath;
|
||||||
|
|||||||
@@ -103,14 +103,15 @@ void BlackBerryQtVersion::fromMap(const QVariantMap &map)
|
|||||||
m_ndkEnvFile = map.value(NndkEnvFile).toString();
|
m_ndkEnvFile = map.value(NndkEnvFile).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMultiMap<QString, QString> BlackBerryQtVersion::environment() const
|
QList<Utils::EnvironmentItem> BlackBerryQtVersion::environment() const
|
||||||
{
|
{
|
||||||
QTC_CHECK(!sdkPath().isEmpty());
|
QTC_CHECK(!sdkPath().isEmpty());
|
||||||
if (sdkPath().isEmpty())
|
if (sdkPath().isEmpty())
|
||||||
return QMultiMap<QString, QString>();
|
return QList<Utils::EnvironmentItem>();
|
||||||
|
|
||||||
QString envFile = m_ndkEnvFile.isEmpty() ? QnxUtils::envFilePath(sdkPath()) : m_ndkEnvFile;
|
QString envFile = m_ndkEnvFile.isEmpty() ? QnxUtils::envFilePath(sdkPath()) : m_ndkEnvFile;
|
||||||
QMultiMap<QString,QString> result = QnxUtils::parseEnvironmentFile(envFile);
|
QList<Utils::EnvironmentItem> env = QnxUtils::qnxEnvironmentFromNdkFile(envFile);
|
||||||
|
|
||||||
// BB NDK Host is having qmake executable which is using qt.conf file to specify
|
// BB NDK Host is having qmake executable which is using qt.conf file to specify
|
||||||
// base information. The qt.conf file is using 'CPUVARDIR' environment variable
|
// base information. The qt.conf file is using 'CPUVARDIR' environment variable
|
||||||
// to provide correct information for both x86 and armle-v7 architectures.
|
// to provide correct information for both x86 and armle-v7 architectures.
|
||||||
@@ -119,9 +120,11 @@ QMultiMap<QString, QString> BlackBerryQtVersion::environment() const
|
|||||||
// CPUVARDIR to match expected architecture() otherwise qmake environment is
|
// CPUVARDIR to match expected architecture() otherwise qmake environment is
|
||||||
// always resolved to be for armle-v7 architecture only as it is specified
|
// always resolved to be for armle-v7 architecture only as it is specified
|
||||||
// BB NDK environment file.
|
// BB NDK environment file.
|
||||||
result.replace(QLatin1String("CPUVARDIR"),
|
|
||||||
architecture() == X86 ? QLatin1String("x86") : QLatin1String("armle-v7"));
|
env.append(Utils::EnvironmentItem(QLatin1String("CPUVARDIR"),
|
||||||
return result;
|
architecture() == X86 ? QLatin1String("x86") : QLatin1String("armle-v7")));
|
||||||
|
|
||||||
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackBerryQtVersion::setDefaultSdkPath()
|
void BlackBerryQtVersion::setDefaultSdkPath()
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
QString sdkDescription() const;
|
QString sdkDescription() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMultiMap<QString, QString> environment() const;
|
QList<Utils::EnvironmentItem> environment() const;
|
||||||
void setDefaultSdkPath();
|
void setDefaultSdkPath();
|
||||||
|
|
||||||
QString m_ndkEnvFile;
|
QString m_ndkEnvFile;
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ void QnxAbstractQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils
|
|||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion::addToEnvironment(k, env);
|
QtSupport::BaseQtVersion::addToEnvironment(k, env);
|
||||||
updateEnvironment();
|
updateEnvironment();
|
||||||
QnxUtils::prependQnxMapToEnvironment(m_envMap, env);
|
env.modify(m_qnxEnv);
|
||||||
|
|
||||||
env.prependOrSetLibrarySearchPath(versionInfo().value(QLatin1String("QT_INSTALL_LIBS")));
|
env.prependOrSetLibrarySearchPath(versionInfo().value(QLatin1String("QT_INSTALL_LIBS")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ Utils::Environment QnxAbstractQtVersion::qmakeRunEnvironment() const
|
|||||||
updateEnvironment();
|
updateEnvironment();
|
||||||
|
|
||||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||||
QnxUtils::prependQnxMapToEnvironment(m_envMap, env);
|
env.modify(m_qnxEnv);
|
||||||
|
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
@@ -129,7 +130,7 @@ void QnxAbstractQtVersion::setSdkPath(const QString &sdkPath)
|
|||||||
void QnxAbstractQtVersion::updateEnvironment() const
|
void QnxAbstractQtVersion::updateEnvironment() const
|
||||||
{
|
{
|
||||||
if (!m_environmentUpToDate) {
|
if (!m_environmentUpToDate) {
|
||||||
m_envMap = environment();
|
m_qnxEnv = environment();
|
||||||
m_environmentUpToDate = true;
|
m_environmentUpToDate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,7 +140,12 @@ QString QnxAbstractQtVersion::qnxHost() const
|
|||||||
if (!m_environmentUpToDate)
|
if (!m_environmentUpToDate)
|
||||||
updateEnvironment();
|
updateEnvironment();
|
||||||
|
|
||||||
return m_envMap.value(QLatin1String(Constants::QNX_HOST_KEY));
|
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
||||||
|
if (item.name == QLatin1String(Constants::QNX_HOST_KEY))
|
||||||
|
return item.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QnxAbstractQtVersion::qnxTarget() const
|
QString QnxAbstractQtVersion::qnxTarget() const
|
||||||
@@ -147,7 +153,12 @@ QString QnxAbstractQtVersion::qnxTarget() const
|
|||||||
if (!m_environmentUpToDate)
|
if (!m_environmentUpToDate)
|
||||||
updateEnvironment();
|
updateEnvironment();
|
||||||
|
|
||||||
return m_envMap.value(QLatin1String(Constants::QNX_TARGET_KEY));
|
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
||||||
|
if (item.name == QLatin1String(Constants::QNX_TARGET_KEY))
|
||||||
|
return item.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QtSupport::QtConfigWidget *QnxAbstractQtVersion::createConfigurationWidget() const
|
QtSupport::QtConfigWidget *QnxAbstractQtVersion::createConfigurationWidget() const
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
|
|
||||||
#include <qtsupport/baseqtversion.h>
|
#include <qtsupport/baseqtversion.h>
|
||||||
|
|
||||||
|
#include <utils/environment.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
@@ -78,13 +80,13 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateEnvironment() const;
|
void updateEnvironment() const;
|
||||||
virtual QMultiMap<QString, QString> environment() const = 0;
|
virtual QList<Utils::EnvironmentItem> environment() const = 0;
|
||||||
|
|
||||||
QnxArchitecture m_arch;
|
QnxArchitecture m_arch;
|
||||||
QString m_sdkPath;
|
QString m_sdkPath;
|
||||||
|
|
||||||
mutable bool m_environmentUpToDate;
|
mutable bool m_environmentUpToDate;
|
||||||
mutable QMultiMap<QString, QString> m_envMap;
|
mutable QList<Utils::EnvironmentItem> m_qnxEnv;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
#include "qnxconstants.h"
|
#include "qnxconstants.h"
|
||||||
|
|
||||||
|
#include "qnxutils.h"
|
||||||
|
|
||||||
#include <coreplugin/featureprovider.h>
|
#include <coreplugin/featureprovider.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
@@ -92,35 +94,7 @@ QString QnxQtVersion::sdkDescription() const
|
|||||||
return tr("QNX Software Development Platform:");
|
return tr("QNX Software Development Platform:");
|
||||||
}
|
}
|
||||||
|
|
||||||
QMultiMap<QString, QString> QnxQtVersion::environment() const
|
QList<Utils::EnvironmentItem> QnxQtVersion::environment() const
|
||||||
{
|
{
|
||||||
// Mimic what the SDP installer puts into the system environment
|
return QnxUtils::qnxEnvironment(sdkPath());
|
||||||
|
|
||||||
QMultiMap<QString, QString> environment;
|
|
||||||
|
|
||||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
|
||||||
// TODO:
|
|
||||||
//environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
|
|
||||||
environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6"));
|
|
||||||
environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/win32/x86"));
|
|
||||||
|
|
||||||
environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/win32/x86/usr/bin"));
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
//environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
|
|
||||||
} else if (Utils::HostOsInfo::isAnyUnixHost()) {
|
|
||||||
environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
|
|
||||||
environment.insert(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath() + QLatin1String("/target/qnx6"));
|
|
||||||
environment.insert(QLatin1String(Constants::QNX_HOST_KEY), sdkPath() + QLatin1String("/host/linux/x86"));
|
|
||||||
|
|
||||||
environment.insert(QLatin1String("PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/bin"));
|
|
||||||
environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
|
|
||||||
|
|
||||||
environment.insert(QLatin1String("LD_LIBRARY_PATH"), sdkPath() + QLatin1String("/host/linux/x86/usr/lib"));
|
|
||||||
}
|
|
||||||
|
|
||||||
environment.insert(QLatin1String("QNX_JAVAHOME"), sdkPath() + QLatin1String("/_jvm"));
|
|
||||||
environment.insert(QLatin1String("MAKEFLAGS"), QLatin1String("-I") + sdkPath() + QLatin1String("/target/qnx6/usr/include"));
|
|
||||||
|
|
||||||
return environment;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
QString sdkDescription() const;
|
QString sdkDescription() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMultiMap<QString, QString> environment() const;
|
QList<Utils::EnvironmentItem> environment() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -77,13 +77,13 @@ QStringList QnxUtils::searchPaths(QnxAbstractQtVersion *qtVersion)
|
|||||||
return searchPaths;
|
return searchPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMultiMap<QString, QString> QnxUtils::parseEnvironmentFile(const QString &fileName)
|
QList<Utils::EnvironmentItem> QnxUtils::qnxEnvironmentFromNdkFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
QMultiMap<QString, QString> result;
|
QList <Utils::EnvironmentItem> items;
|
||||||
|
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
if (!file.open(QIODevice::ReadOnly))
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
return result;
|
return items;
|
||||||
|
|
||||||
QTextStream str(&file);
|
QTextStream str(&file);
|
||||||
QMap<QString, QString> fileContent;
|
QMap<QString, QString> fileContent;
|
||||||
@@ -171,15 +171,17 @@ QMultiMap<QString, QString> QnxUtils::parseEnvironmentFile(const QString &fileNa
|
|||||||
val.replace(keyAsUnixVar, replaceIt.value());
|
val.replace(keyAsUnixVar, replaceIt.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.insert(key, val);
|
|
||||||
|
// This variable will be properly set based on the qt version architecture
|
||||||
|
if (key == QLatin1String("CPUVARDIR"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
items.append(Utils::EnvironmentItem(key, val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result.contains(QLatin1String("CPUVARDIR")))
|
return items;
|
||||||
result.insert(QLatin1String("CPUVARDIR"), QLatin1String("armle-v7"));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QnxUtils::isValidNdkPath(const QString &ndkPath)
|
bool QnxUtils::isValidNdkPath(const QString &ndkPath)
|
||||||
@@ -206,23 +208,6 @@ QString QnxUtils::envFilePath(const QString &ndkPath, const QString &targetVersi
|
|||||||
return envFile;
|
return envFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxUtils::prependQnxMapToEnvironment(const QMultiMap<QString, QString> &qnxMap, Utils::Environment &env)
|
|
||||||
{
|
|
||||||
QMultiMap<QString, QString>::const_iterator it;
|
|
||||||
QMultiMap<QString, QString>::const_iterator end(qnxMap.constEnd());
|
|
||||||
for (it = qnxMap.constBegin(); it != end; ++it) {
|
|
||||||
const QString key = it.key();
|
|
||||||
const QString value = it.value();
|
|
||||||
|
|
||||||
if (key == QLatin1String("PATH"))
|
|
||||||
env.prependOrSetPath(value);
|
|
||||||
else if (key == QLatin1String("LD_LIBRARY_PATH"))
|
|
||||||
env.prependOrSetLibrarySearchPath(value);
|
|
||||||
else
|
|
||||||
env.set(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils::FileName QnxUtils::executableWithExtension(const Utils::FileName &fileName)
|
Utils::FileName QnxUtils::executableWithExtension(const Utils::FileName &fileName)
|
||||||
{
|
{
|
||||||
Utils::FileName result = fileName;
|
Utils::FileName result = fileName;
|
||||||
@@ -336,3 +321,36 @@ QString QnxUtils::qdeInstallProcess(const QString &ndkPath, const QString &optio
|
|||||||
return QString::fromLatin1("%1 -nosplash -application com.qnx.tools.ide.sdk.manager.core.SDKInstallerApplication "
|
return QString::fromLatin1("%1 -nosplash -application com.qnx.tools.ide.sdk.manager.core.SDKInstallerApplication "
|
||||||
"%2 %3 -vmargs -Dosgi.console=:none").arg(installerPath, option, version);
|
"%2 %3 -vmargs -Dosgi.console=:none").arg(installerPath, option, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<Utils::EnvironmentItem> QnxUtils::qnxEnvironment(const QString &sdkPath)
|
||||||
|
{
|
||||||
|
// Mimic what the SDP installer puts into the system environment
|
||||||
|
|
||||||
|
QList<Utils::EnvironmentItem> environmentItems;
|
||||||
|
|
||||||
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||||
|
// TODO:
|
||||||
|
//environment.insert(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx"));
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath + QLatin1String("/target/qnx6")));
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String(Constants::QNX_HOST_KEY), sdkPath + QLatin1String("/host/win32/x86")));
|
||||||
|
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String("PATH"), sdkPath + QLatin1String("/host/win32/x86/usr/bin")));
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
//environment.insert(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin"));
|
||||||
|
} else if (Utils::HostOsInfo::isAnyUnixHost()) {
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String("QNX_CONFIGURATION"), QLatin1String("/etc/qnx")));
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String(Constants::QNX_TARGET_KEY), sdkPath + QLatin1String("/target/qnx6")));
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String(Constants::QNX_HOST_KEY), sdkPath + QLatin1String("/host/linux/x86")));
|
||||||
|
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String("PATH"), sdkPath + QLatin1String("/host/linux/x86/usr/bin")));
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String("PATH"), QLatin1String("/etc/qnx/bin")));
|
||||||
|
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String("LD_LIBRARY_PATH"), sdkPath + QLatin1String("/host/linux/x86/usr/lib")));
|
||||||
|
}
|
||||||
|
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String("QNX_JAVAHOME"), sdkPath + QLatin1String("/_jvm")));
|
||||||
|
environmentItems.append(Utils::EnvironmentItem(QLatin1String("MAKEFLAGS"), QLatin1String("-I") + sdkPath + QLatin1String("/target/qnx6/usr/include")));
|
||||||
|
|
||||||
|
return environmentItems;
|
||||||
|
}
|
||||||
|
|||||||
@@ -62,10 +62,9 @@ public:
|
|||||||
static QString addQuotes(const QString &string);
|
static QString addQuotes(const QString &string);
|
||||||
static Qnx::QnxArchitecture cpudirToArch(const QString &cpuDir);
|
static Qnx::QnxArchitecture cpudirToArch(const QString &cpuDir);
|
||||||
static QStringList searchPaths(QnxAbstractQtVersion *qtVersion);
|
static QStringList searchPaths(QnxAbstractQtVersion *qtVersion);
|
||||||
static QMultiMap<QString, QString> parseEnvironmentFile(const QString &fileName);
|
static QList<Utils::EnvironmentItem> qnxEnvironmentFromNdkFile(const QString &fileName);
|
||||||
static bool isValidNdkPath(const QString & ndkPath);
|
static bool isValidNdkPath(const QString & ndkPath);
|
||||||
static QString envFilePath(const QString & ndkPath, const QString& targetVersion = QString());
|
static QString envFilePath(const QString & ndkPath, const QString& targetVersion = QString());
|
||||||
static void prependQnxMapToEnvironment(const QMultiMap<QString, QString> &qnxMap, Utils::Environment &env);
|
|
||||||
static Utils::FileName executableWithExtension(const Utils::FileName &fileName);
|
static Utils::FileName executableWithExtension(const Utils::FileName &fileName);
|
||||||
static QString dataDirPath();
|
static QString dataDirPath();
|
||||||
static QString qConfigPath();
|
static QString qConfigPath();
|
||||||
@@ -73,6 +72,7 @@ public:
|
|||||||
static QList<NdkInstallInformation> installedNdks();
|
static QList<NdkInstallInformation> installedNdks();
|
||||||
static QString sdkInstallerPath(const QString& ndkPath);
|
static QString sdkInstallerPath(const QString& ndkPath);
|
||||||
static QString qdeInstallProcess(const QString& ndkPath, const QString &option, const QString &version = QString());
|
static QString qdeInstallProcess(const QString& ndkPath, const QString &option, const QString &version = QString());
|
||||||
|
static QList<Utils::EnvironmentItem> qnxEnvironment(const QString &ndk);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user