forked from qt-creator/qt-creator
Qnx: Add support for internal 10.2 NDKs
Some changes in the new NDK 10.2 break the setup of BlackBerry 10. Main changes that the current patch covers: * Qnx environment variables are evaluated when sourcing the bbndk-env script and are no longer hard coded when istalling the NDK * The version number is appended to the bbndk-env file name. More eventual changes may come and we may need to directly parse the ndk xml descriptor file. Task-number: QTCREATORBUG-9403 Change-Id: Ie7daf7b0eaf2a49339775cacb9973062d6101afa Reviewed-by: Tobias Nätterlund <tobias.naetterlund@kdab.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
committed by
Mehdi Fekari
parent
6b2162f2a9
commit
728fe7d7c0
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QDomDocument>
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
@@ -99,6 +100,12 @@ QMultiMap<QString, QString> QnxUtils::parseEnvironmentFile(const QString &fileNa
|
|||||||
|
|
||||||
QString value = line.mid(equalIndex + 1);
|
QString value = line.mid(equalIndex + 1);
|
||||||
|
|
||||||
|
// BASE_DIR variable is evaluated when souring the bbnk-env script
|
||||||
|
// BASE_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
// We already know the NDK path so we can set the variable value
|
||||||
|
if (var == QLatin1String("BASE_DIR"))
|
||||||
|
value = QFileInfo(fileName).dir().absolutePath();
|
||||||
|
|
||||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||||
QRegExp systemVarRegExp(QLatin1String("IF NOT DEFINED ([\\w\\d]+)\\s+set ([\\w\\d]+)=([\\w\\d]+)"));
|
QRegExp systemVarRegExp(QLatin1String("IF NOT DEFINED ([\\w\\d]+)\\s+set ([\\w\\d]+)=([\\w\\d]+)"));
|
||||||
if (line.contains(systemVarRegExp)) {
|
if (line.contains(systemVarRegExp)) {
|
||||||
@@ -187,6 +194,14 @@ QString QnxUtils::envFilePath(const QString &ndkPath)
|
|||||||
else if (Utils::HostOsInfo::isAnyUnixHost())
|
else if (Utils::HostOsInfo::isAnyUnixHost())
|
||||||
envFile = ndkPath + QLatin1String("/bbndk-env.sh");
|
envFile = ndkPath + QLatin1String("/bbndk-env.sh");
|
||||||
|
|
||||||
|
if (!QFileInfo(envFile).exists()) {
|
||||||
|
QString version = ndkVersion(ndkPath);
|
||||||
|
version = version.replace(QLatin1Char('.'), QLatin1Char('_'));
|
||||||
|
if (Utils::HostOsInfo::isWindowsHost())
|
||||||
|
envFile = ndkPath + QLatin1String("/bbndk-env_") + version + QLatin1String(".bat");
|
||||||
|
else if (Utils::HostOsInfo::isAnyUnixHost())
|
||||||
|
envFile = ndkPath + QLatin1String("/bbndk-env_") + version + QLatin1String(".sh");
|
||||||
|
}
|
||||||
return envFile;
|
return envFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,3 +252,45 @@ QString QnxUtils::dataDirPath()
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QnxUtils::qConfigPath()
|
||||||
|
{
|
||||||
|
if (Utils::HostOsInfo::isMacHost() || Utils::HostOsInfo::isWindowsHost()) {
|
||||||
|
return dataDirPath() + QLatin1String("/BlackBerry Native SDK/qconfig");
|
||||||
|
} else {
|
||||||
|
return dataDirPath() + QLatin1String("/bbndk/qconfig");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QnxUtils::ndkVersion(const QString &ndkPath)
|
||||||
|
{
|
||||||
|
QString ndkConfigPath = qConfigPath();
|
||||||
|
if (!QDir(ndkConfigPath).exists())
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
QFileInfoList ndkfileList = QDir(ndkConfigPath).entryInfoList(QStringList() << QLatin1String("*.xml"),
|
||||||
|
QDir::Files, QDir::Time);
|
||||||
|
foreach (const QFileInfo &ndkFile, ndkfileList) {
|
||||||
|
QFile xmlFile(ndkFile.absoluteFilePath());
|
||||||
|
if (!xmlFile.open(QIODevice::ReadOnly))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QDomDocument doc;
|
||||||
|
if (!doc.setContent(&xmlFile)) // Skip error message
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QDomElement docElt = doc.documentElement();
|
||||||
|
if (docElt.tagName() != QLatin1String("qnxSystemDefinition"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QDomElement childElt = docElt.firstChildElement(QLatin1String("installation"));
|
||||||
|
// The file contains only one installation node
|
||||||
|
if (!childElt.isNull()) {
|
||||||
|
// The file contains only one base node
|
||||||
|
QDomElement elt = childElt.firstChildElement(QLatin1String("base"));
|
||||||
|
if (!elt.text().compare(ndkPath, Utils::HostOsInfo::fileNameCaseSensitivity()))
|
||||||
|
return childElt.firstChildElement(QLatin1String("version")).text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
@@ -58,6 +58,8 @@ public:
|
|||||||
static void prependQnxMapToEnvironment(const QMultiMap<QString, QString> &qnxMap, Utils::Environment &env);
|
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 ndkVersion(const QString& ndkPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user