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;
|
2020-09-16 13:34:30 +02:00
|
|
|
using namespace Utils;
|
2016-12-06 08:35:51 -05:00
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
namespace Qnx {
|
|
|
|
|
namespace 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
|
|
|
|
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
|
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
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
QSet<Id> QnxQtVersion::availableFeatures() const
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2020-09-16 13:34:30 +02:00
|
|
|
QSet<Id> features = QtSupport::BaseQtVersion::availableFeatures();
|
|
|
|
|
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();
|
|
|
|
|
|
2021-02-15 10:03:57 +01:00
|
|
|
for (const EnvironmentItem &item : qAsConst(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
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
Abis QnxQtVersion::detectQtAbis() const
|
2015-04-24 10:31:27 +02:00
|
|
|
{
|
|
|
|
|
ensureMkSpecParsed();
|
2019-02-18 11:46:30 +01:00
|
|
|
return QnxUtils::convertAbis(BaseQtVersion::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
|
|
|
{
|
|
|
|
|
QtSupport::BaseQtVersion::addToEnvironment(k, env);
|
|
|
|
|
updateEnvironment();
|
|
|
|
|
env.modify(m_qnxEnv);
|
|
|
|
|
|
2019-09-30 14:34:31 +02:00
|
|
|
env.prependOrSetLibrarySearchPath(libraryPath().toString());
|
2015-04-24 10:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
Environment QnxQtVersion::qmakeRunEnvironment() 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();
|
|
|
|
|
|
2020-09-16 13:34:30 +02:00
|
|
|
Environment env = Environment::systemEnvironment();
|
2015-04-24 10:31:27 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
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; });
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-24 10:31:27 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|