2013-01-09 09:23:37 -05:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
|
2013-01-09 09:23:37 -05:00
|
|
|
**
|
2013-10-11 17:44:13 +02:00
|
|
|
** Contact: BlackBerry (qt@blackberry.com)
|
2013-01-09 09:23:37 -05:00
|
|
|
** Contact: KDAB (info@kdab.com)
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
#include "blackberryapilevelconfiguration.h"
|
2014-02-13 09:47:06 +01:00
|
|
|
#include "blackberryconfigurationmanager.h"
|
2013-01-09 09:23:37 -05:00
|
|
|
#include "blackberryqtversion.h"
|
|
|
|
|
|
2013-09-09 15:47:46 +02:00
|
|
|
#include "qnxtoolchain.h"
|
2014-02-13 11:16:45 +01:00
|
|
|
#include "qnxconstants.h"
|
2013-11-21 15:43:13 +01:00
|
|
|
|
|
|
|
|
#include <utils/qtcassert.h>
|
2013-01-09 09:23:37 -05:00
|
|
|
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <projectexplorer/kitmanager.h>
|
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
2013-10-29 15:08:48 +01:00
|
|
|
#include <projectexplorer/gcctoolchain.h>
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-07-04 16:21:33 +02:00
|
|
|
#include <qtsupport/baseqtversion.h>
|
|
|
|
|
#include <qtsupport/qtversionmanager.h>
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
|
2013-10-29 16:19:24 +01:00
|
|
|
#include <qmakeprojectmanager/qmakekitinformation.h>
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-10-25 13:47:08 +02:00
|
|
|
#include <debugger/debuggeritemmanager.h>
|
2013-01-09 09:23:37 -05:00
|
|
|
#include <debugger/debuggerkitinformation.h>
|
|
|
|
|
|
2013-12-12 14:21:51 +01:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
|
2013-01-09 09:23:37 -05:00
|
|
|
#include <QFileInfo>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace QtSupport;
|
|
|
|
|
using namespace Utils;
|
2013-10-09 12:42:00 +02:00
|
|
|
using namespace Debugger;
|
2013-08-29 13:14:19 +02:00
|
|
|
|
2013-01-09 09:23:37 -05:00
|
|
|
namespace Qnx {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2013-12-05 18:24:08 +01:00
|
|
|
const QLatin1String NDKEnvFileKey("NDKEnvFile");
|
|
|
|
|
const QLatin1String NDKPathKey("NDKPath");
|
|
|
|
|
const QLatin1String NDKDisplayNameKey("NDKDisplayName");
|
|
|
|
|
const QLatin1String NDKTargetKey("NDKTarget");
|
|
|
|
|
const QLatin1String NDKHostKey("NDKHost");
|
|
|
|
|
const QLatin1String NDKVersionKey("NDKVersion");
|
|
|
|
|
const QLatin1String NDKAutoDetectionSourceKey("NDKAutoDetectionSource");
|
|
|
|
|
const QLatin1String NDKAutoDetectedKey("NDKAutoDetectedKey");
|
|
|
|
|
|
2014-02-04 15:44:18 -02:00
|
|
|
#ifdef WITH_TESTS
|
2014-02-13 11:16:45 +01:00
|
|
|
bool BlackBerryApiLevelConfiguration::m_fakeConfig = false;
|
2014-02-04 15:44:18 -02:00
|
|
|
#endif
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const NdkInstallInformation &ndkInstallInfo)
|
2013-11-21 15:43:13 +01:00
|
|
|
{
|
|
|
|
|
QString envFilePath = QnxUtils::envFilePath(ndkInstallInfo.path, ndkInstallInfo.version);
|
|
|
|
|
QTC_ASSERT(!envFilePath.isEmpty(), return);
|
|
|
|
|
m_ndkEnvFile = Utils::FileName::fromString(envFilePath);
|
|
|
|
|
m_displayName = ndkInstallInfo.name;
|
|
|
|
|
m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString());
|
|
|
|
|
QString sep = QString::fromLatin1("/qnx6");
|
|
|
|
|
// The QNX_TARGET value is using Unix-like separator on all platforms.
|
|
|
|
|
m_targetName = ndkInstallInfo.target.split(sep).first().split(QLatin1Char('/')).last();
|
|
|
|
|
m_qnxHost = ndkInstallInfo.host;
|
|
|
|
|
m_sysRoot = FileName::fromString(ndkInstallInfo.target);
|
|
|
|
|
m_version = BlackBerryVersionNumber(ndkInstallInfo.version);
|
2013-12-05 18:24:08 +01:00
|
|
|
m_autoDetectionSource = Utils::FileName::fromString(ndkInstallInfo.installationXmlFilePath);
|
2013-11-21 15:43:13 +01:00
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const FileName &ndkEnvFile)
|
2013-12-05 18:24:08 +01:00
|
|
|
: m_autoDetectionSource(Utils::FileName())
|
2013-07-01 15:09:10 +02:00
|
|
|
{
|
2013-11-21 15:43:13 +01:00
|
|
|
QTC_ASSERT(!QFileInfo(ndkEnvFile.toString()).isDir(), return);
|
2013-08-22 17:00:58 +02:00
|
|
|
m_ndkEnvFile = ndkEnvFile;
|
2013-11-21 15:43:13 +01:00
|
|
|
QString ndkPath = m_ndkEnvFile.parentDir().toString();
|
|
|
|
|
m_displayName = ndkPath.split(QDir::separator()).last();
|
2013-10-12 19:20:37 +02:00
|
|
|
m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString());
|
|
|
|
|
|
|
|
|
|
QString ndkTarget;
|
|
|
|
|
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
|
|
|
|
if (item.name == QLatin1String("QNX_TARGET"))
|
|
|
|
|
ndkTarget = item.value;
|
|
|
|
|
|
|
|
|
|
else if (item.name == QLatin1String("QNX_HOST"))
|
2013-11-11 15:44:41 +01:00
|
|
|
m_qnxHost = item.value;
|
2013-10-12 19:20:37 +02:00
|
|
|
|
|
|
|
|
}
|
2013-07-01 15:09:10 +02:00
|
|
|
|
2013-11-11 15:44:41 +01:00
|
|
|
// The QNX_TARGET value is using Unix-like separator on all platforms.
|
|
|
|
|
QString sep = QString::fromLatin1("/qnx6");
|
|
|
|
|
m_targetName = ndkTarget.split(sep).first().split(QLatin1Char('/')).last();
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-01-18 09:50:47 -05:00
|
|
|
if (QDir(ndkTarget).exists())
|
2013-08-29 13:14:19 +02:00
|
|
|
m_sysRoot = FileName::fromString(ndkTarget);
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-11-21 15:43:13 +01:00
|
|
|
m_version = BlackBerryVersionNumber::fromNdkEnvFileName(QFileInfo(m_ndkEnvFile.toString()).baseName());
|
|
|
|
|
if (m_version.isEmpty())
|
|
|
|
|
m_version = BlackBerryVersionNumber::fromTargetName(m_targetName);
|
|
|
|
|
|
|
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
BlackBerryApiLevelConfiguration::BlackBerryApiLevelConfiguration(const QVariantMap &data)
|
2013-12-05 18:24:08 +01:00
|
|
|
{
|
|
|
|
|
QString envFilePath = data.value(NDKEnvFileKey).toString();
|
|
|
|
|
QTC_ASSERT(!envFilePath.isEmpty(), return);
|
|
|
|
|
m_ndkEnvFile = Utils::FileName::fromString(envFilePath);
|
|
|
|
|
m_displayName = data.value(NDKDisplayNameKey).toString();
|
|
|
|
|
m_qnxEnv = QnxUtils::qnxEnvironmentFromNdkFile(m_ndkEnvFile.toString());
|
|
|
|
|
QString sep = QString::fromLatin1("/qnx6");
|
|
|
|
|
// The QNX_TARGET value is using Unix-like separator on all platforms.
|
|
|
|
|
m_targetName = data.value(NDKTargetKey).toString().split(sep).first().split(QLatin1Char('/')).last();
|
|
|
|
|
m_qnxHost = data.value(NDKHostKey).toString();
|
|
|
|
|
m_sysRoot = FileName::fromString(data.value(NDKTargetKey).toString());
|
|
|
|
|
m_version = BlackBerryVersionNumber(data.value(NDKVersionKey).toString());
|
|
|
|
|
if (data.value(QLatin1String(NDKAutoDetectedKey)).toBool())
|
|
|
|
|
m_autoDetectionSource = Utils::FileName::fromString(data.value(NDKAutoDetectionSourceKey).toString());
|
|
|
|
|
|
|
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
void BlackBerryApiLevelConfiguration::ctor()
|
2013-11-21 15:43:13 +01:00
|
|
|
{
|
2013-11-11 15:44:41 +01:00
|
|
|
FileName qmake4Path = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qmake")));
|
|
|
|
|
FileName qmake5Path = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qt5/qmake")));
|
|
|
|
|
FileName gccPath = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/qcc")));
|
|
|
|
|
FileName deviceGdbPath = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/ntoarm-gdb")));
|
|
|
|
|
FileName simulatorGdbPath = QnxUtils::executableWithExtension(FileName::fromString(m_qnxHost + QLatin1String("/usr/bin/ntox86-gdb")));
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
if (qmake4Path.toFileInfo().exists())
|
2013-07-04 16:21:33 +02:00
|
|
|
m_qmake4BinaryFile = qmake4Path;
|
2013-07-01 15:09:10 +02:00
|
|
|
|
|
|
|
|
if (qmake5Path.toFileInfo().exists())
|
2013-07-04 16:21:33 +02:00
|
|
|
m_qmake5BinaryFile = qmake5Path;
|
2013-01-17 16:06:13 -02:00
|
|
|
|
2013-07-04 16:21:33 +02:00
|
|
|
if (gccPath.toFileInfo().exists())
|
|
|
|
|
m_gccCompiler = gccPath;
|
2013-01-17 16:06:13 -02:00
|
|
|
|
2013-07-04 16:21:33 +02:00
|
|
|
if (deviceGdbPath.toFileInfo().exists())
|
2013-10-15 16:17:37 +02:00
|
|
|
m_deviceDebugger = deviceGdbPath;
|
2013-01-17 16:06:13 -02:00
|
|
|
|
2013-07-04 16:21:33 +02:00
|
|
|
if (simulatorGdbPath.toFileInfo().exists())
|
2013-10-15 16:17:37 +02:00
|
|
|
m_simulatorDebugger = simulatorGdbPath;
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QString BlackBerryApiLevelConfiguration::ndkPath() const
|
2013-01-17 16:06:13 -02:00
|
|
|
{
|
2013-08-22 17:00:58 +02:00
|
|
|
return m_ndkEnvFile.parentDir().toString();
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QString BlackBerryApiLevelConfiguration::displayName() const
|
2013-01-17 16:06:13 -02:00
|
|
|
{
|
2013-07-04 16:21:33 +02:00
|
|
|
return m_displayName;
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QString BlackBerryApiLevelConfiguration::targetName() const
|
2013-01-17 16:06:13 -02:00
|
|
|
{
|
2013-07-04 16:21:33 +02:00
|
|
|
return m_targetName;
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QString BlackBerryApiLevelConfiguration::qnxHost() const
|
2013-11-11 15:44:41 +01:00
|
|
|
{
|
|
|
|
|
return m_qnxHost;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
BlackBerryVersionNumber BlackBerryApiLevelConfiguration::version() const
|
2013-11-21 15:43:13 +01:00
|
|
|
{
|
|
|
|
|
return m_version;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
bool BlackBerryApiLevelConfiguration::isAutoDetected() const
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-12-05 18:24:08 +01:00
|
|
|
return !m_autoDetectionSource.isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
Utils::FileName BlackBerryApiLevelConfiguration::autoDetectionSource() const
|
2013-12-05 18:24:08 +01:00
|
|
|
{
|
|
|
|
|
return m_autoDetectionSource;
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
bool BlackBerryApiLevelConfiguration::isActive() const
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-12-10 11:19:55 +01:00
|
|
|
foreach (Kit *kit, KitManager::kits()) {
|
|
|
|
|
if (kit->isAutoDetected() &&
|
|
|
|
|
kit->autoDetectionSource() == m_ndkEnvFile.toString())
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
bool BlackBerryApiLevelConfiguration::isValid() const
|
2013-01-17 16:06:13 -02:00
|
|
|
{
|
2014-02-04 15:44:18 -02:00
|
|
|
#ifdef WITH_TESTS
|
2014-02-13 11:16:45 +01:00
|
|
|
if (BlackBerryApiLevelConfiguration::fakeConfig())
|
2014-02-04 15:44:18 -02:00
|
|
|
return true;
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-12-05 18:24:08 +01:00
|
|
|
return ((!m_qmake4BinaryFile.isEmpty() || !m_qmake5BinaryFile.isEmpty()) && !m_gccCompiler.isEmpty()
|
|
|
|
|
&& !m_deviceDebugger.isEmpty() && !m_simulatorDebugger.isEmpty()
|
|
|
|
|
&& m_ndkEnvFile.toFileInfo().exists() && (m_autoDetectionSource.isEmpty() ||
|
|
|
|
|
m_autoDetectionSource.toFileInfo().exists())
|
|
|
|
|
&& m_sysRoot.toFileInfo().exists());
|
2013-04-12 17:09:11 -03:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
FileName BlackBerryApiLevelConfiguration::ndkEnvFile() const
|
2013-08-22 17:00:58 +02:00
|
|
|
{
|
|
|
|
|
return m_ndkEnvFile;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
FileName BlackBerryApiLevelConfiguration::qmake4BinaryFile() const
|
2013-04-12 17:09:11 -03:00
|
|
|
{
|
2013-07-04 16:21:33 +02:00
|
|
|
return m_qmake4BinaryFile;
|
|
|
|
|
}
|
2013-04-12 17:09:11 -03:00
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
FileName BlackBerryApiLevelConfiguration::qmake5BinaryFile() const
|
2013-07-04 16:21:33 +02:00
|
|
|
{
|
|
|
|
|
return m_qmake5BinaryFile;
|
|
|
|
|
}
|
2013-04-12 17:09:11 -03:00
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
FileName BlackBerryApiLevelConfiguration::gccCompiler() const
|
2013-07-04 16:21:33 +02:00
|
|
|
{
|
|
|
|
|
return m_gccCompiler;
|
2013-04-12 17:09:11 -03:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
FileName BlackBerryApiLevelConfiguration::deviceDebuger() const
|
2013-04-12 17:09:11 -03:00
|
|
|
{
|
2013-10-15 16:17:37 +02:00
|
|
|
return m_deviceDebugger;
|
2013-07-04 16:21:33 +02:00
|
|
|
}
|
2013-04-12 17:09:11 -03:00
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
FileName BlackBerryApiLevelConfiguration::simulatorDebuger() const
|
2013-07-04 16:21:33 +02:00
|
|
|
{
|
2013-10-15 16:17:37 +02:00
|
|
|
return m_simulatorDebugger;
|
2013-07-04 16:21:33 +02:00
|
|
|
}
|
2013-04-12 17:09:11 -03:00
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
FileName BlackBerryApiLevelConfiguration::sysRoot() const
|
2013-07-04 16:21:33 +02:00
|
|
|
{
|
|
|
|
|
return m_sysRoot;
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QList<Utils::EnvironmentItem> BlackBerryApiLevelConfiguration::qnxEnv() const
|
2013-01-17 16:06:13 -02:00
|
|
|
{
|
2013-07-04 16:21:33 +02:00
|
|
|
return m_qnxEnv;
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QVariantMap BlackBerryApiLevelConfiguration::toMap() const
|
2013-12-05 18:24:08 +01:00
|
|
|
{
|
|
|
|
|
QVariantMap data;
|
2014-02-13 11:16:45 +01:00
|
|
|
data.insert(QLatin1String(Qnx::Constants::QNX_BB_KEY_CONFIGURATION_TYPE),
|
|
|
|
|
QLatin1String(Qnx::Constants::QNX_BB_APILEVEL_TYPE));
|
2013-12-05 18:24:08 +01:00
|
|
|
data.insert(QLatin1String(NDKEnvFileKey), m_ndkEnvFile.toString());
|
|
|
|
|
data.insert(QLatin1String(NDKDisplayNameKey), m_displayName);
|
|
|
|
|
data.insert(QLatin1String(NDKPathKey), ndkPath());
|
|
|
|
|
data.insert(QLatin1String(NDKTargetKey), m_sysRoot.toString());
|
|
|
|
|
data.insert(QLatin1String(NDKHostKey), m_qnxHost);
|
|
|
|
|
data.insert(QLatin1String(NDKVersionKey), m_version.toString());
|
|
|
|
|
data.insert(QLatin1String(NDKAutoDetectionSourceKey), m_autoDetectionSource.toString());
|
|
|
|
|
data.insert(QLatin1String(NDKAutoDetectedKey), isAutoDetected());
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QnxAbstractQtVersion *BlackBerryApiLevelConfiguration::createQtVersion(
|
2013-10-29 15:08:48 +01:00
|
|
|
const FileName &qmakePath, Qnx::QnxArchitecture arch, const QString &versionName)
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-10-15 16:17:37 +02:00
|
|
|
QnxAbstractQtVersion *version = new BlackBerryQtVersion(
|
|
|
|
|
arch, qmakePath, true, QString(), m_ndkEnvFile.toString());
|
2013-10-29 15:08:48 +01:00
|
|
|
version->setDisplayName(tr("Qt %1 for %2").arg(version->qtVersionString(), versionName));
|
|
|
|
|
QtVersionManager::addVersion(version);
|
2013-01-09 09:23:37 -05:00
|
|
|
return version;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QnxToolChain *BlackBerryApiLevelConfiguration::createToolChain(
|
2013-10-29 15:08:48 +01:00
|
|
|
ProjectExplorer::Abi abi, const QString &versionName)
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-09-09 15:47:46 +02:00
|
|
|
QnxToolChain* toolChain = new QnxToolChain(ToolChain::AutoDetection);
|
2013-10-29 15:08:48 +01:00
|
|
|
toolChain->setDisplayName(tr("QCC for %1").arg(versionName));
|
2013-10-15 16:17:37 +02:00
|
|
|
toolChain->setCompilerCommand(m_gccCompiler);
|
2013-09-09 15:47:46 +02:00
|
|
|
toolChain->setNdkPath(ndkPath());
|
2013-10-29 15:08:48 +01:00
|
|
|
if (abi.isValid())
|
|
|
|
|
toolChain->setTargetAbi(abi);
|
|
|
|
|
ToolChainManager::registerToolChain(toolChain);
|
2013-10-15 16:17:37 +02:00
|
|
|
return toolChain;
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
QVariant BlackBerryApiLevelConfiguration::createDebuggerItem(
|
2013-10-29 15:08:48 +01:00
|
|
|
QList<ProjectExplorer::Abi> abis, Qnx::QnxArchitecture arch, const QString &versionName)
|
|
|
|
|
{
|
|
|
|
|
Utils::FileName command = arch == X86 ? m_simulatorDebugger : m_deviceDebugger;
|
|
|
|
|
DebuggerItem debugger;
|
|
|
|
|
debugger.setCommand(command);
|
|
|
|
|
debugger.setEngineType(GdbEngineType);
|
|
|
|
|
debugger.setAutoDetected(true);
|
|
|
|
|
debugger.setAbis(abis);
|
|
|
|
|
debugger.setDisplayName(tr("Debugger for %1").arg(versionName));
|
|
|
|
|
return DebuggerItemManager::registerDebugger(debugger);
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
Kit *BlackBerryApiLevelConfiguration::createKit(
|
2013-10-29 15:08:48 +01:00
|
|
|
QnxAbstractQtVersion *version, QnxToolChain *toolChain, const QVariant &debuggerItemId)
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-08-29 13:14:19 +02:00
|
|
|
Kit *kit = new Kit;
|
2013-10-15 16:17:37 +02:00
|
|
|
bool isSimulator = version->architecture() == X86;
|
2013-09-25 11:38:26 +02:00
|
|
|
|
2013-10-15 16:17:37 +02:00
|
|
|
QtKitInformation::setQtVersion(kit, version);
|
|
|
|
|
ToolChainKitInformation::setToolChain(kit, toolChain);
|
2013-09-25 11:38:26 +02:00
|
|
|
|
2013-10-29 15:08:48 +01:00
|
|
|
if (debuggerItemId.isValid())
|
|
|
|
|
DebuggerKitInformation::setDebugger(kit, debuggerItemId);
|
2013-09-25 11:38:26 +02:00
|
|
|
|
2014-03-10 11:59:14 +01:00
|
|
|
if (version->qtVersion().majorVersion == 4) {
|
|
|
|
|
if (isSimulator) {
|
|
|
|
|
QmakeProjectManager::QmakeKitInformation::setMkspec(
|
|
|
|
|
kit, FileName::fromLatin1("blackberry-x86-qcc"));
|
|
|
|
|
} else {
|
|
|
|
|
QmakeProjectManager::QmakeKitInformation::setMkspec(
|
|
|
|
|
kit, FileName::fromLatin1("blackberry-armv7le-qcc"));
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_BB_OS_TYPE);
|
|
|
|
|
SysRootKitInformation::setSysRoot(kit, m_sysRoot);
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-10-29 15:08:48 +01:00
|
|
|
kit->setDisplayName(version->displayName());
|
2013-10-15 16:17:37 +02:00
|
|
|
kit->setIconPath(FileName::fromString(QLatin1String(Constants::QNX_BB_CATEGORY_ICON)));
|
|
|
|
|
|
|
|
|
|
kit->setAutoDetected(true);
|
2013-12-10 11:19:55 +01:00
|
|
|
kit->setAutoDetectionSource(m_ndkEnvFile.toString());
|
2013-10-15 16:17:37 +02:00
|
|
|
kit->setMutable(DeviceKitInformation::id(), true);
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-09-09 17:10:41 +02:00
|
|
|
kit->setSticky(QtKitInformation::id(), true);
|
|
|
|
|
kit->setSticky(ToolChainKitInformation::id(), true);
|
|
|
|
|
kit->setSticky(DeviceTypeKitInformation::id(), true);
|
|
|
|
|
kit->setSticky(SysRootKitInformation::id(), true);
|
2013-10-09 12:42:00 +02:00
|
|
|
kit->setSticky(DebuggerKitInformation::id(), true);
|
2013-10-16 11:02:37 +02:00
|
|
|
kit->setSticky(QmakeProjectManager::QmakeKitInformation::id(), true);
|
2013-10-15 16:17:37 +02:00
|
|
|
|
2013-10-29 15:08:48 +01:00
|
|
|
KitManager::registerKit(kit);
|
2013-10-15 16:17:37 +02:00
|
|
|
return kit;
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
bool BlackBerryApiLevelConfiguration::activate()
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-07-04 16:21:33 +02:00
|
|
|
if (!isValid()) {
|
2013-12-05 18:24:08 +01:00
|
|
|
if (!m_autoDetectionSource.isEmpty())
|
2013-07-04 16:21:33 +02:00
|
|
|
return false;
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-10-09 17:19:10 +02:00
|
|
|
QString errorMessage = tr("The following errors occurred while activating target: %1").arg(m_targetName);
|
2013-09-06 16:51:48 +02:00
|
|
|
if (m_qmake4BinaryFile.isEmpty() && m_qmake5BinaryFile.isEmpty())
|
2013-09-04 16:20:40 +02:00
|
|
|
errorMessage += QLatin1Char('\n') + tr("- No Qt version found.");
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-07-04 16:21:33 +02:00
|
|
|
if (m_gccCompiler.isEmpty())
|
2013-09-04 16:20:40 +02:00
|
|
|
errorMessage += QLatin1Char('\n') + tr("- No GCC compiler found.");
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-10-15 16:17:37 +02:00
|
|
|
if (m_deviceDebugger.isEmpty())
|
2013-09-04 16:20:40 +02:00
|
|
|
errorMessage += QLatin1Char('\n') + tr("- No GDB debugger found for BB10 Device.");
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-10-15 16:17:37 +02:00
|
|
|
if (!m_simulatorDebugger.isEmpty())
|
2013-09-04 16:20:40 +02:00
|
|
|
errorMessage += QLatin1Char('\n') + tr("- No GDB debugger found for BB10 Simulator.");
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-12-12 14:21:51 +01:00
|
|
|
QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Set up BB10 Configuration"),
|
2013-07-04 16:21:33 +02:00
|
|
|
errorMessage, QMessageBox::Ok);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-07-01 15:09:10 +02:00
|
|
|
|
2013-10-15 16:17:37 +02:00
|
|
|
if (isActive())
|
2013-07-04 16:21:33 +02:00
|
|
|
return true;
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-10-15 16:17:37 +02:00
|
|
|
deactivate(); // cleaning-up artifacts autodetected by old QtCreator versions
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2014-01-10 11:50:31 +01:00
|
|
|
QString armVersionName = tr("BlackBerry %1 Device").arg(m_version.toString());
|
|
|
|
|
QString x86VersionName = tr("BlackBerry %1 Simulator").arg(m_version.toString());
|
2013-10-29 15:08:48 +01:00
|
|
|
|
|
|
|
|
// create versions
|
|
|
|
|
QnxAbstractQtVersion *qt4ArmVersion = 0;
|
|
|
|
|
QnxAbstractQtVersion *qt4X86Version = 0;
|
|
|
|
|
QnxAbstractQtVersion *qt5ArmVersion = 0;
|
|
|
|
|
QnxAbstractQtVersion *qt5X86Version = 0;
|
|
|
|
|
QList<Abi> armAbis;
|
|
|
|
|
QList<Abi> x86Abis;
|
|
|
|
|
|
2013-10-15 16:17:37 +02:00
|
|
|
if (!m_qmake4BinaryFile.isEmpty()) {
|
2013-10-29 15:08:48 +01:00
|
|
|
qt4ArmVersion = createQtVersion(m_qmake4BinaryFile, Qnx::ArmLeV7, armVersionName);
|
|
|
|
|
armAbis << qt4ArmVersion->qtAbis();
|
|
|
|
|
qt4X86Version = createQtVersion(m_qmake4BinaryFile, Qnx::X86, x86VersionName);
|
|
|
|
|
x86Abis << qt4X86Version->qtAbis();
|
2013-10-15 16:17:37 +02:00
|
|
|
}
|
|
|
|
|
if (!m_qmake5BinaryFile.isEmpty()) {
|
2013-10-29 15:08:48 +01:00
|
|
|
qt5ArmVersion = createQtVersion(m_qmake5BinaryFile, Qnx::ArmLeV7, armVersionName);
|
|
|
|
|
foreach (Abi abi, qt5ArmVersion->qtAbis())
|
|
|
|
|
if (!armAbis.contains(abi))
|
|
|
|
|
armAbis << abi;
|
|
|
|
|
qt5X86Version = createQtVersion(m_qmake5BinaryFile, Qnx::X86, x86VersionName);
|
|
|
|
|
foreach (Abi abi, qt5X86Version->qtAbis())
|
|
|
|
|
if (!x86Abis.contains(abi))
|
|
|
|
|
x86Abis << abi;
|
2013-10-15 16:17:37 +02:00
|
|
|
}
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-10-29 15:08:48 +01:00
|
|
|
// create toolchains
|
|
|
|
|
QnxToolChain *armToolChain = createToolChain(
|
|
|
|
|
!armAbis.isEmpty() ? armAbis.first() : Abi(), armVersionName);
|
|
|
|
|
QnxToolChain *x86ToolChain = createToolChain(
|
|
|
|
|
!x86Abis.isEmpty() ? x86Abis.first() : Abi(), x86VersionName);
|
|
|
|
|
|
|
|
|
|
// create debuggers
|
|
|
|
|
QVariant armDebuggerItemId = createDebuggerItem(armAbis, Qnx::ArmLeV7, armVersionName);
|
|
|
|
|
QVariant x86DebuggerItemId = createDebuggerItem(x86Abis, Qnx::X86, x86VersionName);
|
|
|
|
|
|
|
|
|
|
// create kits
|
|
|
|
|
if (qt4ArmVersion)
|
|
|
|
|
createKit(qt4ArmVersion, armToolChain, armDebuggerItemId);
|
|
|
|
|
if (qt4X86Version)
|
|
|
|
|
createKit(qt4X86Version, x86ToolChain, x86DebuggerItemId);
|
|
|
|
|
if (qt5ArmVersion)
|
|
|
|
|
createKit(qt5ArmVersion, armToolChain, armDebuggerItemId);
|
|
|
|
|
if (qt5X86Version)
|
|
|
|
|
createKit(qt5X86Version, x86ToolChain, x86DebuggerItemId);
|
|
|
|
|
|
2014-02-13 09:47:06 +01:00
|
|
|
BlackBerryConfigurationManager::instance().emitSettingsChanged();
|
|
|
|
|
|
2013-07-04 16:21:33 +02:00
|
|
|
return true;
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
void BlackBerryApiLevelConfiguration::deactivate()
|
2013-10-15 16:17:37 +02:00
|
|
|
{
|
|
|
|
|
foreach (Kit *kit, KitManager::kits()) {
|
2013-12-10 11:19:55 +01:00
|
|
|
if (kit->isAutoDetected() &&
|
|
|
|
|
kit->autoDetectionSource() == ndkEnvFile().toString()) {
|
2013-10-15 16:17:37 +02:00
|
|
|
BaseQtVersion *version = QtKitInformation::qtVersion(kit);
|
2013-12-10 11:19:55 +01:00
|
|
|
ToolChain *toolChain = ToolChainKitInformation::toolChain(kit);
|
|
|
|
|
const DebuggerItem *debugger = DebuggerKitInformation::debugger(kit);
|
|
|
|
|
if (version)
|
|
|
|
|
QtVersionManager::removeVersion(version);
|
|
|
|
|
if (toolChain)
|
|
|
|
|
ToolChainManager::deregisterToolChain(toolChain);
|
|
|
|
|
if (debugger)
|
|
|
|
|
DebuggerItemManager::deregisterDebugger(debugger->id());
|
|
|
|
|
|
|
|
|
|
KitManager::deregisterKit(kit);
|
2013-07-04 16:21:33 +02:00
|
|
|
}
|
2013-10-15 16:17:37 +02:00
|
|
|
}
|
2014-02-13 09:47:06 +01:00
|
|
|
|
|
|
|
|
BlackBerryConfigurationManager::instance().emitSettingsChanged();
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2014-02-04 15:44:18 -02:00
|
|
|
#ifdef WITH_TESTS
|
2014-02-13 11:16:45 +01:00
|
|
|
void BlackBerryApiLevelConfiguration::setFakeConfig(bool fakeConfig)
|
2014-02-04 15:44:18 -02:00
|
|
|
{
|
|
|
|
|
m_fakeConfig = fakeConfig;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 11:16:45 +01:00
|
|
|
bool BlackBerryApiLevelConfiguration::fakeConfig()
|
2014-02-04 15:44:18 -02:00
|
|
|
{
|
|
|
|
|
return m_fakeConfig;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-01-09 09:23:37 -05:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|