2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
|
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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
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>
|
2016-12-06 08:35:51 -05:00
|
|
|
#include <proparser/profileevaluator.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
|
|
|
|
2016-12-06 08:35:51 -05:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
namespace Qnx {
|
|
|
|
|
namespace Internal {
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2016-12-13 14:43:24 -05:00
|
|
|
static char SDP_PATH_KEY[] = "SDKPath";
|
2015-04-24 10:31:27 +02:00
|
|
|
|
2016-12-06 08:35:51 -05:00
|
|
|
QnxQtVersion::QnxQtVersion()
|
2015-04-24 10:31:27 +02:00
|
|
|
{ }
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2016-12-06 08:35:51 -05:00
|
|
|
QnxQtVersion::QnxQtVersion(const Utils::FileName &path, bool isAutoDetected,
|
2015-04-24 10:31:27 +02:00
|
|
|
const QString &autoDetectionSource) :
|
2016-12-06 08:35:51 -05:00
|
|
|
QtSupport::BaseQtVersion(path, isAutoDetected, autoDetectionSource)
|
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
|
2016-12-06 08:35:51 -05:00
|
|
|
return QCoreApplication::translate("Qnx::Internal::QnxQtVersion", "QNX %1")
|
|
|
|
|
.arg(QnxUtils::cpuDirShortDescription(cpuDir()));
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
2015-11-27 11:31:35 +01:00
|
|
|
QSet<Core::Id> QnxQtVersion::availableFeatures() const
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2015-11-27 11:31:35 +01:00
|
|
|
QSet<Core::Id> features = QtSupport::BaseQtVersion::availableFeatures();
|
|
|
|
|
features.insert(Constants::QNX_QNX_FEATURE);
|
|
|
|
|
features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE);
|
|
|
|
|
features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT);
|
2012-06-29 07:23:13 +02:00
|
|
|
return features;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-27 14:02:44 +01:00
|
|
|
QSet<Core::Id> QnxQtVersion::targetDeviceTypes() const
|
|
|
|
|
{
|
2017-02-22 15:09:35 +01:00
|
|
|
return {Constants::QNX_QNX_OS_TYPE};
|
2015-11-27 14:02:44 +01:00
|
|
|
}
|
|
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-21 17:46:47 +02:00
|
|
|
Utils::FileName QnxQtVersion::qnxTarget() const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
|
|
|
|
if (!m_environmentUpToDate)
|
|
|
|
|
updateEnvironment();
|
|
|
|
|
|
|
|
|
|
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
|
|
|
|
if (item.name == QLatin1String(Constants::QNX_TARGET_KEY))
|
2018-08-21 17:46:47 +02:00
|
|
|
return Utils::FileName::fromUserInput(item.value);
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2018-08-21 17:46:47 +02:00
|
|
|
return Utils::FileName();
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2016-12-06 08:35:51 -05:00
|
|
|
QString QnxQtVersion::cpuDir() const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
2016-12-06 08:35:51 -05:00
|
|
|
ensureMkSpecParsed();
|
|
|
|
|
return m_cpuDir;
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2016-12-06 08:35:51 -05:00
|
|
|
void QnxQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
2016-12-06 08:35:51 -05:00
|
|
|
m_cpuDir = evaluator->value(QLatin1String("QNX_CPUDIR"));
|
|
|
|
|
BaseQtVersion::parseMkSpec(evaluator);
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap QnxQtVersion::toMap() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap result = BaseQtVersion::toMap();
|
2016-12-13 14:43:24 -05:00
|
|
|
result.insert(QLatin1String(SDP_PATH_KEY), sdpPath());
|
2015-04-24 10:31:27 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QnxQtVersion::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
BaseQtVersion::fromMap(map);
|
2016-12-13 14:43:24 -05:00
|
|
|
setSdpPath(QDir::fromNativeSeparators(map.value(QLatin1String(SDP_PATH_KEY)).toString()));
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::Abi> QnxQtVersion::detectQtAbis() const
|
|
|
|
|
{
|
|
|
|
|
ensureMkSpecParsed();
|
2016-12-16 14:02:26 -05:00
|
|
|
return QnxUtils::convertAbis(qtAbisFromLibrary(qtCorePaths()));
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QnxQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
|
|
|
|
|
{
|
|
|
|
|
QtSupport::BaseQtVersion::addToEnvironment(k, env);
|
|
|
|
|
updateEnvironment();
|
|
|
|
|
env.modify(m_qnxEnv);
|
|
|
|
|
|
2017-01-23 18:18:32 +01:00
|
|
|
env.prependOrSetLibrarySearchPath(qmakeProperty("QT_INSTALL_LIBS", PropertyVariantDev));
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::Environment QnxQtVersion::qmakeRunEnvironment() const
|
|
|
|
|
{
|
2016-12-13 14:43:24 -05:00
|
|
|
if (!sdpPath().isEmpty())
|
2015-04-24 10:31:27 +02:00
|
|
|
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
|
|
|
|
|
{
|
2016-12-13 14:43:24 -05:00
|
|
|
return QtSupport::BaseQtVersion::isValid() && !sdpPath().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
|
|
|
{
|
2016-12-13 14:43:24 -05:00
|
|
|
if (sdpPath().isEmpty())
|
|
|
|
|
return QCoreApplication::translate("Qnx::Internal::QnxQtVersion",
|
|
|
|
|
"No SDP path was set up.");
|
2015-04-24 10:31:27 +02:00
|
|
|
return QtSupport::BaseQtVersion::invalidReason();
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-13 14:43:24 -05:00
|
|
|
QString QnxQtVersion::sdpPath() const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
2016-12-13 14:43:24 -05:00
|
|
|
return m_sdpPath;
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2016-12-13 14:43:24 -05:00
|
|
|
void QnxQtVersion::setSdpPath(const QString &sdpPath)
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
2016-12-13 14:43:24 -05:00
|
|
|
if (m_sdpPath == sdpPath)
|
2015-04-24 10:31:27 +02:00
|
|
|
return;
|
|
|
|
|
|
2016-12-13 14:43:24 -05:00
|
|
|
m_sdpPath = sdpPath;
|
2015-04-24 10:31:27 +02:00
|
|
|
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
|
|
|
{
|
2016-12-13 14:43:24 -05:00
|
|
|
return QnxUtils::qnxEnvironment(sdpPath());
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
2015-04-24 10:31:27 +02:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|