2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 BlackBerry Limited. All rights reserved.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
#include "qnxqtversion.h"
|
|
|
|
|
|
|
|
|
|
#include "qnxconstants.h"
|
2022-07-11 14:22:42 +02:00
|
|
|
#include "qnxtr.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>
|
2021-09-27 14:47:00 +02:00
|
|
|
|
|
|
|
|
#include <qtsupport/qtconfigwidget.h>
|
2015-04-24 10:31:27 +02:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2021-09-27 14:47:00 +02:00
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
#include <utils/environment.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
2021-09-27 14:47:00 +02:00
|
|
|
#include <utils/pathchooser.h>
|
2012-08-23 15:53:58 +02:00
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
#include <QDir>
|
2021-09-27 14:47:00 +02:00
|
|
|
#include <QHBoxLayout>
|
2014-04-25 13:43:42 +02:00
|
|
|
|
2016-12-06 08:35:51 -05:00
|
|
|
using namespace ProjectExplorer;
|
2020-09-16 13:34:30 +02:00
|
|
|
using namespace Utils;
|
2016-12-06 08:35:51 -05:00
|
|
|
|
2022-07-21 09:19:41 +02:00
|
|
|
namespace Qnx::Internal {
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
const char SDP_PATH_KEY[] = "SDKPath";
|
|
|
|
|
|
|
|
|
|
const char QNX_TARGET_KEY[] = "QNX_TARGET";
|
|
|
|
|
const char QNX_HOST_KEY[] = "QNX_HOST";
|
|
|
|
|
const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX";
|
2015-04-24 10:31:27 +02:00
|
|
|
|
2021-09-27 14:47:00 +02:00
|
|
|
class QnxBaseQtConfigWidget : public QtSupport::QtConfigWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit QnxBaseQtConfigWidget(QnxQtVersion *version)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(version, return);
|
|
|
|
|
|
|
|
|
|
auto layout = new QHBoxLayout(this);
|
|
|
|
|
auto sdpPathChooser(new PathChooser);
|
|
|
|
|
layout->addWidget(sdpPathChooser);
|
|
|
|
|
|
|
|
|
|
sdpPathChooser->setExpectedKind(PathChooser::ExistingDirectory);
|
|
|
|
|
sdpPathChooser->setHistoryCompleter("Qnx.Sdp.History");
|
|
|
|
|
sdpPathChooser->setFilePath(version->sdpPath());
|
|
|
|
|
|
|
|
|
|
connect(sdpPathChooser, &PathChooser::rawPathChanged, [this, version, sdpPathChooser] {
|
|
|
|
|
version->setSdpPath(sdpPathChooser->filePath());
|
|
|
|
|
emit changed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2018-11-24 15:03:28 +01:00
|
|
|
QnxQtVersion::QnxQtVersion() = default;
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
QString QnxQtVersion::description() const
|
|
|
|
|
{
|
2012-08-01 15:25:05 +02:00
|
|
|
//: Qt Version is meant for QNX
|
2022-07-11 14:22:42 +02:00
|
|
|
return Tr::tr("QNX %1").arg(QnxUtils::cpuDirShortDescription(cpuDir()));
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
QSet<Id> QnxQtVersion::availableFeatures() const
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2022-01-21 16:06:36 +01:00
|
|
|
QSet<Id> features = QtSupport::QtVersion::availableFeatures();
|
2020-09-16 13:34:30 +02:00
|
|
|
features.insert(QNX_QNX_FEATURE);
|
2015-11-27 11:31:35 +01:00
|
|
|
features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE);
|
|
|
|
|
features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT);
|
2012-06-29 07:23:13 +02:00
|
|
|
return features;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
QSet<Id> QnxQtVersion::targetDeviceTypes() const
|
2015-11-27 14:02:44 +01:00
|
|
|
{
|
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();
|
|
|
|
|
|
2022-10-07 14:46:06 +02:00
|
|
|
for (const EnvironmentItem &item : std::as_const(m_qnxEnv)) {
|
2020-09-16 13:34:30 +02:00
|
|
|
if (item.name == QLatin1String(QNX_HOST_KEY))
|
2015-04-24 10:31:27 +02:00
|
|
|
return item.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
FilePath QnxQtVersion::qnxTarget() const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
|
|
|
|
if (!m_environmentUpToDate)
|
|
|
|
|
updateEnvironment();
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
for (EnvironmentItem &item : m_qnxEnv) {
|
|
|
|
|
if (item.name == QNX_TARGET_KEY)
|
|
|
|
|
return FilePath::fromUserInput(item.value);
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
return FilePath();
|
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
|
|
|
{
|
2019-11-14 10:43:57 +01:00
|
|
|
const Abis abis = qtAbis();
|
|
|
|
|
if (abis.empty())
|
|
|
|
|
return QString();
|
|
|
|
|
return QnxUtils::cpuDirFromAbi(abis.at(0));
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap QnxQtVersion::toMap() const
|
|
|
|
|
{
|
2022-01-21 16:06:36 +01:00
|
|
|
QVariantMap result = QtVersion::toMap();
|
2021-09-27 14:25:26 +02:00
|
|
|
result.insert(SDP_PATH_KEY, sdpPath().toVariant());
|
2015-04-24 10:31:27 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QnxQtVersion::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
2022-01-21 16:06:36 +01:00
|
|
|
QtVersion::fromMap(map);
|
2021-09-27 14:25:26 +02:00
|
|
|
setSdpPath(FilePath::fromVariant(map.value(SDP_PATH_KEY)));
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
Abis QnxQtVersion::detectQtAbis() const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
|
|
|
|
ensureMkSpecParsed();
|
2022-01-21 16:06:36 +01:00
|
|
|
return QnxUtils::convertAbis(QtVersion::detectQtAbis());
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
void QnxQtVersion::addToEnvironment(const Kit *k, Environment &env) const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
2022-01-21 16:06:36 +01:00
|
|
|
QtSupport::QtVersion::addToEnvironment(k, env);
|
2015-04-24 10:31:27 +02:00
|
|
|
updateEnvironment();
|
|
|
|
|
env.modify(m_qnxEnv);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-27 14:25:26 +02:00
|
|
|
void QnxQtVersion::setupQmakeRunEnvironment(Environment &env) const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
2016-12-13 14:43:24 -05:00
|
|
|
if (!sdpPath().isEmpty())
|
2015-04-24 10:31:27 +02:00
|
|
|
updateEnvironment();
|
|
|
|
|
|
|
|
|
|
env.modify(m_qnxEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtSupport::QtConfigWidget *QnxQtVersion::createConfigurationWidget() const
|
|
|
|
|
{
|
|
|
|
|
return new QnxBaseQtConfigWidget(const_cast<QnxQtVersion *>(this));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QnxQtVersion::isValid() const
|
|
|
|
|
{
|
2022-01-21 16:06:36 +01:00
|
|
|
return QtSupport::QtVersion::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())
|
2022-07-11 14:22:42 +02:00
|
|
|
return Tr::tr("No SDP path was set up.");
|
2022-01-21 16:06:36 +01:00
|
|
|
return QtSupport::QtVersion::invalidReason();
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-27 14:25:26 +02:00
|
|
|
FilePath 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
|
|
|
}
|
|
|
|
|
|
2021-09-27 14:25:26 +02:00
|
|
|
void QnxQtVersion::setSdpPath(const FilePath &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
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
EnvironmentItems 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
|
|
|
|
2019-02-14 12:29:00 +01:00
|
|
|
|
|
|
|
|
// Factory
|
|
|
|
|
|
|
|
|
|
QnxQtVersionFactory::QnxQtVersionFactory()
|
|
|
|
|
{
|
|
|
|
|
setQtVersionCreator([] { return new QnxQtVersion; });
|
|
|
|
|
setSupportedType(Constants::QNX_QNX_QT);
|
|
|
|
|
setPriority(50);
|
|
|
|
|
setRestrictionChecker([](const SetupData &setup) { return setup.isQnx; });
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-21 09:19:41 +02:00
|
|
|
} // Qnx::Internal
|