2012-06-29 07:23:13 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2012 - 2014 BlackBerry Limited. All rights reserved.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2013-10-11 17:44:13 +02:00
|
|
|
** Contact: BlackBerry (qt@blackberry.com)
|
2012-06-29 07:23:13 +02:00
|
|
|
** Contact: KDAB (info@kdab.com)
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2012-06-29 07:23:13 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
#include "qnxqtversion.h"
|
|
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
#include "qnxbaseqtconfigwidget.h"
|
2012-06-29 07:23:13 +02:00
|
|
|
#include "qnxconstants.h"
|
2013-10-12 19:20:37 +02:00
|
|
|
#include "qnxutils.h"
|
|
|
|
|
|
2013-03-27 08:59:57 +01:00
|
|
|
#include <coreplugin/featureprovider.h>
|
2015-04-24 10:31:27 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
|
|
|
|
#include <utils/environment.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
|
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
#include <QDir>
|
2014-04-25 13:43:42 +02:00
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
namespace Qnx {
|
|
|
|
|
namespace Internal {
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
static char SDK_PATH_KEY[] = "SDKPath";
|
|
|
|
|
static char ARCH_KEY[] = "Arch";
|
|
|
|
|
|
|
|
|
|
QnxQtVersion::QnxQtVersion() : m_arch(UnknownArch)
|
|
|
|
|
{ }
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
QnxQtVersion::QnxQtVersion(QnxArchitecture arch, const Utils::FileName &path, bool isAutoDetected,
|
|
|
|
|
const QString &autoDetectionSource) :
|
|
|
|
|
QtSupport::BaseQtVersion(path, isAutoDetected, autoDetectionSource),
|
|
|
|
|
m_arch(arch)
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2014-08-27 11:14:29 +02:00
|
|
|
setUnexpandedDisplayName(defaultUnexpandedDisplayName(path, false));
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QnxQtVersion *QnxQtVersion::clone() const
|
|
|
|
|
{
|
|
|
|
|
return new QnxQtVersion(*this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxQtVersion::type() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String(Constants::QNX_QNX_QT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxQtVersion::description() const
|
|
|
|
|
{
|
2012-08-01 15:25:05 +02:00
|
|
|
//: Qt Version is meant for QNX
|
2015-04-24 10:31:27 +02:00
|
|
|
return QCoreApplication::translate("Qnx::Internal::QnxQtVersion", "QNX %1").arg(archString());
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Core::FeatureSet QnxQtVersion::availableFeatures() const
|
|
|
|
|
{
|
2015-04-24 10:31:27 +02:00
|
|
|
Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures();
|
2012-06-29 07:23:13 +02:00
|
|
|
features |= Core::FeatureSet(Constants::QNX_QNX_FEATURE);
|
2014-04-25 13:43:42 +02:00
|
|
|
features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE));
|
|
|
|
|
features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_WEBKIT));
|
2012-06-29 07:23:13 +02:00
|
|
|
return features;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxQtVersion::platformName() const
|
|
|
|
|
{
|
|
|
|
|
return QString::fromLatin1(Constants::QNX_QNX_PLATFORM_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxQtVersion::platformDisplayName() const
|
|
|
|
|
{
|
2015-04-24 10:31:27 +02:00
|
|
|
return QCoreApplication::translate("Qnx::Internal::QnxQtVersion", "QNX");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxQtVersion::qnxHost() const
|
|
|
|
|
{
|
|
|
|
|
if (!m_environmentUpToDate)
|
|
|
|
|
updateEnvironment();
|
|
|
|
|
|
|
|
|
|
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
|
|
|
|
if (item.name == QLatin1String(Constants::QNX_HOST_KEY))
|
|
|
|
|
return item.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxQtVersion::qnxTarget() const
|
|
|
|
|
{
|
|
|
|
|
if (!m_environmentUpToDate)
|
|
|
|
|
updateEnvironment();
|
|
|
|
|
|
|
|
|
|
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
|
|
|
|
if (item.name == QLatin1String(Constants::QNX_TARGET_KEY))
|
|
|
|
|
return item.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QnxArchitecture QnxQtVersion::architecture() const
|
|
|
|
|
{
|
|
|
|
|
return m_arch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxQtVersion::archString() const
|
|
|
|
|
{
|
|
|
|
|
switch (m_arch) {
|
|
|
|
|
case X86:
|
|
|
|
|
return QLatin1String("x86");
|
|
|
|
|
case ArmLeV7:
|
|
|
|
|
return QLatin1String("ARMle-v7");
|
|
|
|
|
case UnknownArch:
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap QnxQtVersion::toMap() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap result = BaseQtVersion::toMap();
|
|
|
|
|
result.insert(QLatin1String(SDK_PATH_KEY), sdkPath());
|
|
|
|
|
result.insert(QLatin1String(ARCH_KEY), m_arch);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QnxQtVersion::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
BaseQtVersion::fromMap(map);
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
ensureMkSpecParsed();
|
|
|
|
|
return qtAbisFromLibrary(qtCorePaths(versionInfo(), qtVersionString()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QnxQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
|
|
|
|
|
{
|
|
|
|
|
QtSupport::BaseQtVersion::addToEnvironment(k, env);
|
|
|
|
|
updateEnvironment();
|
|
|
|
|
env.modify(m_qnxEnv);
|
|
|
|
|
|
|
|
|
|
env.prependOrSetLibrarySearchPath(versionInfo().value(QLatin1String("QT_INSTALL_LIBS")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::Environment QnxQtVersion::qmakeRunEnvironment() const
|
|
|
|
|
{
|
|
|
|
|
if (!sdkPath().isEmpty())
|
|
|
|
|
updateEnvironment();
|
|
|
|
|
|
|
|
|
|
Utils::Environment env = Utils::Environment::systemEnvironment();
|
|
|
|
|
env.modify(m_qnxEnv);
|
|
|
|
|
|
|
|
|
|
return env;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtSupport::QtConfigWidget *QnxQtVersion::createConfigurationWidget() const
|
|
|
|
|
{
|
|
|
|
|
return new QnxBaseQtConfigWidget(const_cast<QnxQtVersion *>(this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QnxQtVersion::isValid() const
|
|
|
|
|
{
|
|
|
|
|
return QtSupport::BaseQtVersion::isValid() && !sdkPath().isEmpty();
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
QString QnxQtVersion::invalidReason() const
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2015-04-24 10:31:27 +02:00
|
|
|
if (sdkPath().isEmpty())
|
|
|
|
|
return QCoreApplication::translate("Qnx::Internal::QnxQtVersion", "No SDK path was set up");
|
|
|
|
|
return QtSupport::BaseQtVersion::invalidReason();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxQtVersion::sdkPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_sdkPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QnxQtVersion::setSdkPath(const QString &sdkPath)
|
|
|
|
|
{
|
|
|
|
|
if (m_sdkPath == sdkPath)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_sdkPath = sdkPath;
|
|
|
|
|
m_environmentUpToDate = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QnxQtVersion::updateEnvironment() const
|
|
|
|
|
{
|
|
|
|
|
if (!m_environmentUpToDate) {
|
|
|
|
|
m_qnxEnv = environment();
|
|
|
|
|
m_environmentUpToDate = true;
|
|
|
|
|
}
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-12 19:20:37 +02:00
|
|
|
QList<Utils::EnvironmentItem> QnxQtVersion::environment() const
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2013-10-12 19:20:37 +02:00
|
|
|
return QnxUtils::qnxEnvironment(sdkPath());
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
2015-04-24 10:31:27 +02:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|