forked from qt-creator/qt-creator
McuSupport: plugin code formatting
Change-Id: I561bd66431ff3da7819bb9b2ff780197b5593708 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -64,21 +64,24 @@ Tasks McuDependenciesKitAspect::validate(const Kit *k) const
|
|||||||
|
|
||||||
const QVariant checkFormat = k->value(McuDependenciesKitAspect::id());
|
const QVariant checkFormat = k->value(McuDependenciesKitAspect::id());
|
||||||
if (!checkFormat.isNull() && !checkFormat.canConvert(QVariant::List))
|
if (!checkFormat.isNull() && !checkFormat.canConvert(QVariant::List))
|
||||||
return { BuildSystemTask(Task::Error, tr("The MCU dependencies setting value is invalid.")) };
|
return {BuildSystemTask(Task::Error, tr("The MCU dependencies setting value is invalid."))};
|
||||||
|
|
||||||
const QVariant envStringList = k->value(EnvironmentKitAspect::id());
|
const QVariant envStringList = k->value(EnvironmentKitAspect::id());
|
||||||
if (!envStringList.isNull() && !envStringList.canConvert(QVariant::List))
|
if (!envStringList.isNull() && !envStringList.canConvert(QVariant::List))
|
||||||
return { BuildSystemTask(Task::Error, tr("The environment setting value is invalid.")) };
|
return {BuildSystemTask(Task::Error, tr("The environment setting value is invalid."))};
|
||||||
|
|
||||||
const auto environment = Utils::NameValueDictionary(envStringList.toStringList());
|
const auto environment = Utils::NameValueDictionary(envStringList.toStringList());
|
||||||
for (const auto &dependency: dependencies(k)) {
|
for (const auto &dependency : dependencies(k)) {
|
||||||
if (!environment.hasKey(dependency.name)) {
|
if (!environment.hasKey(dependency.name)) {
|
||||||
result << BuildSystemTask(Task::Warning, tr("Environment variable %1 not defined.").arg(dependency.name));
|
result << BuildSystemTask(Task::Warning,
|
||||||
|
tr("Environment variable %1 not defined.")
|
||||||
|
.arg(dependency.name));
|
||||||
} else {
|
} else {
|
||||||
const auto path = Utils::FilePath::fromUserInput(
|
const auto path = Utils::FilePath::fromUserInput(environment.value(dependency.name)
|
||||||
environment.value(dependency.name) + "/" + dependency.value);
|
+ "/" + dependency.value);
|
||||||
if (!path.exists()) {
|
if (!path.exists()) {
|
||||||
result << BuildSystemTask(Task::Warning, tr("%1 not found.").arg(path.toUserOutput()));
|
result << BuildSystemTask(Task::Warning,
|
||||||
|
tr("%1 not found.").arg(path.toUserOutput()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +91,7 @@ Tasks McuDependenciesKitAspect::validate(const Kit *k) const
|
|||||||
|
|
||||||
void McuDependenciesKitAspect::fix(Kit *k)
|
void McuDependenciesKitAspect::fix(Kit *k)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(k, return);
|
QTC_ASSERT(k, return );
|
||||||
|
|
||||||
const QVariant variant = k->value(McuDependenciesKitAspect::id());
|
const QVariant variant = k->value(McuDependenciesKitAspect::id());
|
||||||
if (!variant.isNull() && !variant.canConvert(QVariant::List)) {
|
if (!variant.isNull() && !variant.canConvert(QVariant::List)) {
|
||||||
@@ -115,18 +118,19 @@ Utils::Id McuDependenciesKitAspect::id()
|
|||||||
return "PE.Profile.McuDependencies";
|
return "PE.Profile.McuDependencies";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Utils::NameValueItems McuDependenciesKitAspect::dependencies(const Kit *k)
|
Utils::NameValueItems McuDependenciesKitAspect::dependencies(const Kit *k)
|
||||||
{
|
{
|
||||||
if (k)
|
if (k)
|
||||||
return Utils::NameValueItem::fromStringList(k->value(McuDependenciesKitAspect::id()).toStringList());
|
return Utils::NameValueItem::fromStringList(
|
||||||
return Utils::NameValueItems();
|
k->value(McuDependenciesKitAspect::id()).toStringList());
|
||||||
|
return Utils::NameValueItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void McuDependenciesKitAspect::setDependencies(Kit *k, const Utils::NameValueItems &dependencies)
|
void McuDependenciesKitAspect::setDependencies(Kit *k, const Utils::NameValueItems &dependencies)
|
||||||
{
|
{
|
||||||
if (k)
|
if (k)
|
||||||
k->setValue(McuDependenciesKitAspect::id(), Utils::NameValueItem::toStringList(dependencies));
|
k->setValue(McuDependenciesKitAspect::id(),
|
||||||
|
Utils::NameValueItem::toStringList(dependencies));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -44,15 +44,18 @@ namespace Internal {
|
|||||||
static bool automaticKitCreationFromSettings(QSettings::Scope scope = QSettings::UserScope)
|
static bool automaticKitCreationFromSettings(QSettings::Scope scope = QSettings::UserScope)
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::settings(scope);
|
QSettings *settings = Core::ICore::settings(scope);
|
||||||
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/' +
|
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/'
|
||||||
QLatin1String(Constants::SETTINGS_KEY_AUTOMATIC_KIT_CREATION);
|
+ QLatin1String(Constants::SETTINGS_KEY_AUTOMATIC_KIT_CREATION);
|
||||||
bool automaticKitCreation = settings->value(key, true).toBool();
|
bool automaticKitCreation = settings->value(key, true).toBool();
|
||||||
return automaticKitCreation;
|
return automaticKitCreation;
|
||||||
}
|
}
|
||||||
|
|
||||||
McuPackage::McuPackage(const QString &label, const FilePath &defaultPath,
|
McuPackage::McuPackage(const QString &label,
|
||||||
const QString &detectionPath, const QString &settingsKey,
|
const FilePath &defaultPath,
|
||||||
const QString &envVarName, const QString &downloadUrl,
|
const QString &detectionPath,
|
||||||
|
const QString &settingsKey,
|
||||||
|
const QString &envVarName,
|
||||||
|
const QString &downloadUrl,
|
||||||
const McuPackageVersionDetector *versionDetector)
|
const McuPackageVersionDetector *versionDetector)
|
||||||
: m_label(label)
|
: m_label(label)
|
||||||
, m_defaultPath(Sdk::packagePathFromSettings(settingsKey, QSettings::SystemScope, defaultPath))
|
, m_defaultPath(Sdk::packagePathFromSettings(settingsKey, QSettings::SystemScope, defaultPath))
|
||||||
@@ -98,8 +101,7 @@ QWidget *McuPackage::widget()
|
|||||||
|
|
||||||
m_widget = new QWidget;
|
m_widget = new QWidget;
|
||||||
m_fileChooser = new PathChooser;
|
m_fileChooser = new PathChooser;
|
||||||
m_fileChooser->lineEdit()->setButtonIcon(FancyLineEdit::Right,
|
m_fileChooser->lineEdit()->setButtonIcon(FancyLineEdit::Right, Icons::RESET.icon());
|
||||||
Icons::RESET.icon());
|
|
||||||
m_fileChooser->lineEdit()->setButtonVisible(FancyLineEdit::Right, true);
|
m_fileChooser->lineEdit()->setButtonVisible(FancyLineEdit::Right, true);
|
||||||
connect(m_fileChooser->lineEdit(), &FancyLineEdit::rightButtonClicked, this, [&] {
|
connect(m_fileChooser->lineEdit(), &FancyLineEdit::rightButtonClicked, this, [&] {
|
||||||
m_fileChooser->setFilePath(m_defaultPath);
|
m_fileChooser->setFilePath(m_defaultPath);
|
||||||
@@ -124,9 +126,7 @@ QWidget *McuPackage::widget()
|
|||||||
|
|
||||||
m_fileChooser->setFilePath(m_path);
|
m_fileChooser->setFilePath(m_path);
|
||||||
|
|
||||||
QObject::connect(this, &McuPackage::statusChanged, this, [this] {
|
QObject::connect(this, &McuPackage::statusChanged, this, [this] { updateStatusUi(); });
|
||||||
updateStatusUi();
|
|
||||||
});
|
|
||||||
|
|
||||||
QObject::connect(m_fileChooser, &PathChooser::pathChanged, this, [this] {
|
QObject::connect(m_fileChooser, &PathChooser::pathChanged, this, [this] {
|
||||||
updatePath();
|
updatePath();
|
||||||
@@ -144,7 +144,8 @@ McuPackage::Status McuPackage::status() const
|
|||||||
|
|
||||||
bool McuPackage::validStatus() const
|
bool McuPackage::validStatus() const
|
||||||
{
|
{
|
||||||
return m_status == McuPackage::ValidPackage || m_status == McuPackage::ValidPackageMismatchedVersion;
|
return m_status == McuPackage::ValidPackage
|
||||||
|
|| m_status == McuPackage::ValidPackageMismatchedVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &McuPackage::environmentVariableName() const
|
const QString &McuPackage::environmentVariableName() const
|
||||||
@@ -164,17 +165,19 @@ bool McuPackage::addToPath() const
|
|||||||
|
|
||||||
void McuPackage::writeGeneralSettings() const
|
void McuPackage::writeGeneralSettings() const
|
||||||
{
|
{
|
||||||
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/' +
|
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/'
|
||||||
QLatin1String(Constants::SETTINGS_KEY_AUTOMATIC_KIT_CREATION);
|
+ QLatin1String(Constants::SETTINGS_KEY_AUTOMATIC_KIT_CREATION);
|
||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
settings->setValue(key, m_automaticKitCreation);
|
settings->setValue(key, m_automaticKitCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool McuPackage::writeToSettings() const
|
bool McuPackage::writeToSettings() const
|
||||||
{
|
{
|
||||||
const FilePath savedPath = Sdk::packagePathFromSettings(m_settingsKey, QSettings::UserScope, m_defaultPath);
|
const FilePath savedPath = Sdk::packagePathFromSettings(m_settingsKey,
|
||||||
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/' +
|
QSettings::UserScope,
|
||||||
QLatin1String(Constants::SETTINGS_KEY_PACKAGE_PREFIX) + m_settingsKey;
|
m_defaultPath);
|
||||||
|
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/'
|
||||||
|
+ QLatin1String(Constants::SETTINGS_KEY_PACKAGE_PREFIX) + m_settingsKey;
|
||||||
Core::ICore::settings()->setValueWithDefault(key, m_path.toString(), m_defaultPath.toString());
|
Core::ICore::settings()->setValueWithDefault(key, m_path.toString(), m_defaultPath.toString());
|
||||||
|
|
||||||
return savedPath != m_path;
|
return savedPath != m_path;
|
||||||
@@ -202,9 +205,9 @@ void McuPackage::setAutomaticKitCreationEnabled(const bool enabled)
|
|||||||
|
|
||||||
void McuPackage::updatePath()
|
void McuPackage::updatePath()
|
||||||
{
|
{
|
||||||
m_path = m_fileChooser->rawFilePath();
|
m_path = m_fileChooser->rawFilePath();
|
||||||
m_fileChooser->lineEdit()->button(FancyLineEdit::Right)->setEnabled(m_path != m_defaultPath);
|
m_fileChooser->lineEdit()->button(FancyLineEdit::Right)->setEnabled(m_path != m_defaultPath);
|
||||||
updateStatus();
|
updateStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void McuPackage::updateStatus()
|
void McuPackage::updateStatus()
|
||||||
@@ -213,15 +216,16 @@ void McuPackage::updateStatus()
|
|||||||
const FilePath detectionPath = basePath() / m_detectionPath;
|
const FilePath detectionPath = basePath() / m_detectionPath;
|
||||||
const bool validPackage = m_detectionPath.isEmpty() || detectionPath.exists();
|
const bool validPackage = m_detectionPath.isEmpty() || detectionPath.exists();
|
||||||
m_detectedVersion = validPath && validPackage && m_versionDetector
|
m_detectedVersion = validPath && validPackage && m_versionDetector
|
||||||
? m_versionDetector->parseVersion(basePath().toString()) : QString();
|
? m_versionDetector->parseVersion(basePath().toString())
|
||||||
const bool validVersion = m_detectedVersion.isEmpty() ||
|
: QString();
|
||||||
m_versions.isEmpty() || m_versions.contains(m_detectedVersion);
|
const bool validVersion = m_detectedVersion.isEmpty() || m_versions.isEmpty()
|
||||||
|
|| m_versions.contains(m_detectedVersion);
|
||||||
|
|
||||||
m_status = validPath ?
|
m_status = validPath
|
||||||
( validPackage ?
|
? (validPackage ? (validVersion ? ValidPackage : ValidPackageMismatchedVersion)
|
||||||
(validVersion ? ValidPackage : ValidPackageMismatchedVersion)
|
: ValidPathInvalidPackage)
|
||||||
: ValidPathInvalidPackage )
|
: m_path.isEmpty() ? EmptyPath
|
||||||
: m_path.isEmpty() ? EmptyPath : InvalidPath;
|
: InvalidPath;
|
||||||
|
|
||||||
emit statusChanged();
|
emit statusChanged();
|
||||||
}
|
}
|
||||||
@@ -229,9 +233,15 @@ void McuPackage::updateStatus()
|
|||||||
void McuPackage::updateStatusUi()
|
void McuPackage::updateStatusUi()
|
||||||
{
|
{
|
||||||
switch (m_status) {
|
switch (m_status) {
|
||||||
case ValidPackage: m_infoLabel->setType(InfoLabel::Ok); break;
|
case ValidPackage:
|
||||||
case ValidPackageMismatchedVersion: m_infoLabel->setType(InfoLabel::Warning); break;
|
m_infoLabel->setType(InfoLabel::Ok);
|
||||||
default: m_infoLabel->setType(InfoLabel::NotOk); break;
|
break;
|
||||||
|
case ValidPackageMismatchedVersion:
|
||||||
|
m_infoLabel->setType(InfoLabel::Warning);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_infoLabel->setType(InfoLabel::NotOk);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
m_infoLabel->setText(statusText());
|
m_infoLabel->setText(statusText());
|
||||||
}
|
}
|
||||||
@@ -241,44 +251,45 @@ QString McuPackage::statusText() const
|
|||||||
const QString displayPackagePath = m_path.toUserOutput();
|
const QString displayPackagePath = m_path.toUserOutput();
|
||||||
const QString displayVersions = m_versions.join(" or ");
|
const QString displayVersions = m_versions.join(" or ");
|
||||||
const QString outDetectionPath = FilePath::fromString(m_detectionPath).toUserOutput();
|
const QString outDetectionPath = FilePath::fromString(m_detectionPath).toUserOutput();
|
||||||
const QString displayRequiredPath = m_versions.empty() ?
|
const QString displayRequiredPath = m_versions.empty() ? outDetectionPath
|
||||||
outDetectionPath :
|
: QString("%1 %2").arg(outDetectionPath,
|
||||||
QString("%1 %2").arg(outDetectionPath, displayVersions);
|
displayVersions);
|
||||||
const QString displayDetectedPath = m_versions.empty() ?
|
const QString displayDetectedPath = m_versions.empty()
|
||||||
outDetectionPath :
|
? outDetectionPath
|
||||||
QString("%1 %2").arg(outDetectionPath, m_detectedVersion);
|
: QString("%1 %2").arg(outDetectionPath,
|
||||||
|
m_detectedVersion);
|
||||||
|
|
||||||
QString response;
|
QString response;
|
||||||
switch (m_status) {
|
switch (m_status) {
|
||||||
case ValidPackage:
|
case ValidPackage:
|
||||||
response = m_detectionPath.isEmpty()
|
response = m_detectionPath.isEmpty()
|
||||||
? ( m_detectedVersion.isEmpty()
|
? (m_detectedVersion.isEmpty()
|
||||||
? tr("Path %1 exists.").arg(displayPackagePath)
|
? tr("Path %1 exists.").arg(displayPackagePath)
|
||||||
: tr("Path %1 exists. Version %2 was found.")
|
: tr("Path %1 exists. Version %2 was found.")
|
||||||
.arg(displayPackagePath, m_detectedVersion) )
|
.arg(displayPackagePath, m_detectedVersion))
|
||||||
: tr("Path %1 is valid, %2 was found.")
|
: tr("Path %1 is valid, %2 was found.")
|
||||||
.arg(displayPackagePath, displayDetectedPath);
|
.arg(displayPackagePath, displayDetectedPath);
|
||||||
break;
|
break;
|
||||||
case ValidPackageMismatchedVersion: {
|
case ValidPackageMismatchedVersion: {
|
||||||
const QString versionWarning = m_versions.size() == 1 ?
|
const QString versionWarning
|
||||||
tr("but only version %1 is supported").arg(m_versions.first()) :
|
= m_versions.size() == 1
|
||||||
tr("but only versions %1 are supported").arg(displayVersions);
|
? tr("but only version %1 is supported").arg(m_versions.first())
|
||||||
|
: tr("but only versions %1 are supported").arg(displayVersions);
|
||||||
response = tr("Path %1 is valid, %2 was found, %3.")
|
response = tr("Path %1 is valid, %2 was found, %3.")
|
||||||
.arg(displayPackagePath, displayDetectedPath, versionWarning);
|
.arg(displayPackagePath, displayDetectedPath, versionWarning);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ValidPathInvalidPackage:
|
case ValidPathInvalidPackage:
|
||||||
response = tr("Path %1 exists, but does not contain %2.")
|
response = tr("Path %1 exists, but does not contain %2.")
|
||||||
.arg(displayPackagePath, displayRequiredPath);
|
.arg(displayPackagePath, displayRequiredPath);
|
||||||
break;
|
break;
|
||||||
case InvalidPath:
|
case InvalidPath:
|
||||||
response = tr("Path %1 does not exist.").arg(displayPackagePath);
|
response = tr("Path %1 does not exist.").arg(displayPackagePath);
|
||||||
break;
|
break;
|
||||||
case EmptyPath:
|
case EmptyPath:
|
||||||
response = m_detectionPath.isEmpty()
|
response = m_detectionPath.isEmpty()
|
||||||
? tr("Path is empty.")
|
? tr("Path is empty.")
|
||||||
: tr("Path is empty, %1 not found.")
|
: tr("Path is empty, %1 not found.").arg(displayRequiredPath);
|
||||||
.arg(displayRequiredPath);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
@@ -288,12 +299,12 @@ McuToolChainPackage::McuToolChainPackage(const QString &label,
|
|||||||
const FilePath &defaultPath,
|
const FilePath &defaultPath,
|
||||||
const QString &detectionPath,
|
const QString &detectionPath,
|
||||||
const QString &settingsKey,
|
const QString &settingsKey,
|
||||||
McuToolChainPackage::Type type, const QString &envVarName,
|
McuToolChainPackage::Type type,
|
||||||
|
const QString &envVarName,
|
||||||
const McuPackageVersionDetector *versionDetector)
|
const McuPackageVersionDetector *versionDetector)
|
||||||
: McuPackage(label, defaultPath, detectionPath, settingsKey, envVarName, {}, versionDetector)
|
: McuPackage(label, defaultPath, detectionPath, settingsKey, envVarName, {}, versionDetector)
|
||||||
, m_type(type)
|
, m_type(type)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
McuToolChainPackage::Type McuToolChainPackage::type() const
|
McuToolChainPackage::Type McuToolChainPackage::type() const
|
||||||
{
|
{
|
||||||
|
@@ -59,9 +59,12 @@ public:
|
|||||||
ValidPackage
|
ValidPackage
|
||||||
};
|
};
|
||||||
|
|
||||||
McuPackage(const QString &label, const Utils::FilePath &defaultPath,
|
McuPackage(const QString &label,
|
||||||
const QString &detectionPath, const QString &settingsKey,
|
const Utils::FilePath &defaultPath,
|
||||||
const QString &envVarName = {}, const QString &downloadUrl = {},
|
const QString &detectionPath,
|
||||||
|
const QString &settingsKey,
|
||||||
|
const QString &envVarName = {},
|
||||||
|
const QString &downloadUrl = {},
|
||||||
const McuPackageVersionDetector *versionDetector = nullptr);
|
const McuPackageVersionDetector *versionDetector = nullptr);
|
||||||
virtual ~McuPackage() = default;
|
virtual ~McuPackage() = default;
|
||||||
|
|
||||||
@@ -122,16 +125,7 @@ private:
|
|||||||
class McuToolChainPackage : public McuPackage
|
class McuToolChainPackage : public McuPackage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type { IAR, KEIL, MSVC, GCC, ArmGcc, GHS, GHSArm, Unsupported };
|
||||||
IAR,
|
|
||||||
KEIL,
|
|
||||||
MSVC,
|
|
||||||
GCC,
|
|
||||||
ArmGcc,
|
|
||||||
GHS,
|
|
||||||
GHSArm,
|
|
||||||
Unsupported
|
|
||||||
};
|
|
||||||
|
|
||||||
McuToolChainPackage(const QString &label,
|
McuToolChainPackage(const QString &label,
|
||||||
const Utils::FilePath &defaultPath,
|
const Utils::FilePath &defaultPath,
|
||||||
@@ -139,8 +133,7 @@ public:
|
|||||||
const QString &settingsKey,
|
const QString &settingsKey,
|
||||||
Type type,
|
Type type,
|
||||||
const QString &envVarName = {},
|
const QString &envVarName = {},
|
||||||
const McuPackageVersionDetector *versionDetector = nullptr
|
const McuPackageVersionDetector *versionDetector = nullptr);
|
||||||
);
|
|
||||||
|
|
||||||
Type type() const;
|
Type type() const;
|
||||||
bool isDesktopToolchain() const;
|
bool isDesktopToolchain() const;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#if defined(MCUSUPPORT_LIBRARY)
|
#if defined(MCUSUPPORT_LIBRARY)
|
||||||
# define MCUSUPPORTSHARED_EXPORT Q_DECL_EXPORT
|
#define MCUSUPPORTSHARED_EXPORT Q_DECL_EXPORT
|
||||||
#else
|
#else
|
||||||
# define MCUSUPPORTSHARED_EXPORT Q_DECL_IMPORT
|
#define MCUSUPPORTSHARED_EXPORT Q_DECL_IMPORT
|
||||||
#endif
|
#endif
|
||||||
|
@@ -31,15 +31,15 @@ namespace {
|
|||||||
static const QHash<QString, QString> &envVarToCMakeVarMapping()
|
static const QHash<QString, QString> &envVarToCMakeVarMapping()
|
||||||
{
|
{
|
||||||
static const QHash<QString, QString> mapping = {
|
static const QHash<QString, QString> mapping = {
|
||||||
{"EVK_MIMXRT1060_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"EVK_MIMXRT1060_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"EVK_MIMXRT1064_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"EVK_MIMXRT1064_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"EVK_MIMXRT595_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"EVK_MIMXRT595_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"EVK_MIMXRT1170_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"EVK_MIMXRT1170_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"EVKB_IMXRT1050_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"EVKB_IMXRT1050_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"STM32Cube_FW_F7_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"STM32Cube_FW_F7_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"STM32Cube_FW_F4_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"STM32Cube_FW_F4_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"STM32Cube_FW_L4_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"STM32Cube_FW_L4_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"STM32Cube_FW_H7_SDK_PATH","QUL_BOARD_SDK_DIR"},
|
{"STM32Cube_FW_H7_SDK_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
{"RGL_DIR", "QUL_BOARD_SDK_DIR"},
|
{"RGL_DIR", "QUL_BOARD_SDK_DIR"},
|
||||||
{"TVII_GRAPHICS_DRIVER_DIR", "QUL_BOARD_SDK_DIR"},
|
{"TVII_GRAPHICS_DRIVER_DIR", "QUL_BOARD_SDK_DIR"},
|
||||||
{"EK_RA6M3G_FSP_PATH", "QUL_BOARD_SDK_DIR"},
|
{"EK_RA6M3G_FSP_PATH", "QUL_BOARD_SDK_DIR"},
|
||||||
@@ -47,12 +47,12 @@ static const QHash<QString, QString> &envVarToCMakeVarMapping()
|
|||||||
{"IAR_ARM_COMPILER_DIR", "QUL_TARGET_TOOLCHAIN_DIR"},
|
{"IAR_ARM_COMPILER_DIR", "QUL_TARGET_TOOLCHAIN_DIR"},
|
||||||
{"GHS_COMPILER_DIR", "QUL_TARGET_TOOLCHAIN_DIR"},
|
{"GHS_COMPILER_DIR", "QUL_TARGET_TOOLCHAIN_DIR"},
|
||||||
{"GHS_ARM_COMPILER_DIR", "QUL_TARGET_TOOLCHAIN_DIR"},
|
{"GHS_ARM_COMPILER_DIR", "QUL_TARGET_TOOLCHAIN_DIR"},
|
||||||
{"EVK_MIMXRT1170_FREERTOS_PATH","FREERTOS_DIR"},
|
{"EVK_MIMXRT1170_FREERTOS_PATH", "FREERTOS_DIR"},
|
||||||
{"IMXRT1050_FREERTOS_DIR","FREERTOS_DIR"},
|
{"IMXRT1050_FREERTOS_DIR", "FREERTOS_DIR"},
|
||||||
{"IMXRT1064_FREERTOS_DIR","FREERTOS_DIR"},
|
{"IMXRT1064_FREERTOS_DIR", "FREERTOS_DIR"},
|
||||||
{"IMXRT595_FREERTOS_DIR","FREERTOS_DIR"},
|
{"IMXRT595_FREERTOS_DIR", "FREERTOS_DIR"},
|
||||||
{"STM32F7_FREERTOS_DIR", "FREERTOS_DIR"},
|
{"STM32F7_FREERTOS_DIR", "FREERTOS_DIR"},
|
||||||
{"eFlashLoad_PATH","eFlashLoad_PATH"},
|
{"eFlashLoad_PATH", "eFlashLoad_PATH"},
|
||||||
{"RenesasFlashProgrammer_PATH", "RENESAS_FLASH_PROGRAMMER_PATH"},
|
{"RenesasFlashProgrammer_PATH", "RENESAS_FLASH_PROGRAMMER_PATH"},
|
||||||
{"MCUXpressoIDE_PATH", "MCUXPRESSO_IDE_PATH"},
|
{"MCUXpressoIDE_PATH", "MCUXPRESSO_IDE_PATH"},
|
||||||
{"JLINK_PATH", "JLINK_PATH"},
|
{"JLINK_PATH", "JLINK_PATH"},
|
||||||
@@ -67,9 +67,11 @@ QList<CMakeProjectManager::CMakeConfigItem> McuSupport::Internal::mapEnvVarsToQu
|
|||||||
const Utils::EnvironmentItems &envVars)
|
const Utils::EnvironmentItems &envVars)
|
||||||
{
|
{
|
||||||
const auto &mapping = envVarToCMakeVarMapping();
|
const auto &mapping = envVarToCMakeVarMapping();
|
||||||
auto cmakeVars = Utils::transform(envVars, [mapping](const Utils::EnvironmentItem &envVar) {
|
auto cmakeVars
|
||||||
return CMakeProjectManager::CMakeConfigItem(mapping.value(envVar.name, "").toUtf8(), envVar.value.toUtf8());
|
= Utils::transform(envVars, [mapping](const Utils::EnvironmentItem &envVar) {
|
||||||
}).toList();
|
return CMakeProjectManager::CMakeConfigItem(mapping.value(envVar.name, "").toUtf8(),
|
||||||
|
envVar.value.toUtf8());
|
||||||
|
}).toList();
|
||||||
|
|
||||||
return Utils::filtered(cmakeVars, [](const CMakeProjectManager::CMakeConfigItem &item) {
|
return Utils::filtered(cmakeVars, [](const CMakeProjectManager::CMakeConfigItem &item) {
|
||||||
return !item.key.isEmpty();
|
return !item.key.isEmpty();
|
||||||
|
@@ -46,5 +46,5 @@ const char SETTINGS_KEY_PACKAGE_PREFIX[] = "Package_";
|
|||||||
const char SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK[] = "QtForMCUsSdk"; // Key known by SDK installer
|
const char SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK[] = "QtForMCUsSdk"; // Key known by SDK installer
|
||||||
const char SETTINGS_KEY_AUTOMATIC_KIT_CREATION[] = "AutomaticKitCreation";
|
const char SETTINGS_KEY_AUTOMATIC_KIT_CREATION[] = "AutomaticKitCreation";
|
||||||
|
|
||||||
} // namespace McuSupport
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
} // namespace McuSupport
|
||||||
|
@@ -23,8 +23,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "mcusupportconstants.h"
|
|
||||||
#include "mcusupportdevice.h"
|
#include "mcusupportdevice.h"
|
||||||
|
#include "mcusupportconstants.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/deviceprocess.h>
|
#include <projectexplorer/devicesupport/deviceprocess.h>
|
||||||
#include <projectexplorer/runcontrol.h>
|
#include <projectexplorer/runcontrol.h>
|
||||||
|
@@ -23,39 +23,38 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "mcusupportoptions.h"
|
||||||
#include "mcukitinformation.h"
|
#include "mcukitinformation.h"
|
||||||
#include "mcupackage.h"
|
#include "mcupackage.h"
|
||||||
#include "mcusupportconstants.h"
|
|
||||||
#include "mcusupportoptions.h"
|
|
||||||
#include "mcusupportsdk.h"
|
|
||||||
#include "mcusupportplugin.h"
|
|
||||||
#include "mcusupportcmakemapper.h"
|
#include "mcusupportcmakemapper.h"
|
||||||
|
#include "mcusupportconstants.h"
|
||||||
|
#include "mcusupportplugin.h"
|
||||||
|
#include "mcusupportsdk.h"
|
||||||
|
|
||||||
#include <baremetal/baremetalconstants.h>
|
#include <baremetal/baremetalconstants.h>
|
||||||
|
#include <cmakeprojectmanager/cmakekitinformation.h>
|
||||||
#include <cmakeprojectmanager/cmaketoolmanager.h>
|
#include <cmakeprojectmanager/cmaketoolmanager.h>
|
||||||
#include <cmakeprojectmanager/cmakekitinformation.h>
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <coreplugin/helpmanager.h>
|
#include <coreplugin/helpmanager.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <cmakeprojectmanager/cmakekitinformation.h>
|
|
||||||
#include <debugger/debuggeritem.h>
|
#include <debugger/debuggeritem.h>
|
||||||
#include <debugger/debuggeritemmanager.h>
|
#include <debugger/debuggeritemmanager.h>
|
||||||
#include <debugger/debuggerkitinformation.h>
|
#include <debugger/debuggerkitinformation.h>
|
||||||
#include <projectexplorer/abi.h>
|
#include <projectexplorer/abi.h>
|
||||||
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
|
#include <projectexplorer/kitinformation.h>
|
||||||
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
|
||||||
#include <qtsupport/qtversionmanager.h>
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/infolabel.h>
|
#include <utils/infolabel.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
|
#include <qtsupport/qtkitinformation.h>
|
||||||
|
#include <qtsupport/qtversionmanager.h>
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -91,23 +90,22 @@ static void remapQul2xCmakeVars(Kit *kit, const EnvironmentItems &envItems)
|
|||||||
// First filter out all Qul2.x CMake vars
|
// First filter out all Qul2.x CMake vars
|
||||||
auto config = Utils::filtered(CMakeConfigurationKitAspect::configuration(kit),
|
auto config = Utils::filtered(CMakeConfigurationKitAspect::configuration(kit),
|
||||||
[&](const auto &configItem) {
|
[&](const auto &configItem) {
|
||||||
return !cmakeVarNames.contains(configItem.key);
|
return !cmakeVarNames.contains(configItem.key);
|
||||||
});
|
});
|
||||||
// Then append them with new values
|
// Then append them with new values
|
||||||
config.append(cmakeVars);
|
config.append(cmakeVars);
|
||||||
CMakeConfigurationKitAspect::setConfiguration(kit, config);
|
CMakeConfigurationKitAspect::setConfiguration(kit, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ToolChain *msvcToolChain(Id language)
|
static ToolChain *msvcToolChain(Id language)
|
||||||
{
|
{
|
||||||
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t) {
|
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t) {
|
||||||
const Abi abi = t->targetAbi();
|
const Abi abi = t->targetAbi();
|
||||||
// TODO: Should Abi::WindowsMsvc2022Flavor be added too?
|
// TODO: Should Abi::WindowsMsvc2022Flavor be added too?
|
||||||
return (abi.osFlavor() == Abi::WindowsMsvc2017Flavor || abi.osFlavor() == Abi::WindowsMsvc2019Flavor)
|
return (abi.osFlavor() == Abi::WindowsMsvc2017Flavor
|
||||||
&& abi.architecture() == Abi::X86Architecture
|
|| abi.osFlavor() == Abi::WindowsMsvc2019Flavor)
|
||||||
&& abi.wordWidth() == 64
|
&& abi.architecture() == Abi::X86Architecture && abi.wordWidth() == 64
|
||||||
&& t->language() == language;
|
&& t->language() == language;
|
||||||
});
|
});
|
||||||
return toolChain;
|
return toolChain;
|
||||||
}
|
}
|
||||||
@@ -116,26 +114,26 @@ static ToolChain *gccToolChain(Id language)
|
|||||||
{
|
{
|
||||||
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t) {
|
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t) {
|
||||||
const Abi abi = t->targetAbi();
|
const Abi abi = t->targetAbi();
|
||||||
return abi.os() != Abi::WindowsOS
|
return abi.os() != Abi::WindowsOS && abi.architecture() == Abi::X86Architecture
|
||||||
&& abi.architecture() == Abi::X86Architecture
|
&& abi.wordWidth() == 64 && t->language() == language;
|
||||||
&& abi.wordWidth() == 64
|
|
||||||
&& t->language() == language;
|
|
||||||
});
|
});
|
||||||
return toolChain;
|
return toolChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ToolChain *armGccToolChain(const FilePath &path, Id language)
|
static ToolChain *armGccToolChain(const FilePath &path, Id language)
|
||||||
{
|
{
|
||||||
ToolChain *toolChain = ToolChainManager::toolChain([&path, language](const ToolChain *t){
|
ToolChain *toolChain = ToolChainManager::toolChain([&path, language](const ToolChain *t) {
|
||||||
return t->compilerCommand() == path && t->language() == language;
|
return t->compilerCommand() == path && t->language() == language;
|
||||||
});
|
});
|
||||||
if (!toolChain) {
|
if (!toolChain) {
|
||||||
ToolChainFactory *gccFactory =
|
ToolChainFactory *gccFactory
|
||||||
Utils::findOrDefault(ToolChainFactory::allToolChainFactories(), [](ToolChainFactory *f){
|
= Utils::findOrDefault(ToolChainFactory::allToolChainFactories(),
|
||||||
return f->supportedToolChainType() == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID;
|
[](ToolChainFactory *f) {
|
||||||
});
|
return f->supportedToolChainType()
|
||||||
|
== ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID;
|
||||||
|
});
|
||||||
if (gccFactory) {
|
if (gccFactory) {
|
||||||
const QList<ToolChain*> detected = gccFactory->detectForImport({path, language});
|
const QList<ToolChain *> detected = gccFactory->detectForImport({path, language});
|
||||||
if (!detected.isEmpty()) {
|
if (!detected.isEmpty()) {
|
||||||
toolChain = detected.first();
|
toolChain = detected.first();
|
||||||
toolChain->setDetection(ToolChain::ManualDetection);
|
toolChain->setDetection(ToolChain::ManualDetection);
|
||||||
@@ -150,20 +148,22 @@ static ToolChain *armGccToolChain(const FilePath &path, Id language)
|
|||||||
|
|
||||||
static ToolChain *iarToolChain(const FilePath &path, Id language)
|
static ToolChain *iarToolChain(const FilePath &path, Id language)
|
||||||
{
|
{
|
||||||
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t){
|
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t) {
|
||||||
return t->typeId() == BareMetal::Constants::IAREW_TOOLCHAIN_TYPEID
|
return t->typeId() == BareMetal::Constants::IAREW_TOOLCHAIN_TYPEID
|
||||||
&& t->language() == language;
|
&& t->language() == language;
|
||||||
});
|
});
|
||||||
if (!toolChain) {
|
if (!toolChain) {
|
||||||
ToolChainFactory *iarFactory =
|
ToolChainFactory *iarFactory
|
||||||
Utils::findOrDefault(ToolChainFactory::allToolChainFactories(), [](ToolChainFactory *f){
|
= Utils::findOrDefault(ToolChainFactory::allToolChainFactories(),
|
||||||
return f->supportedToolChainType() == BareMetal::Constants::IAREW_TOOLCHAIN_TYPEID;
|
[](ToolChainFactory *f) {
|
||||||
});
|
return f->supportedToolChainType()
|
||||||
|
== BareMetal::Constants::IAREW_TOOLCHAIN_TYPEID;
|
||||||
|
});
|
||||||
if (iarFactory) {
|
if (iarFactory) {
|
||||||
Toolchains detected = iarFactory->autoDetect(ToolchainDetector({}, {}));
|
Toolchains detected = iarFactory->autoDetect(ToolchainDetector({}, {}));
|
||||||
if (detected.isEmpty())
|
if (detected.isEmpty())
|
||||||
detected = iarFactory->detectForImport({path, language});
|
detected = iarFactory->detectForImport({path, language});
|
||||||
for (auto tc: detected) {
|
for (auto tc : detected) {
|
||||||
if (tc->language() == language) {
|
if (tc->language() == language) {
|
||||||
toolChain = tc;
|
toolChain = tc;
|
||||||
toolChain->setDetection(ToolChain::ManualDetection);
|
toolChain->setDetection(ToolChain::ManualDetection);
|
||||||
@@ -210,12 +210,18 @@ ToolChain *McuToolChainPackage::toolChain(Id language) const
|
|||||||
QString McuToolChainPackage::toolChainName() const
|
QString McuToolChainPackage::toolChainName() const
|
||||||
{
|
{
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case Type::ArmGcc: return QLatin1String("armgcc");
|
case Type::ArmGcc:
|
||||||
case Type::IAR: return QLatin1String("iar");
|
return QLatin1String("armgcc");
|
||||||
case Type::KEIL: return QLatin1String("keil");
|
case Type::IAR:
|
||||||
case Type::GHS: return QLatin1String("ghs");
|
return QLatin1String("iar");
|
||||||
case Type::GHSArm: return QLatin1String("ghs-arm");
|
case Type::KEIL:
|
||||||
default: return QLatin1String("unsupported");
|
return QLatin1String("keil");
|
||||||
|
case Type::GHS:
|
||||||
|
return QLatin1String("ghs");
|
||||||
|
case Type::GHSArm:
|
||||||
|
return QLatin1String("ghs-arm");
|
||||||
|
default:
|
||||||
|
return QLatin1String("unsupported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,8 +284,7 @@ McuTarget::McuTarget(const QVersionNumber &qulVersion,
|
|||||||
, m_packages(packages)
|
, m_packages(packages)
|
||||||
, m_toolChainPackage(toolChainPackage)
|
, m_toolChainPackage(toolChainPackage)
|
||||||
, m_colorDepth(colorDepth)
|
, m_colorDepth(colorDepth)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
const QVector<McuPackage *> &McuTarget::packages() const
|
const QVector<McuPackage *> &McuTarget::packages() const
|
||||||
{
|
{
|
||||||
@@ -311,19 +316,19 @@ bool McuTarget::isValid() const
|
|||||||
|
|
||||||
void McuTarget::printPackageProblems() const
|
void McuTarget::printPackageProblems() const
|
||||||
{
|
{
|
||||||
for (auto package: packages()) {
|
for (auto package : packages()) {
|
||||||
package->updateStatus();
|
package->updateStatus();
|
||||||
if (!package->validStatus())
|
if (!package->validStatus())
|
||||||
printMessage(tr("Error creating kit for target %1, package %2: %3").arg(
|
printMessage(tr("Error creating kit for target %1, package %2: %3")
|
||||||
McuSupportOptions::kitName(this),
|
.arg(McuSupportOptions::kitName(this),
|
||||||
package->label(),
|
package->label(),
|
||||||
package->statusText()),
|
package->statusText()),
|
||||||
true);
|
true);
|
||||||
if (package->status() == McuPackage::ValidPackageMismatchedVersion)
|
if (package->status() == McuPackage::ValidPackageMismatchedVersion)
|
||||||
printMessage(tr("Warning creating kit for target %1, package %2: %3").arg(
|
printMessage(tr("Warning creating kit for target %1, package %2: %3")
|
||||||
McuSupportOptions::kitName(this),
|
.arg(McuSupportOptions::kitName(this),
|
||||||
package->label(),
|
package->label(),
|
||||||
package->statusText()),
|
package->statusText()),
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,8 +355,10 @@ McuSupportOptions::McuSupportOptions(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, qtForMCUsSdkPackage(Sdk::createQtForMCUsPackage())
|
, qtForMCUsSdkPackage(Sdk::createQtForMCUsPackage())
|
||||||
{
|
{
|
||||||
connect(qtForMCUsSdkPackage, &McuPackage::changed,
|
connect(qtForMCUsSdkPackage,
|
||||||
this, &McuSupportOptions::populatePackagesAndTargets);
|
&McuPackage::changed,
|
||||||
|
this,
|
||||||
|
&McuSupportOptions::populatePackagesAndTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
McuSupportOptions::~McuSupportOptions()
|
McuSupportOptions::~McuSupportOptions()
|
||||||
@@ -382,9 +389,8 @@ void McuSupportOptions::registerQchFiles()
|
|||||||
|
|
||||||
const QFileInfoList qchFiles = QDir(docsDir, "*.qch").entryInfoList();
|
const QFileInfoList qchFiles = QDir(docsDir, "*.qch").entryInfoList();
|
||||||
Core::HelpManager::registerDocumentation(
|
Core::HelpManager::registerDocumentation(
|
||||||
Utils::transform<QStringList>(qchFiles, [](const QFileInfo &fi){
|
Utils::transform<QStringList>(qchFiles,
|
||||||
return fi.absoluteFilePath();
|
[](const QFileInfo &fi) { return fi.absoluteFilePath(); }));
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void McuSupportOptions::registerExamples()
|
void McuSupportOptions::registerExamples()
|
||||||
@@ -393,17 +399,15 @@ void McuSupportOptions::registerExamples()
|
|||||||
if (docsDir.isEmpty())
|
if (docsDir.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto examples = {
|
auto examples = {std::make_pair(QStringLiteral("demos"), tr("Qt for MCUs Demos")),
|
||||||
std::make_pair(QStringLiteral("demos"), tr("Qt for MCUs Demos")),
|
std::make_pair(QStringLiteral("examples"), tr("Qt for MCUs Examples"))};
|
||||||
std::make_pair(QStringLiteral("examples"), tr("Qt for MCUs Examples"))
|
|
||||||
};
|
|
||||||
for (const auto &dir : examples) {
|
for (const auto &dir : examples) {
|
||||||
const FilePath examplesDir =
|
const FilePath examplesDir = McuSupportOptions::qulDirFromSettings().pathAppended(dir.first);
|
||||||
McuSupportOptions::qulDirFromSettings().pathAppended(dir.first);
|
|
||||||
if (!examplesDir.exists())
|
if (!examplesDir.exists())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QtSupport::QtVersionManager::registerExampleSet(dir.second, docsDir.toString(),
|
QtSupport::QtVersionManager::registerExampleSet(dir.second,
|
||||||
|
docsDir.toString(),
|
||||||
examplesDir.toString());
|
examplesDir.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -432,7 +436,9 @@ FilePath McuSupportOptions::qulDirFromSettings()
|
|||||||
QSettings::UserScope);
|
QSettings::UserScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setKitProperties(const QString &kitName, Kit *k, const McuTarget *mcuTarget,
|
static void setKitProperties(const QString &kitName,
|
||||||
|
Kit *k,
|
||||||
|
const McuTarget *mcuTarget,
|
||||||
const FilePath &sdkPath)
|
const FilePath &sdkPath)
|
||||||
{
|
{
|
||||||
using namespace Constants;
|
using namespace Constants;
|
||||||
@@ -521,7 +527,7 @@ static void setKitDebugger(Kit *k, const McuToolChainPackage *tcPackage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setKitDevice(Kit *k, const McuTarget* mcuTarget)
|
static void setKitDevice(Kit *k, const McuTarget *mcuTarget)
|
||||||
{
|
{
|
||||||
// "Device Type" Desktop is the default. We use that for the Qt for MCUs Desktop Kit
|
// "Device Type" Desktop is the default. We use that for the Qt for MCUs Desktop Kit
|
||||||
if (mcuTarget->toolChainPackage()->isDesktopToolchain())
|
if (mcuTarget->toolChainPackage()->isDesktopToolchain())
|
||||||
@@ -532,10 +538,11 @@ static void setKitDevice(Kit *k, const McuTarget* mcuTarget)
|
|||||||
|
|
||||||
static bool expectsCmakeVars(const McuTarget *mcuTarget)
|
static bool expectsCmakeVars(const McuTarget *mcuTarget)
|
||||||
{
|
{
|
||||||
return mcuTarget->qulVersion() >= QVersionNumber{2,0};
|
return mcuTarget->qulVersion() >= QVersionNumber{2, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setKitEnvironment(Kit *k, const McuTarget *mcuTarget,
|
static void setKitEnvironment(Kit *k,
|
||||||
|
const McuTarget *mcuTarget,
|
||||||
const McuPackage *qtForMCUsSdkPackage)
|
const McuPackage *qtForMCUsSdkPackage)
|
||||||
{
|
{
|
||||||
EnvironmentItems changes;
|
EnvironmentItems changes;
|
||||||
@@ -545,7 +552,7 @@ static void setKitEnvironment(Kit *k, const McuTarget *mcuTarget,
|
|||||||
// If CMake's fileApi is avaialble, we can rely on the "Add library search path to PATH"
|
// If CMake's fileApi is avaialble, we can rely on the "Add library search path to PATH"
|
||||||
// feature of the run configuration. Otherwise, we just prepend the path, here.
|
// feature of the run configuration. Otherwise, we just prepend the path, here.
|
||||||
if (mcuTarget->toolChainPackage()->isDesktopToolchain()
|
if (mcuTarget->toolChainPackage()->isDesktopToolchain()
|
||||||
&& !CMakeProjectManager::CMakeToolManager::defaultCMakeTool()->hasFileApi())
|
&& !CMakeProjectManager::CMakeToolManager::defaultCMakeTool()->hasFileApi())
|
||||||
pathAdditions.append(qtForMCUsSdkPackage->path().pathAppended("bin").toUserOutput());
|
pathAdditions.append(qtForMCUsSdkPackage->path().pathAppended("bin").toUserOutput());
|
||||||
|
|
||||||
auto processPackage = [&pathAdditions, &changes](const McuPackage *package) {
|
auto processPackage = [&pathAdditions, &changes](const McuPackage *package) {
|
||||||
@@ -559,7 +566,7 @@ static void setKitEnvironment(Kit *k, const McuTarget *mcuTarget,
|
|||||||
processPackage(qtForMCUsSdkPackage);
|
processPackage(qtForMCUsSdkPackage);
|
||||||
|
|
||||||
// Clang not needed in version 1.7+
|
// Clang not needed in version 1.7+
|
||||||
if (mcuTarget->qulVersion() < QVersionNumber{1,7}) {
|
if (mcuTarget->qulVersion() < QVersionNumber{1, 7}) {
|
||||||
const QString path = QLatin1String(HostOsInfo::isWindowsHost() ? "Path" : "PATH");
|
const QString path = QLatin1String(HostOsInfo::isWindowsHost() ? "Path" : "PATH");
|
||||||
pathAdditions.append("${" + path + "}");
|
pathAdditions.append("${" + path + "}");
|
||||||
pathAdditions.append(Core::ICore::libexecPath("clang/bin").toUserOutput());
|
pathAdditions.append(Core::ICore::libexecPath("clang/bin").toUserOutput());
|
||||||
@@ -577,15 +584,16 @@ static void setKitEnvironment(Kit *k, const McuTarget *mcuTarget,
|
|||||||
EnvironmentKitAspect::setEnvironmentChanges(k, changes);
|
EnvironmentKitAspect::setEnvironmentChanges(k, changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setKitDependencies(Kit *k, const McuTarget *mcuTarget,
|
static void setKitDependencies(Kit *k,
|
||||||
const McuPackage *qtForMCUsSdkPackage)
|
const McuTarget *mcuTarget,
|
||||||
|
const McuPackage *qtForMCUsSdkPackage)
|
||||||
{
|
{
|
||||||
NameValueItems dependencies;
|
NameValueItems dependencies;
|
||||||
|
|
||||||
auto processPackage = [&dependencies](const McuPackage *package) {
|
auto processPackage = [&dependencies](const McuPackage *package) {
|
||||||
if (!package->environmentVariableName().isEmpty())
|
if (!package->environmentVariableName().isEmpty())
|
||||||
dependencies.append({package->environmentVariableName(),
|
dependencies.append({package->environmentVariableName(),
|
||||||
QDir::toNativeSeparators(package->detectionPath())});
|
QDir::toNativeSeparators(package->detectionPath())});
|
||||||
};
|
};
|
||||||
for (auto package : mcuTarget->packages())
|
for (auto package : mcuTarget->packages())
|
||||||
processPackage(package);
|
processPackage(package);
|
||||||
@@ -624,43 +632,44 @@ static void updateKitEnvironment(Kit *k, const McuTarget *mcuTarget)
|
|||||||
EnvironmentKitAspect::setEnvironmentChanges(k, changes);
|
EnvironmentKitAspect::setEnvironmentChanges(k, changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setKitCMakeOptions(Kit *k, const McuTarget* mcuTarget, const FilePath &qulDir)
|
static void setKitCMakeOptions(Kit *k, const McuTarget *mcuTarget, const FilePath &qulDir)
|
||||||
{
|
{
|
||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
|
|
||||||
CMakeConfig config = CMakeConfigurationKitAspect::configuration(k);
|
CMakeConfig config = CMakeConfigurationKitAspect::configuration(k);
|
||||||
// CMake ToolChain file for ghs handles CMAKE_*_COMPILER autonomously
|
// CMake ToolChain file for ghs handles CMAKE_*_COMPILER autonomously
|
||||||
if (mcuTarget->toolChainPackage()->type() != McuToolChainPackage::Type::GHS &&
|
if (mcuTarget->toolChainPackage()->type() != McuToolChainPackage::Type::GHS
|
||||||
mcuTarget->toolChainPackage()->type() != McuToolChainPackage::Type::GHSArm) {
|
&& mcuTarget->toolChainPackage()->type() != McuToolChainPackage::Type::GHSArm) {
|
||||||
config.append(CMakeConfigItem("CMAKE_CXX_COMPILER", "%{Compiler:Executable:Cxx}"));
|
config.append(CMakeConfigItem("CMAKE_CXX_COMPILER", "%{Compiler:Executable:Cxx}"));
|
||||||
config.append(CMakeConfigItem("CMAKE_C_COMPILER", "%{Compiler:Executable:C}"));
|
config.append(CMakeConfigItem("CMAKE_C_COMPILER", "%{Compiler:Executable:C}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mcuTarget->toolChainPackage()->isDesktopToolchain()) {
|
if (!mcuTarget->toolChainPackage()->isDesktopToolchain()) {
|
||||||
const FilePath cMakeToolchainFile = qulDir.pathAppended("lib/cmake/Qul/toolchain/"
|
const FilePath cMakeToolchainFile = qulDir.pathAppended(
|
||||||
+ mcuTarget->toolChainPackage()->cmakeToolChainFileName());
|
"lib/cmake/Qul/toolchain/" + mcuTarget->toolChainPackage()->cmakeToolChainFileName());
|
||||||
|
|
||||||
config.append(CMakeConfigItem(
|
config.append(
|
||||||
"CMAKE_TOOLCHAIN_FILE",
|
CMakeConfigItem("CMAKE_TOOLCHAIN_FILE", cMakeToolchainFile.toString().toUtf8()));
|
||||||
cMakeToolchainFile.toString().toUtf8()));
|
|
||||||
if (!cMakeToolchainFile.exists()) {
|
if (!cMakeToolchainFile.exists()) {
|
||||||
printMessage(McuTarget::tr("Warning for target %1: missing CMake toolchain file expected at %2.")
|
printMessage(McuTarget::tr(
|
||||||
.arg(McuSupportOptions::kitName(mcuTarget), cMakeToolchainFile.toUserOutput()), false);
|
"Warning for target %1: missing CMake toolchain file expected at %2.")
|
||||||
|
.arg(McuSupportOptions::kitName(mcuTarget),
|
||||||
|
cMakeToolchainFile.toUserOutput()),
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const FilePath generatorsPath = qulDir.pathAppended("/lib/cmake/Qul/QulGenerators.cmake");
|
const FilePath generatorsPath = qulDir.pathAppended("/lib/cmake/Qul/QulGenerators.cmake");
|
||||||
config.append(CMakeConfigItem("QUL_GENERATORS",
|
config.append(CMakeConfigItem("QUL_GENERATORS", generatorsPath.toString().toUtf8()));
|
||||||
generatorsPath.toString().toUtf8()));
|
|
||||||
if (!generatorsPath.exists()) {
|
if (!generatorsPath.exists()) {
|
||||||
printMessage(McuTarget::tr("Warning for target %1: missing QulGenerators expected at %2.")
|
printMessage(McuTarget::tr("Warning for target %1: missing QulGenerators expected at %2.")
|
||||||
.arg(McuSupportOptions::kitName(mcuTarget), generatorsPath.toUserOutput()), false);
|
.arg(McuSupportOptions::kitName(mcuTarget), generatorsPath.toUserOutput()),
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
config.append(CMakeConfigItem("QUL_PLATFORM",
|
config.append(CMakeConfigItem("QUL_PLATFORM", mcuTarget->platform().name.toUtf8()));
|
||||||
mcuTarget->platform().name.toUtf8()));
|
|
||||||
|
|
||||||
if (mcuTarget->qulVersion() <= QVersionNumber{1,3} // OS variable was removed in Qul 1.4
|
if (mcuTarget->qulVersion() <= QVersionNumber{1, 3} // OS variable was removed in Qul 1.4
|
||||||
&& mcuTarget->os() == McuTarget::OS::FreeRTOS)
|
&& mcuTarget->os() == McuTarget::OS::FreeRTOS)
|
||||||
config.append(CMakeConfigItem("OS", "FreeRTOS"));
|
config.append(CMakeConfigItem("OS", "FreeRTOS"));
|
||||||
if (mcuTarget->colorDepth() != McuTarget::UnspecifiedColorDepth)
|
if (mcuTarget->colorDepth() != McuTarget::UnspecifiedColorDepth)
|
||||||
@@ -690,27 +699,29 @@ static void setKitQtVersionOptions(Kit *k)
|
|||||||
QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
||||||
{
|
{
|
||||||
QString os;
|
QString os;
|
||||||
if (mcuTarget->qulVersion() <= QVersionNumber{1,3} && mcuTarget->os() == McuTarget::OS::FreeRTOS)
|
if (mcuTarget->qulVersion() <= QVersionNumber{1, 3}
|
||||||
|
&& mcuTarget->os() == McuTarget::OS::FreeRTOS)
|
||||||
// Starting from Qul 1.4 each OS is a separate platform
|
// Starting from Qul 1.4 each OS is a separate platform
|
||||||
os = QLatin1String(" FreeRTOS");
|
os = QLatin1String(" FreeRTOS");
|
||||||
|
|
||||||
const McuToolChainPackage *tcPkg = mcuTarget->toolChainPackage();
|
const McuToolChainPackage *tcPkg = mcuTarget->toolChainPackage();
|
||||||
const QString compilerName = tcPkg && !tcPkg->isDesktopToolchain()
|
const QString compilerName = tcPkg && !tcPkg->isDesktopToolchain()
|
||||||
? QString::fromLatin1(" (%1)").arg(tcPkg->toolChainName().toUpper())
|
? QString::fromLatin1(" (%1)").arg(
|
||||||
: "";
|
tcPkg->toolChainName().toUpper())
|
||||||
|
: "";
|
||||||
const QString colorDepth = mcuTarget->colorDepth() != McuTarget::UnspecifiedColorDepth
|
const QString colorDepth = mcuTarget->colorDepth() != McuTarget::UnspecifiedColorDepth
|
||||||
? QString::fromLatin1(" %1bpp").arg(mcuTarget->colorDepth())
|
? QString::fromLatin1(" %1bpp").arg(mcuTarget->colorDepth())
|
||||||
: "";
|
: "";
|
||||||
const QString targetName = mcuTarget->platform().displayName.isEmpty()
|
const QString targetName = mcuTarget->platform().displayName.isEmpty()
|
||||||
? mcuTarget->platform().name
|
? mcuTarget->platform().name
|
||||||
: mcuTarget->platform().displayName;
|
: mcuTarget->platform().displayName;
|
||||||
return QString::fromLatin1("Qt for MCUs %1.%2 - %3%4%5%6")
|
return QString::fromLatin1("Qt for MCUs %1.%2 - %3%4%5%6")
|
||||||
.arg(QString::number(mcuTarget->qulVersion().majorVersion()),
|
.arg(QString::number(mcuTarget->qulVersion().majorVersion()),
|
||||||
QString::number(mcuTarget->qulVersion().minorVersion()),
|
QString::number(mcuTarget->qulVersion().minorVersion()),
|
||||||
targetName,
|
targetName,
|
||||||
os,
|
os,
|
||||||
colorDepth,
|
colorDepth,
|
||||||
compilerName);
|
compilerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
|
QList<Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
|
||||||
@@ -718,26 +729,27 @@ QList<Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
|
|||||||
using namespace Constants;
|
using namespace Constants;
|
||||||
return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
|
return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
|
||||||
return kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
|
return kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
|
||||||
&& (!mcuTarget || (
|
&& (!mcuTarget
|
||||||
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->platform().vendor
|
|| (kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->platform().vendor
|
||||||
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->platform().name
|
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->platform().name
|
||||||
&& kit->value(KIT_MCUTARGET_COLORDEPTH_KEY) == mcuTarget->colorDepth()
|
&& kit->value(KIT_MCUTARGET_COLORDEPTH_KEY) == mcuTarget->colorDepth()
|
||||||
&& kit->value(KIT_MCUTARGET_OS_KEY).toInt()
|
&& kit->value(KIT_MCUTARGET_OS_KEY).toInt()
|
||||||
== static_cast<int>(mcuTarget->os())
|
== static_cast<int>(mcuTarget->os())
|
||||||
&& kit->value(KIT_MCUTARGET_TOOCHAIN_KEY)
|
&& kit->value(KIT_MCUTARGET_TOOCHAIN_KEY)
|
||||||
== mcuTarget->toolChainPackage()->toolChainName()
|
== mcuTarget->toolChainPackage()->toolChainName()));
|
||||||
));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Kit *> McuSupportOptions::matchingKits(const McuTarget *mcuTarget, const McuPackage *qtForMCUsSdkPackage)
|
QList<Kit *> McuSupportOptions::matchingKits(const McuTarget *mcuTarget,
|
||||||
|
const McuPackage *qtForMCUsSdkPackage)
|
||||||
{
|
{
|
||||||
return Utils::filtered(existingKits(mcuTarget), [mcuTarget, qtForMCUsSdkPackage](Kit *kit) {
|
return Utils::filtered(existingKits(mcuTarget), [mcuTarget, qtForMCUsSdkPackage](Kit *kit) {
|
||||||
return kitUpToDate(kit, mcuTarget, qtForMCUsSdkPackage);
|
return kitUpToDate(kit, mcuTarget, qtForMCUsSdkPackage);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Kit *> McuSupportOptions::upgradeableKits(const McuTarget *mcuTarget, const McuPackage *qtForMCUsSdkPackage)
|
QList<Kit *> McuSupportOptions::upgradeableKits(const McuTarget *mcuTarget,
|
||||||
|
const McuPackage *qtForMCUsSdkPackage)
|
||||||
{
|
{
|
||||||
return Utils::filtered(existingKits(mcuTarget), [mcuTarget, qtForMCUsSdkPackage](Kit *kit) {
|
return Utils::filtered(existingKits(mcuTarget), [mcuTarget, qtForMCUsSdkPackage](Kit *kit) {
|
||||||
return !kitUpToDate(kit, mcuTarget, qtForMCUsSdkPackage);
|
return !kitUpToDate(kit, mcuTarget, qtForMCUsSdkPackage);
|
||||||
@@ -748,11 +760,11 @@ QList<Kit *> McuSupportOptions::kitsWithMismatchedDependencies(const McuTarget *
|
|||||||
{
|
{
|
||||||
return Utils::filtered(existingKits(mcuTarget), [mcuTarget](Kit *kit) {
|
return Utils::filtered(existingKits(mcuTarget), [mcuTarget](Kit *kit) {
|
||||||
const auto environment = Utils::NameValueDictionary(
|
const auto environment = Utils::NameValueDictionary(
|
||||||
Utils::NameValueItem::toStringList(
|
Utils::NameValueItem::toStringList(EnvironmentKitAspect::environmentChanges(kit)));
|
||||||
EnvironmentKitAspect::environmentChanges(kit)));
|
|
||||||
return Utils::anyOf(mcuTarget->packages(), [&environment](const McuPackage *package) {
|
return Utils::anyOf(mcuTarget->packages(), [&environment](const McuPackage *package) {
|
||||||
return !package->environmentVariableName().isEmpty() &&
|
return !package->environmentVariableName().isEmpty()
|
||||||
environment.value(package->environmentVariableName()) != package->path().toUserOutput();
|
&& environment.value(package->environmentVariableName())
|
||||||
|
!= package->path().toUserOutput();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -761,7 +773,7 @@ QList<Kit *> McuSupportOptions::outdatedKits()
|
|||||||
{
|
{
|
||||||
return Utils::filtered(KitManager::kits(), [](Kit *kit) {
|
return Utils::filtered(KitManager::kits(), [](Kit *kit) {
|
||||||
return !kit->value(Constants::KIT_MCUTARGET_VENDOR_KEY).isNull()
|
return !kit->value(Constants::KIT_MCUTARGET_VENDOR_KEY).isNull()
|
||||||
&& kit->value(Constants::KIT_MCUTARGET_KITVERSION_KEY) != KIT_VERSION;
|
&& kit->value(Constants::KIT_MCUTARGET_KITVERSION_KEY) != KIT_VERSION;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -794,7 +806,8 @@ Kit *McuSupportOptions::newKit(const McuTarget *mcuTarget, const McuPackage *qtF
|
|||||||
|
|
||||||
void printMessage(const QString &message, bool important)
|
void printMessage(const QString &message, bool important)
|
||||||
{
|
{
|
||||||
const QString displayMessage = QCoreApplication::translate("QtForMCUs", "Qt for MCUs: %1").arg(message);
|
const QString displayMessage = QCoreApplication::translate("QtForMCUs", "Qt for MCUs: %1")
|
||||||
|
.arg(message);
|
||||||
if (important)
|
if (important)
|
||||||
Core::MessageManager::writeFlashing(displayMessage);
|
Core::MessageManager::writeFlashing(displayMessage);
|
||||||
else
|
else
|
||||||
@@ -804,8 +817,7 @@ void printMessage(const QString &message, bool important)
|
|||||||
QVersionNumber McuSupportOptions::kitQulVersion(const Kit *kit)
|
QVersionNumber McuSupportOptions::kitQulVersion(const Kit *kit)
|
||||||
{
|
{
|
||||||
return QVersionNumber::fromString(
|
return QVersionNumber::fromString(
|
||||||
kit->value(McuSupport::Constants::KIT_MCUTARGET_SDKVERSION_KEY)
|
kit->value(McuSupport::Constants::KIT_MCUTARGET_SDKVERSION_KEY).toString());
|
||||||
.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static FilePath kitDependencyPath(const Kit *kit, const QString &variableName)
|
static FilePath kitDependencyPath(const Kit *kit, const QString &variableName)
|
||||||
@@ -817,11 +829,13 @@ static FilePath kitDependencyPath(const Kit *kit, const QString &variableName)
|
|||||||
return FilePath();
|
return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool McuSupportOptions::kitUpToDate(const Kit *kit, const McuTarget *mcuTarget,
|
bool McuSupportOptions::kitUpToDate(const Kit *kit,
|
||||||
|
const McuTarget *mcuTarget,
|
||||||
const McuPackage *qtForMCUsSdkPackage)
|
const McuPackage *qtForMCUsSdkPackage)
|
||||||
{
|
{
|
||||||
return kitQulVersion(kit) == mcuTarget->qulVersion() &&
|
return kitQulVersion(kit) == mcuTarget->qulVersion()
|
||||||
kitDependencyPath(kit, qtForMCUsSdkPackage->environmentVariableName()).toUserOutput() == qtForMCUsSdkPackage->path().toUserOutput();
|
&& kitDependencyPath(kit, qtForMCUsSdkPackage->environmentVariableName()).toUserOutput()
|
||||||
|
== qtForMCUsSdkPackage->path().toUserOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
void McuSupportOptions::deletePackagesAndTargets()
|
void McuSupportOptions::deletePackagesAndTargets()
|
||||||
@@ -833,8 +847,9 @@ McuSupportOptions::UpgradeOption McuSupportOptions::askForKitUpgrades()
|
|||||||
{
|
{
|
||||||
QMessageBox upgradePopup(Core::ICore::dialogParent());
|
QMessageBox upgradePopup(Core::ICore::dialogParent());
|
||||||
upgradePopup.setStandardButtons(QMessageBox::Cancel);
|
upgradePopup.setStandardButtons(QMessageBox::Cancel);
|
||||||
QPushButton *replaceButton = upgradePopup.addButton(tr("Replace Existing Kits"),QMessageBox::NoRole);
|
QPushButton *replaceButton = upgradePopup.addButton(tr("Replace Existing Kits"),
|
||||||
QPushButton *keepButton = upgradePopup.addButton(tr("Create New Kits"),QMessageBox::NoRole);
|
QMessageBox::NoRole);
|
||||||
|
QPushButton *keepButton = upgradePopup.addButton(tr("Create New Kits"), QMessageBox::NoRole);
|
||||||
upgradePopup.setWindowTitle(tr("Qt for MCUs"));
|
upgradePopup.setWindowTitle(tr("Qt for MCUs"));
|
||||||
upgradePopup.setText(tr("New version of Qt for MCUs detected. Upgrade existing kits?"));
|
upgradePopup.setText(tr("New version of Qt for MCUs detected. Upgrade existing kits?"));
|
||||||
|
|
||||||
@@ -854,67 +869,70 @@ void McuSupportOptions::createAutomaticKits()
|
|||||||
auto qtForMCUsPackage = Sdk::createQtForMCUsPackage();
|
auto qtForMCUsPackage = Sdk::createQtForMCUsPackage();
|
||||||
|
|
||||||
const auto createKits = [qtForMCUsPackage]() {
|
const auto createKits = [qtForMCUsPackage]() {
|
||||||
if (qtForMCUsPackage->automaticKitCreationEnabled()) {
|
if (qtForMCUsPackage->automaticKitCreationEnabled()) {
|
||||||
qtForMCUsPackage->updateStatus();
|
qtForMCUsPackage->updateStatus();
|
||||||
if (!qtForMCUsPackage->validStatus()) {
|
if (!qtForMCUsPackage->validStatus()) {
|
||||||
switch (qtForMCUsPackage->status()) {
|
switch (qtForMCUsPackage->status()) {
|
||||||
case McuPackage::ValidPathInvalidPackage: {
|
case McuPackage::ValidPathInvalidPackage: {
|
||||||
const QString displayPath = FilePath::fromString(qtForMCUsPackage->detectionPath())
|
const QString displayPath
|
||||||
.toUserOutput();
|
= FilePath::fromString(qtForMCUsPackage->detectionPath()).toUserOutput();
|
||||||
printMessage(tr("Path %1 exists, but does not contain %2.")
|
printMessage(tr("Path %1 exists, but does not contain %2.")
|
||||||
.arg(qtForMCUsPackage->path().toUserOutput(), displayPath),
|
.arg(qtForMCUsPackage->path().toUserOutput(), displayPath),
|
||||||
true);
|
true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case McuPackage::InvalidPath: {
|
case McuPackage::InvalidPath: {
|
||||||
printMessage(tr("Path %1 does not exist. Add the path in Tools > Options > Devices > MCU.")
|
printMessage(tr("Path %1 does not exist. Add the path in Tools > Options > "
|
||||||
.arg(qtForMCUsPackage->path().toUserOutput()),
|
"Devices > MCU.")
|
||||||
|
.arg(qtForMCUsPackage->path().toUserOutput()),
|
||||||
true);
|
true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case McuPackage::EmptyPath: {
|
case McuPackage::EmptyPath: {
|
||||||
printMessage(tr("Missing %1. Add the path in Tools > Options > Devices > MCU.")
|
printMessage(tr("Missing %1. Add the path in Tools > Options > Devices > MCU.")
|
||||||
.arg(qtForMCUsPackage->detectionPath()),
|
.arg(qtForMCUsPackage->detectionPath()),
|
||||||
true);
|
true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CMakeProjectManager::CMakeToolManager::cmakeTools().isEmpty()) {
|
if (CMakeProjectManager::CMakeToolManager::cmakeTools().isEmpty()) {
|
||||||
printMessage(tr("No CMake tool was detected. Add a CMake tool in Tools > Options > Kits > CMake."),
|
printMessage(tr("No CMake tool was detected. Add a CMake tool in Tools > Options > "
|
||||||
true);
|
"Kits > CMake."),
|
||||||
return;
|
true);
|
||||||
}
|
return;
|
||||||
|
|
||||||
FilePath dir = qtForMCUsPackage->path();
|
|
||||||
McuSdkRepository repo;
|
|
||||||
Sdk::targetsAndPackages(dir, &repo);
|
|
||||||
|
|
||||||
bool needsUpgrade = false;
|
|
||||||
for (const auto &target: qAsConst(repo.mcuTargets)) {
|
|
||||||
// if kit already exists, skip
|
|
||||||
if (!matchingKits(target, qtForMCUsPackage).empty())
|
|
||||||
continue;
|
|
||||||
if (!upgradeableKits(target, qtForMCUsPackage).empty()) {
|
|
||||||
// if kit exists but wrong version/path
|
|
||||||
needsUpgrade = true;
|
|
||||||
} else {
|
|
||||||
// if no kits for this target, create
|
|
||||||
if (target->isValid())
|
|
||||||
newKit(target, qtForMCUsPackage);
|
|
||||||
target->printPackageProblems();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath dir = qtForMCUsPackage->path();
|
||||||
|
McuSdkRepository repo;
|
||||||
|
Sdk::targetsAndPackages(dir, &repo);
|
||||||
|
|
||||||
|
bool needsUpgrade = false;
|
||||||
|
for (const auto &target : qAsConst(repo.mcuTargets)) {
|
||||||
|
// if kit already exists, skip
|
||||||
|
if (!matchingKits(target, qtForMCUsPackage).empty())
|
||||||
|
continue;
|
||||||
|
if (!upgradeableKits(target, qtForMCUsPackage).empty()) {
|
||||||
|
// if kit exists but wrong version/path
|
||||||
|
needsUpgrade = true;
|
||||||
|
} else {
|
||||||
|
// if no kits for this target, create
|
||||||
|
if (target->isValid())
|
||||||
|
newKit(target, qtForMCUsPackage);
|
||||||
|
target->printPackageProblems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repo.deletePackagesAndTargets();
|
||||||
|
|
||||||
|
if (needsUpgrade)
|
||||||
|
McuSupportPlugin::askUserAboutMcuSupportKitsUpgrade();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
repo.deletePackagesAndTargets();
|
|
||||||
|
|
||||||
if (needsUpgrade)
|
|
||||||
McuSupportPlugin::askUserAboutMcuSupportKitsUpgrade();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
createKits();
|
createKits();
|
||||||
delete qtForMCUsPackage;
|
delete qtForMCUsPackage;
|
||||||
@@ -926,8 +944,8 @@ void McuSupportOptions::checkUpgradeableKits()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (Utils::anyOf(sdkRepository.mcuTargets, [this](const McuTarget *target) {
|
if (Utils::anyOf(sdkRepository.mcuTargets, [this](const McuTarget *target) {
|
||||||
return !upgradeableKits(target, this->qtForMCUsSdkPackage).empty() &&
|
return !upgradeableKits(target, this->qtForMCUsSdkPackage).empty()
|
||||||
matchingKits(target, this->qtForMCUsSdkPackage).empty();
|
&& matchingKits(target, this->qtForMCUsSdkPackage).empty();
|
||||||
}))
|
}))
|
||||||
upgradeKits(askForKitUpgrades());
|
upgradeKits(askForKitUpgrades());
|
||||||
}
|
}
|
||||||
@@ -943,7 +961,7 @@ void McuSupportOptions::upgradeKits(UpgradeOption upgradeOption)
|
|||||||
McuSdkRepository repo;
|
McuSdkRepository repo;
|
||||||
Sdk::targetsAndPackages(dir, &repo);
|
Sdk::targetsAndPackages(dir, &repo);
|
||||||
|
|
||||||
for (const auto &target: qAsConst(repo.mcuTargets)) {
|
for (const auto &target : qAsConst(repo.mcuTargets)) {
|
||||||
if (!matchingKits(target, qtForMCUsPackage).empty())
|
if (!matchingKits(target, qtForMCUsPackage).empty())
|
||||||
// already up-to-date
|
// already up-to-date
|
||||||
continue;
|
continue;
|
||||||
@@ -964,7 +982,9 @@ void McuSupportOptions::upgradeKits(UpgradeOption upgradeOption)
|
|||||||
delete qtForMCUsPackage;
|
delete qtForMCUsPackage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void McuSupportOptions::upgradeKitInPlace(ProjectExplorer::Kit *kit, const McuTarget *mcuTarget, const McuPackage *qtForMCUsSdk)
|
void McuSupportOptions::upgradeKitInPlace(ProjectExplorer::Kit *kit,
|
||||||
|
const McuTarget *mcuTarget,
|
||||||
|
const McuPackage *qtForMCUsSdk)
|
||||||
{
|
{
|
||||||
setKitProperties(kitName(mcuTarget), kit, mcuTarget, qtForMCUsSdk->path());
|
setKitProperties(kitName(mcuTarget), kit, mcuTarget, qtForMCUsSdk->path());
|
||||||
setKitEnvironment(kit, mcuTarget, qtForMCUsSdk);
|
setKitEnvironment(kit, mcuTarget, qtForMCUsSdk);
|
||||||
@@ -978,7 +998,7 @@ void McuSupportOptions::fixKitsDependencies()
|
|||||||
FilePath dir = qtForMCUsPackage->path();
|
FilePath dir = qtForMCUsPackage->path();
|
||||||
McuSdkRepository repo;
|
McuSdkRepository repo;
|
||||||
Sdk::targetsAndPackages(dir, &repo);
|
Sdk::targetsAndPackages(dir, &repo);
|
||||||
for (const auto &target: qAsConst(repo.mcuTargets)) {
|
for (const auto &target : qAsConst(repo.mcuTargets)) {
|
||||||
if (target->isValid()) {
|
if (target->isValid()) {
|
||||||
for (auto kit : kitsWithMismatchedDependencies(target)) {
|
for (auto kit : kitsWithMismatchedDependencies(target)) {
|
||||||
updateKitEnvironment(kit, target);
|
updateKitEnvironment(kit, target);
|
||||||
@@ -996,7 +1016,7 @@ void McuSupportOptions::fixKitsDependencies()
|
|||||||
void McuSupportOptions::fixExistingKits()
|
void McuSupportOptions::fixExistingKits()
|
||||||
{
|
{
|
||||||
for (Kit *kit : KitManager::kits()) {
|
for (Kit *kit : KitManager::kits()) {
|
||||||
if (!kit->hasValue(Constants::KIT_MCUTARGET_KITVERSION_KEY) )
|
if (!kit->hasValue(Constants::KIT_MCUTARGET_KITVERSION_KEY))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (kit->isAutoDetected()) {
|
if (kit->isAutoDetected()) {
|
||||||
@@ -1052,8 +1072,8 @@ void McuSupportOptions::fixExistingKits()
|
|||||||
FilePath dir = qtForMCUsPackage->path();
|
FilePath dir = qtForMCUsPackage->path();
|
||||||
McuSdkRepository repo;
|
McuSdkRepository repo;
|
||||||
Sdk::targetsAndPackages(dir, &repo);
|
Sdk::targetsAndPackages(dir, &repo);
|
||||||
for (const auto &target: qAsConst(repo.mcuTargets))
|
for (const auto &target : qAsConst(repo.mcuTargets))
|
||||||
for (auto kit: existingKits(target)) {
|
for (auto kit : existingKits(target)) {
|
||||||
if (McuDependenciesKitAspect::dependencies(kit).isEmpty()) {
|
if (McuDependenciesKitAspect::dependencies(kit).isEmpty()) {
|
||||||
setKitDependencies(kit, target, qtForMCUsPackage);
|
setKitDependencies(kit, target, qtForMCUsPackage);
|
||||||
}
|
}
|
||||||
@@ -1064,5 +1084,5 @@ void McuSupportOptions::fixExistingKits()
|
|||||||
delete qtForMCUsPackage;
|
delete qtForMCUsPackage;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // namespace Internal
|
||||||
} // McuSupport
|
} // namespace McuSupport
|
||||||
|
@@ -38,12 +38,12 @@ namespace Utils {
|
|||||||
class FilePath;
|
class FilePath;
|
||||||
class PathChooser;
|
class PathChooser;
|
||||||
class InfoLabel;
|
class InfoLabel;
|
||||||
}
|
} // namespace Utils
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Kit;
|
||||||
class ToolChain;
|
class ToolChain;
|
||||||
}
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
namespace McuSupport {
|
namespace McuSupport {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -58,13 +58,10 @@ class McuTarget : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class OS {
|
enum class OS { Desktop, BareMetal, FreeRTOS };
|
||||||
Desktop,
|
|
||||||
BareMetal,
|
|
||||||
FreeRTOS
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Platform {
|
struct Platform
|
||||||
|
{
|
||||||
QString name;
|
QString name;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
QString vendor;
|
QString vendor;
|
||||||
@@ -92,7 +89,7 @@ private:
|
|||||||
const QVersionNumber m_qulVersion;
|
const QVersionNumber m_qulVersion;
|
||||||
const Platform m_platform;
|
const Platform m_platform;
|
||||||
const OS m_os;
|
const OS m_os;
|
||||||
const QVector<McuPackage*> m_packages;
|
const QVector<McuPackage *> m_packages;
|
||||||
const McuToolChainPackage *m_toolChainPackage;
|
const McuToolChainPackage *m_toolChainPackage;
|
||||||
const int m_colorDepth;
|
const int m_colorDepth;
|
||||||
};
|
};
|
||||||
@@ -100,8 +97,8 @@ private:
|
|||||||
class McuSdkRepository
|
class McuSdkRepository
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QVector<McuPackage*> packages;
|
QVector<McuPackage *> packages;
|
||||||
QVector<McuTarget*> mcuTargets;
|
QVector<McuTarget *> mcuTargets;
|
||||||
|
|
||||||
void deletePackagesAndTargets();
|
void deletePackagesAndTargets();
|
||||||
};
|
};
|
||||||
@@ -111,11 +108,7 @@ class McuSupportOptions : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum UpgradeOption {
|
enum UpgradeOption { Ignore, Keep, Replace };
|
||||||
Ignore,
|
|
||||||
Keep,
|
|
||||||
Replace
|
|
||||||
};
|
|
||||||
|
|
||||||
McuSupportOptions(QObject *parent = nullptr);
|
McuSupportOptions(QObject *parent = nullptr);
|
||||||
~McuSupportOptions() override;
|
~McuSupportOptions() override;
|
||||||
@@ -126,11 +119,13 @@ public:
|
|||||||
void setQulDir(const Utils::FilePath &dir);
|
void setQulDir(const Utils::FilePath &dir);
|
||||||
static Utils::FilePath qulDirFromSettings();
|
static Utils::FilePath qulDirFromSettings();
|
||||||
|
|
||||||
static QString kitName(const McuTarget* mcuTarget);
|
static QString kitName(const McuTarget *mcuTarget);
|
||||||
|
|
||||||
static QList<ProjectExplorer::Kit *> existingKits(const McuTarget *mcuTarget);
|
static QList<ProjectExplorer::Kit *> existingKits(const McuTarget *mcuTarget);
|
||||||
static QList<ProjectExplorer::Kit *> matchingKits(const McuTarget *mcuTarget, const McuPackage *qtForMCUsSdkPackage);
|
static QList<ProjectExplorer::Kit *> matchingKits(const McuTarget *mcuTarget,
|
||||||
static QList<ProjectExplorer::Kit *> upgradeableKits(const McuTarget *mcuTarget, const McuPackage *qtForMCUsSdkPackage);
|
const McuPackage *qtForMCUsSdkPackage);
|
||||||
|
static QList<ProjectExplorer::Kit *> upgradeableKits(const McuTarget *mcuTarget,
|
||||||
|
const McuPackage *qtForMCUsSdkPackage);
|
||||||
static QList<ProjectExplorer::Kit *> kitsWithMismatchedDependencies(const McuTarget *mcuTarget);
|
static QList<ProjectExplorer::Kit *> kitsWithMismatchedDependencies(const McuTarget *mcuTarget);
|
||||||
static QList<ProjectExplorer::Kit *> outdatedKits();
|
static QList<ProjectExplorer::Kit *> outdatedKits();
|
||||||
static void removeOutdatedKits();
|
static void removeOutdatedKits();
|
||||||
@@ -138,7 +133,9 @@ public:
|
|||||||
static void createAutomaticKits();
|
static void createAutomaticKits();
|
||||||
static UpgradeOption askForKitUpgrades();
|
static UpgradeOption askForKitUpgrades();
|
||||||
static void upgradeKits(UpgradeOption upgradeOption);
|
static void upgradeKits(UpgradeOption upgradeOption);
|
||||||
static void upgradeKitInPlace(ProjectExplorer::Kit *kit, const McuTarget *mcuTarget, const McuPackage *qtForMCUsSdk);
|
static void upgradeKitInPlace(ProjectExplorer::Kit *kit,
|
||||||
|
const McuTarget *mcuTarget,
|
||||||
|
const McuPackage *qtForMCUsSdk);
|
||||||
static void fixKitsDependencies();
|
static void fixKitsDependencies();
|
||||||
void checkUpgradeableKits();
|
void checkUpgradeableKits();
|
||||||
static void fixExistingKits();
|
static void fixExistingKits();
|
||||||
@@ -149,7 +146,10 @@ public:
|
|||||||
static const QVersionNumber &minimalQulVersion();
|
static const QVersionNumber &minimalQulVersion();
|
||||||
|
|
||||||
static QVersionNumber kitQulVersion(const ProjectExplorer::Kit *kit);
|
static QVersionNumber kitQulVersion(const ProjectExplorer::Kit *kit);
|
||||||
static bool kitUpToDate(const ProjectExplorer::Kit *kit, const McuTarget *mcuTarget, const McuPackage *qtForMCUsSdkPackage);
|
static bool kitUpToDate(const ProjectExplorer::Kit *kit,
|
||||||
|
const McuTarget *mcuTarget,
|
||||||
|
const McuPackage *qtForMCUsSdkPackage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void deletePackagesAndTargets();
|
void deletePackagesAndTargets();
|
||||||
|
|
||||||
|
@@ -23,9 +23,9 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "mcusupportoptionspage.h"
|
||||||
#include "mcupackage.h"
|
#include "mcupackage.h"
|
||||||
#include "mcusupportconstants.h"
|
#include "mcusupportconstants.h"
|
||||||
#include "mcusupportoptionspage.h"
|
|
||||||
#include "mcusupportoptions.h"
|
#include "mcusupportoptions.h"
|
||||||
#include "mcusupportsdk.h"
|
#include "mcusupportsdk.h"
|
||||||
|
|
||||||
@@ -42,9 +42,9 @@
|
|||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
@@ -71,8 +71,8 @@ private:
|
|||||||
|
|
||||||
QString m_armGccPath;
|
QString m_armGccPath;
|
||||||
McuSupportOptions m_options;
|
McuSupportOptions m_options;
|
||||||
QMap <McuPackage*, QWidget*> m_packageWidgets;
|
QMap<McuPackage *, QWidget *> m_packageWidgets;
|
||||||
QMap <McuTarget*, QWidget*> m_mcuTargetPacketWidgets;
|
QMap<McuTarget *, QWidget *> m_mcuTargetPacketWidgets;
|
||||||
QFormLayout *m_packagesLayout = nullptr;
|
QFormLayout *m_packagesLayout = nullptr;
|
||||||
QGroupBox *m_qtForMCUsSdkGroupBox = nullptr;
|
QGroupBox *m_qtForMCUsSdkGroupBox = nullptr;
|
||||||
QGroupBox *m_packagesGroupBox = nullptr;
|
QGroupBox *m_packagesGroupBox = nullptr;
|
||||||
@@ -110,17 +110,21 @@ McuSupportOptionsWidget::McuSupportOptionsWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
m_mcuTargetsGroupBox = new QGroupBox(tr("Targets supported by the %1")
|
m_mcuTargetsGroupBox = new QGroupBox(
|
||||||
.arg(m_qtForMCUsSdkGroupBox->title()));
|
tr("Targets supported by the %1").arg(m_qtForMCUsSdkGroupBox->title()));
|
||||||
m_mcuTargetsGroupBox->setFlat(true);
|
m_mcuTargetsGroupBox->setFlat(true);
|
||||||
mainLayout->addWidget(m_mcuTargetsGroupBox);
|
mainLayout->addWidget(m_mcuTargetsGroupBox);
|
||||||
m_mcuTargetsComboBox = new QComboBox;
|
m_mcuTargetsComboBox = new QComboBox;
|
||||||
auto layout = new QVBoxLayout(m_mcuTargetsGroupBox);
|
auto layout = new QVBoxLayout(m_mcuTargetsGroupBox);
|
||||||
layout->addWidget(m_mcuTargetsComboBox);
|
layout->addWidget(m_mcuTargetsComboBox);
|
||||||
connect(m_mcuTargetsComboBox, &QComboBox::currentTextChanged,
|
connect(m_mcuTargetsComboBox,
|
||||||
this, &McuSupportOptionsWidget::showMcuTargetPackages);
|
&QComboBox::currentTextChanged,
|
||||||
connect(m_options.qtForMCUsSdkPackage, &McuPackage::changed,
|
this,
|
||||||
this, &McuSupportOptionsWidget::populateMcuTargetsComboBox);
|
&McuSupportOptionsWidget::showMcuTargetPackages);
|
||||||
|
connect(m_options.qtForMCUsSdkPackage,
|
||||||
|
&McuPackage::changed,
|
||||||
|
this,
|
||||||
|
&McuSupportOptionsWidget::populateMcuTargetsComboBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -137,9 +141,11 @@ McuSupportOptionsWidget::McuSupportOptionsWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
m_kitAutomaticCreationCheckBox = new QCheckBox(tr("Automatically create kits for all available targets on start"));
|
m_kitAutomaticCreationCheckBox = new QCheckBox(
|
||||||
connect(m_kitAutomaticCreationCheckBox, &QCheckBox::stateChanged, this, [this] (int state) {
|
tr("Automatically create kits for all available targets on start"));
|
||||||
m_options.qtForMCUsSdkPackage->setAutomaticKitCreationEnabled(state == Qt::CheckState::Checked);
|
connect(m_kitAutomaticCreationCheckBox, &QCheckBox::stateChanged, this, [this](int state) {
|
||||||
|
m_options.qtForMCUsSdkPackage->setAutomaticKitCreationEnabled(
|
||||||
|
state == Qt::CheckState::Checked);
|
||||||
});
|
});
|
||||||
mainLayout->addWidget(m_kitAutomaticCreationCheckBox);
|
mainLayout->addWidget(m_kitAutomaticCreationCheckBox);
|
||||||
}
|
}
|
||||||
@@ -161,7 +167,8 @@ McuSupportOptionsWidget::McuSupportOptionsWidget()
|
|||||||
m_kitUpdatePushButton = new QPushButton(tr("Update Kit"));
|
m_kitUpdatePushButton = new QPushButton(tr("Update Kit"));
|
||||||
m_kitUpdatePushButton->setSizePolicy(m_kitCreationPushButton->sizePolicy());
|
m_kitUpdatePushButton->setSizePolicy(m_kitCreationPushButton->sizePolicy());
|
||||||
connect(m_kitUpdatePushButton, &QPushButton::clicked, this, [this] {
|
connect(m_kitUpdatePushButton, &QPushButton::clicked, this, [this] {
|
||||||
for (auto kit: McuSupportOptions::upgradeableKits(currentMcuTarget(), m_options.qtForMCUsSdkPackage))
|
for (auto kit : McuSupportOptions::upgradeableKits(currentMcuTarget(),
|
||||||
|
m_options.qtForMCUsSdkPackage))
|
||||||
m_options.upgradeKitInPlace(kit, currentMcuTarget(), m_options.qtForMCUsSdkPackage);
|
m_options.upgradeKitInPlace(kit, currentMcuTarget(), m_options.qtForMCUsSdkPackage);
|
||||||
updateStatus();
|
updateStatus();
|
||||||
});
|
});
|
||||||
@@ -185,8 +192,7 @@ void McuSupportOptionsWidget::updateStatus()
|
|||||||
// Page elements
|
// Page elements
|
||||||
{
|
{
|
||||||
m_qtForMCUsSdkGroupBox->setVisible(cMakeAvailable);
|
m_qtForMCUsSdkGroupBox->setVisible(cMakeAvailable);
|
||||||
const bool valid = cMakeAvailable &&
|
const bool valid = cMakeAvailable && m_options.qtForMCUsSdkPackage->validStatus();
|
||||||
m_options.qtForMCUsSdkPackage->validStatus();
|
|
||||||
const bool ready = valid && mcuTarget;
|
const bool ready = valid && mcuTarget;
|
||||||
m_mcuTargetsGroupBox->setVisible(ready);
|
m_mcuTargetsGroupBox->setVisible(ready);
|
||||||
m_packagesGroupBox->setVisible(ready && !mcuTarget->packages().isEmpty());
|
m_packagesGroupBox->setVisible(ready && !mcuTarget->packages().isEmpty());
|
||||||
@@ -200,7 +206,7 @@ void McuSupportOptionsWidget::updateStatus()
|
|||||||
m_mcuTargetsInfoLabel->setText(deprecationMessage);
|
m_mcuTargetsInfoLabel->setText(deprecationMessage);
|
||||||
else
|
else
|
||||||
m_mcuTargetsInfoLabel->setText(tr("No valid kit descriptions found at %1.")
|
m_mcuTargetsInfoLabel->setText(tr("No valid kit descriptions found at %1.")
|
||||||
.arg(Sdk::kitsPath(sdkPath).toUserOutput()));
|
.arg(Sdk::kitsPath(sdkPath).toUserOutput()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,25 +216,25 @@ void McuSupportOptionsWidget::updateStatus()
|
|||||||
m_kitCreationPushButton->setVisible(mcuTargetValid);
|
m_kitCreationPushButton->setVisible(mcuTargetValid);
|
||||||
m_kitUpdatePushButton->setVisible(mcuTargetValid);
|
m_kitUpdatePushButton->setVisible(mcuTargetValid);
|
||||||
if (mcuTargetValid) {
|
if (mcuTargetValid) {
|
||||||
const bool hasMatchingKits = !McuSupportOptions::matchingKits(
|
const bool hasMatchingKits
|
||||||
mcuTarget, m_options.qtForMCUsSdkPackage).isEmpty();
|
= !McuSupportOptions::matchingKits(mcuTarget, m_options.qtForMCUsSdkPackage)
|
||||||
const bool hasUpgradeableKits = !hasMatchingKits &&
|
.isEmpty();
|
||||||
!McuSupportOptions::upgradeableKits(
|
const bool hasUpgradeableKits
|
||||||
mcuTarget, m_options.qtForMCUsSdkPackage).isEmpty();
|
= !hasMatchingKits
|
||||||
|
&& !McuSupportOptions::upgradeableKits(mcuTarget, m_options.qtForMCUsSdkPackage)
|
||||||
|
.isEmpty();
|
||||||
|
|
||||||
m_kitCreationPushButton->setEnabled(!hasMatchingKits);
|
m_kitCreationPushButton->setEnabled(!hasMatchingKits);
|
||||||
m_kitUpdatePushButton->setEnabled(hasUpgradeableKits);
|
m_kitUpdatePushButton->setEnabled(hasUpgradeableKits);
|
||||||
|
|
||||||
m_kitCreationInfoLabel->setType(!hasMatchingKits
|
m_kitCreationInfoLabel->setType(!hasMatchingKits ? Utils::InfoLabel::Information
|
||||||
? Utils::InfoLabel::Information
|
: Utils::InfoLabel::Ok);
|
||||||
: Utils::InfoLabel::Ok);
|
|
||||||
|
|
||||||
m_kitCreationInfoLabel->setText(
|
m_kitCreationInfoLabel->setText(
|
||||||
hasMatchingKits ?
|
hasMatchingKits
|
||||||
tr("A kit for the selected target and SDK version already exists.")
|
? tr("A kit for the selected target and SDK version already exists.")
|
||||||
: hasUpgradeableKits ?
|
: hasUpgradeableKits ? tr("Kits for a different SDK version exist.")
|
||||||
tr("Kits for a different SDK version exist.")
|
: tr("A kit for the selected target can be created."));
|
||||||
: tr("A kit for the selected target can be created."));
|
|
||||||
} else {
|
} else {
|
||||||
m_kitCreationInfoLabel->setType(Utils::InfoLabel::NotOk);
|
m_kitCreationInfoLabel->setType(Utils::InfoLabel::NotOk);
|
||||||
m_kitCreationInfoLabel->setText("Provide the package paths in order to create a kit "
|
m_kitCreationInfoLabel->setText("Provide the package paths in order to create a kit "
|
||||||
@@ -237,7 +243,8 @@ void McuSupportOptionsWidget::updateStatus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Automatic Kit creation
|
// Automatic Kit creation
|
||||||
m_kitAutomaticCreationCheckBox->setChecked(m_options.qtForMCUsSdkPackage->automaticKitCreationEnabled());
|
m_kitAutomaticCreationCheckBox->setChecked(
|
||||||
|
m_options.qtForMCUsSdkPackage->automaticKitCreationEnabled());
|
||||||
|
|
||||||
// Status label in the bottom
|
// Status label in the bottom
|
||||||
{
|
{
|
||||||
@@ -277,8 +284,8 @@ McuTarget *McuSupportOptionsWidget::currentMcuTarget() const
|
|||||||
{
|
{
|
||||||
const int mcuTargetIndex = m_mcuTargetsComboBox->currentIndex();
|
const int mcuTargetIndex = m_mcuTargetsComboBox->currentIndex();
|
||||||
return (mcuTargetIndex == -1 || m_options.sdkRepository.mcuTargets.isEmpty())
|
return (mcuTargetIndex == -1 || m_options.sdkRepository.mcuTargets.isEmpty())
|
||||||
? nullptr
|
? nullptr
|
||||||
: m_options.sdkRepository.mcuTargets.at(mcuTargetIndex);
|
: m_options.sdkRepository.mcuTargets.at(mcuTargetIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void McuSupportOptionsWidget::showEvent(QShowEvent *event)
|
void McuSupportOptionsWidget::showEvent(QShowEvent *event)
|
||||||
@@ -307,9 +314,8 @@ void McuSupportOptionsWidget::populateMcuTargetsComboBox()
|
|||||||
m_options.populatePackagesAndTargets();
|
m_options.populatePackagesAndTargets();
|
||||||
m_mcuTargetsComboBox->clear();
|
m_mcuTargetsComboBox->clear();
|
||||||
m_mcuTargetsComboBox->addItems(
|
m_mcuTargetsComboBox->addItems(
|
||||||
Utils::transform<QStringList>(m_options.sdkRepository.mcuTargets, [](McuTarget *t) {
|
Utils::transform<QStringList>(m_options.sdkRepository.mcuTargets,
|
||||||
return McuSupportOptions::kitName(t);
|
[](McuTarget *t) { return McuSupportOptions::kitName(t); }));
|
||||||
}));
|
|
||||||
updateStatus();
|
updateStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,5 +327,5 @@ McuSupportOptionsPage::McuSupportOptionsPage()
|
|||||||
setWidgetCreator([] { return new McuSupportOptionsWidget; });
|
setWidgetCreator([] { return new McuSupportOptionsWidget; });
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // namespace Internal
|
||||||
} // McuSupport
|
} // namespace McuSupport
|
||||||
|
@@ -23,8 +23,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "mcukitinformation.h"
|
|
||||||
#include "mcusupportplugin.h"
|
#include "mcusupportplugin.h"
|
||||||
|
#include "mcukitinformation.h"
|
||||||
#include "mcusupportconstants.h"
|
#include "mcusupportconstants.h"
|
||||||
#include "mcusupportdevice.h"
|
#include "mcusupportdevice.h"
|
||||||
#include "mcusupportoptions.h"
|
#include "mcusupportoptions.h"
|
||||||
@@ -54,11 +54,9 @@ class McuSupportPluginPrivate
|
|||||||
public:
|
public:
|
||||||
McuSupportDeviceFactory deviceFactory;
|
McuSupportDeviceFactory deviceFactory;
|
||||||
McuSupportRunConfigurationFactory runConfigurationFactory;
|
McuSupportRunConfigurationFactory runConfigurationFactory;
|
||||||
RunWorkerFactory runWorkerFactory{
|
RunWorkerFactory runWorkerFactory{makeFlashAndRunWorker(),
|
||||||
makeFlashAndRunWorker(),
|
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
{Constants::RUNCONFIGURATION}};
|
||||||
{Constants::RUNCONFIGURATION}
|
|
||||||
};
|
|
||||||
McuSupportOptionsPage optionsPage;
|
McuSupportOptionsPage optionsPage;
|
||||||
McuDependenciesKitAspect environmentPathsKitAspect;
|
McuDependenciesKitAspect environmentPathsKitAspect;
|
||||||
};
|
};
|
||||||
@@ -76,7 +74,7 @@ McuSupportPlugin::~McuSupportPlugin()
|
|||||||
dd = nullptr;
|
dd = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool McuSupportPlugin::initialize(const QStringList& arguments, QString* errorString)
|
bool McuSupportPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
Q_UNUSED(errorString)
|
Q_UNUSED(errorString)
|
||||||
@@ -94,7 +92,7 @@ void McuSupportPlugin::extensionsInitialized()
|
|||||||
{
|
{
|
||||||
ProjectExplorer::DeviceManager::instance()->addDevice(McuSupportDevice::create());
|
ProjectExplorer::DeviceManager::instance()->addDevice(McuSupportDevice::create());
|
||||||
|
|
||||||
connect(KitManager::instance(), &KitManager::kitsLoaded, [](){
|
connect(KitManager::instance(), &KitManager::kitsLoaded, []() {
|
||||||
McuSupportOptions::removeOutdatedKits();
|
McuSupportOptions::removeOutdatedKits();
|
||||||
McuSupportOptions::createAutomaticKits();
|
McuSupportOptions::createAutomaticKits();
|
||||||
McuSupportOptions::fixExistingKits();
|
McuSupportOptions::fixExistingKits();
|
||||||
@@ -134,12 +132,11 @@ void McuSupportPlugin::askUserAboutMcuSupportKitsUpgrade()
|
|||||||
Utils::InfoBarEntry::GlobalSuppression::Enabled);
|
Utils::InfoBarEntry::GlobalSuppression::Enabled);
|
||||||
|
|
||||||
static McuSupportOptions::UpgradeOption selectedOption;
|
static McuSupportOptions::UpgradeOption selectedOption;
|
||||||
const QStringList options = { tr("Create new kits"), tr("Replace existing kits") };
|
const QStringList options = {tr("Create new kits"), tr("Replace existing kits")};
|
||||||
selectedOption = McuSupportOptions::UpgradeOption::Keep;
|
selectedOption = McuSupportOptions::UpgradeOption::Keep;
|
||||||
info.setComboInfo(options, [options](const QString &selected) {
|
info.setComboInfo(options, [options](const QString &selected) {
|
||||||
selectedOption = options.indexOf(selected) == 0 ?
|
selectedOption = options.indexOf(selected) == 0 ? McuSupportOptions::UpgradeOption::Keep
|
||||||
McuSupportOptions::UpgradeOption::Keep :
|
: McuSupportOptions::UpgradeOption::Replace;
|
||||||
McuSupportOptions::UpgradeOption::Replace;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
info.addCustomButton(tr("Proceed"), [upgradeMcuSupportKits] {
|
info.addCustomButton(tr("Proceed"), [upgradeMcuSupportKits] {
|
||||||
|
@@ -46,16 +46,18 @@ namespace Internal {
|
|||||||
|
|
||||||
static FilePath cmakeFilePath(const Target *target)
|
static FilePath cmakeFilePath(const Target *target)
|
||||||
{
|
{
|
||||||
const CMakeProjectManager::CMakeTool *tool =
|
const CMakeProjectManager::CMakeTool *tool = CMakeProjectManager::CMakeKitAspect::cmakeTool(
|
||||||
CMakeProjectManager::CMakeKitAspect::cmakeTool(target->kit());
|
target->kit());
|
||||||
return tool->filePath();
|
return tool->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList flashAndRunArgs(const RunConfiguration *rc, const Target *target)
|
static QStringList flashAndRunArgs(const RunConfiguration *rc, const Target *target)
|
||||||
{
|
{
|
||||||
// Use buildKey if provided, fallback to projectName
|
// Use buildKey if provided, fallback to projectName
|
||||||
const QString targetName = QLatin1String("flash_%1").arg(
|
const QString targetName = QLatin1String("flash_%1")
|
||||||
!rc->buildKey().isEmpty() ? rc->buildKey() : target->project()->displayName());
|
.arg(!rc->buildKey().isEmpty()
|
||||||
|
? rc->buildKey()
|
||||||
|
: target->project()->displayName());
|
||||||
|
|
||||||
return {"--build", ".", "--target", targetName};
|
return {"--build", ".", "--target", targetName};
|
||||||
}
|
}
|
||||||
|
@@ -23,10 +23,10 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "mcusupportsdk.h"
|
||||||
#include "mcupackage.h"
|
#include "mcupackage.h"
|
||||||
#include "mcusupportconstants.h"
|
#include "mcusupportconstants.h"
|
||||||
#include "mcusupportoptions.h"
|
#include "mcusupportoptions.h"
|
||||||
#include "mcusupportsdk.h"
|
|
||||||
#include "mcusupportversiondetection.h"
|
#include "mcusupportversiondetection.h"
|
||||||
|
|
||||||
#include <baremetal/baremetalconstants.h>
|
#include <baremetal/baremetalconstants.h>
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/hostosinfo.h>
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
@@ -106,11 +106,10 @@ static McuToolChainPackage *createArmGccPackage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QString detectionPath = Utils::HostOsInfo::withExecutableSuffix("bin/arm-none-eabi-g++");
|
const QString detectionPath = Utils::HostOsInfo::withExecutableSuffix("bin/arm-none-eabi-g++");
|
||||||
const auto versionDetector = new McuPackageExecutableVersionDetector(
|
const auto versionDetector
|
||||||
detectionPath,
|
= new McuPackageExecutableVersionDetector(detectionPath,
|
||||||
{ "--version" },
|
{"--version"},
|
||||||
"\\b(\\d+\\.\\d+\\.\\d+)\\b"
|
"\\b(\\d+\\.\\d+\\.\\d+)\\b");
|
||||||
);
|
|
||||||
|
|
||||||
return new McuToolChainPackage(McuPackage::tr("GNU Arm Embedded Toolchain"),
|
return new McuToolChainPackage(McuPackage::tr("GNU Arm Embedded Toolchain"),
|
||||||
defaultPath,
|
defaultPath,
|
||||||
@@ -127,11 +126,10 @@ static McuToolChainPackage *createGhsToolchainPackage()
|
|||||||
|
|
||||||
const FilePath defaultPath = FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
const FilePath defaultPath = FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
||||||
|
|
||||||
const auto versionDetector = new McuPackageExecutableVersionDetector(
|
const auto versionDetector
|
||||||
Utils::HostOsInfo::withExecutableSuffix("as850"),
|
= new McuPackageExecutableVersionDetector(Utils::HostOsInfo::withExecutableSuffix("as850"),
|
||||||
{"-V"},
|
{"-V"},
|
||||||
"\\bv(\\d+\\.\\d+\\.\\d+)\\b"
|
"\\bv(\\d+\\.\\d+\\.\\d+)\\b");
|
||||||
);
|
|
||||||
|
|
||||||
return new McuToolChainPackage("Green Hills Compiler",
|
return new McuToolChainPackage("Green Hills Compiler",
|
||||||
defaultPath,
|
defaultPath,
|
||||||
@@ -149,11 +147,10 @@ static McuToolChainPackage *createGhsArmToolchainPackage()
|
|||||||
|
|
||||||
const FilePath defaultPath = FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
const FilePath defaultPath = FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
||||||
|
|
||||||
const auto versionDetector = new McuPackageExecutableVersionDetector(
|
const auto versionDetector
|
||||||
Utils::HostOsInfo::withExecutableSuffix("asarm"),
|
= new McuPackageExecutableVersionDetector(Utils::HostOsInfo::withExecutableSuffix("asarm"),
|
||||||
{"-V"},
|
{"-V"},
|
||||||
"\\bv(\\d+\\.\\d+\\.\\d+)\\b"
|
"\\bv(\\d+\\.\\d+\\.\\d+)\\b");
|
||||||
);
|
|
||||||
|
|
||||||
return new McuToolChainPackage("Green Hills Compiler for ARM",
|
return new McuToolChainPackage("Green Hills Compiler for ARM",
|
||||||
defaultPath,
|
defaultPath,
|
||||||
@@ -172,10 +169,10 @@ static McuToolChainPackage *createIarToolChainPackage()
|
|||||||
if (qEnvironmentVariableIsSet(envVar))
|
if (qEnvironmentVariableIsSet(envVar))
|
||||||
defaultPath = FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
defaultPath = FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
||||||
else {
|
else {
|
||||||
const ProjectExplorer::ToolChain *tc =
|
const ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainManager::toolChain(
|
||||||
ProjectExplorer::ToolChainManager::toolChain([](const ProjectExplorer::ToolChain *t) {
|
[](const ProjectExplorer::ToolChain *t) {
|
||||||
return t->typeId() == BareMetal::Constants::IAREW_TOOLCHAIN_TYPEID;
|
return t->typeId() == BareMetal::Constants::IAREW_TOOLCHAIN_TYPEID;
|
||||||
});
|
});
|
||||||
if (tc) {
|
if (tc) {
|
||||||
const FilePath compilerExecPath = tc->compilerCommand();
|
const FilePath compilerExecPath = tc->compilerCommand();
|
||||||
defaultPath = compilerExecPath.parentDir().parentDir();
|
defaultPath = compilerExecPath.parentDir().parentDir();
|
||||||
@@ -183,11 +180,10 @@ static McuToolChainPackage *createIarToolChainPackage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QString detectionPath = Utils::HostOsInfo::withExecutableSuffix("bin/iccarm");
|
const QString detectionPath = Utils::HostOsInfo::withExecutableSuffix("bin/iccarm");
|
||||||
const auto versionDetector = new McuPackageExecutableVersionDetector(
|
const auto versionDetector
|
||||||
detectionPath,
|
= new McuPackageExecutableVersionDetector(detectionPath,
|
||||||
{"--version"},
|
{"--version"},
|
||||||
"\\bV(\\d+\\.\\d+\\.\\d+)\\.\\d+\\b"
|
"\\bV(\\d+\\.\\d+\\.\\d+)\\.\\d+\\b");
|
||||||
);
|
|
||||||
|
|
||||||
return new McuToolChainPackage("IAR ARM Compiler",
|
return new McuToolChainPackage("IAR ARM Compiler",
|
||||||
defaultPath,
|
defaultPath,
|
||||||
@@ -206,11 +202,12 @@ static McuPackage *createRGLPackage()
|
|||||||
if (qEnvironmentVariableIsSet(envVar)) {
|
if (qEnvironmentVariableIsSet(envVar)) {
|
||||||
defaultPath = FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
defaultPath = FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
||||||
} else if (Utils::HostOsInfo::isWindowsHost()) {
|
} else if (Utils::HostOsInfo::isWindowsHost()) {
|
||||||
const FilePath rglPath = FilePath::fromString(QDir::rootPath()) / "Renesas_Electronics/D1x_RGL";
|
const FilePath rglPath = FilePath::fromString(QDir::rootPath())
|
||||||
|
/ "Renesas_Electronics/D1x_RGL";
|
||||||
if (rglPath.exists()) {
|
if (rglPath.exists()) {
|
||||||
defaultPath = rglPath;
|
defaultPath = rglPath;
|
||||||
const FilePaths subDirs =
|
const FilePaths subDirs = defaultPath.dirEntries(
|
||||||
defaultPath.dirEntries({{"rgl_ghs_D1Mx_*"}, QDir::Dirs | QDir::NoDotAndDotDot});
|
{{"rgl_ghs_D1Mx_*"}, QDir::Dirs | QDir::NoDotAndDotDot});
|
||||||
if (subDirs.count() == 1)
|
if (subDirs.count() == 1)
|
||||||
defaultPath = subDirs.first();
|
defaultPath = subDirs.first();
|
||||||
}
|
}
|
||||||
@@ -262,8 +259,8 @@ static McuPackage *createMcuXpressoIdePackage()
|
|||||||
if (programPath.exists()) {
|
if (programPath.exists()) {
|
||||||
defaultPath = programPath;
|
defaultPath = programPath;
|
||||||
// If default dir has exactly one sub dir that could be the IDE path, pre-select that.
|
// If default dir has exactly one sub dir that could be the IDE path, pre-select that.
|
||||||
const FilePaths subDirs =
|
const FilePaths subDirs = defaultPath.dirEntries(
|
||||||
defaultPath.dirEntries({{"MCUXpressoIDE*"}, QDir::Dirs | QDir::NoDotAndDotDot});
|
{{"MCUXpressoIDE*"}, QDir::Dirs | QDir::NoDotAndDotDot});
|
||||||
if (subDirs.count() == 1)
|
if (subDirs.count() == 1)
|
||||||
defaultPath = subDirs.first();
|
defaultPath = subDirs.first();
|
||||||
}
|
}
|
||||||
@@ -300,12 +297,11 @@ static McuPackage *createCypressProgrammerPackage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = new McuPackage(
|
auto result = new McuPackage("Cypress Auto Flash Utility",
|
||||||
"Cypress Auto Flash Utility",
|
defaultPath,
|
||||||
defaultPath,
|
Utils::HostOsInfo::withExecutableSuffix("/bin/openocd"),
|
||||||
Utils::HostOsInfo::withExecutableSuffix("/bin/openocd"),
|
"CypressAutoFlashUtil",
|
||||||
"CypressAutoFlashUtil",
|
envVar);
|
||||||
envVar);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,54 +323,57 @@ static McuPackage *createRenesasProgrammerPackage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = new McuPackage(
|
auto result = new McuPackage("Renesas Flash Programmer",
|
||||||
"Renesas Flash Programmer",
|
defaultPath,
|
||||||
defaultPath,
|
Utils::HostOsInfo::withExecutableSuffix("rfp-cli"),
|
||||||
Utils::HostOsInfo::withExecutableSuffix("rfp-cli"),
|
"RenesasFlashProgrammer",
|
||||||
"RenesasFlashProgrammer",
|
envVar);
|
||||||
envVar);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct McuTargetDescription
|
struct McuTargetDescription
|
||||||
{
|
{
|
||||||
enum class TargetType {
|
enum class TargetType { MCU, Desktop };
|
||||||
MCU,
|
|
||||||
Desktop
|
|
||||||
};
|
|
||||||
|
|
||||||
QString qulVersion;
|
QString qulVersion;
|
||||||
QString compatVersion;
|
QString compatVersion;
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
QString id;
|
QString id;
|
||||||
QString name;
|
QString name;
|
||||||
QString vendor;
|
QString vendor;
|
||||||
QVector<int> colorDepths;
|
QVector<int> colorDepths;
|
||||||
TargetType type;
|
TargetType type;
|
||||||
} platform;
|
} platform;
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
QString id;
|
QString id;
|
||||||
QStringList versions;
|
QStringList versions;
|
||||||
} toolchain;
|
} toolchain;
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
QString name;
|
QString name;
|
||||||
QString defaultPath;
|
QString defaultPath;
|
||||||
QString envVar;
|
QString envVar;
|
||||||
QStringList versions;
|
QStringList versions;
|
||||||
} boardSdk;
|
} boardSdk;
|
||||||
struct {
|
struct
|
||||||
|
{
|
||||||
QString envVar;
|
QString envVar;
|
||||||
QString boardSdkSubDir;
|
QString boardSdkSubDir;
|
||||||
} freeRTOS;
|
} freeRTOS;
|
||||||
};
|
};
|
||||||
|
|
||||||
static McuPackageVersionDetector* generatePackageVersionDetector(QString envVar)
|
static McuPackageVersionDetector *generatePackageVersionDetector(QString envVar)
|
||||||
{
|
{
|
||||||
if (envVar.startsWith("EVK"))
|
if (envVar.startsWith("EVK"))
|
||||||
return new McuPackageXmlVersionDetector("*_manifest_*.xml", "ksdk", "version", ".*");
|
return new McuPackageXmlVersionDetector("*_manifest_*.xml", "ksdk", "version", ".*");
|
||||||
|
|
||||||
if (envVar.startsWith("STM32"))
|
if (envVar.startsWith("STM32"))
|
||||||
return new McuPackageXmlVersionDetector("package.xml", "PackDescription", "Release", "\\b(\\d+\\.\\d+\\.\\d+)\\b");
|
return new McuPackageXmlVersionDetector("package.xml",
|
||||||
|
"PackDescription",
|
||||||
|
"Release",
|
||||||
|
"\\b(\\d+\\.\\d+\\.\\d+)\\b");
|
||||||
|
|
||||||
if (envVar.startsWith("RGL"))
|
if (envVar.startsWith("RGL"))
|
||||||
return new McuPackageDirectoryVersionDetector("rgl_*_obj_*", "\\d+\\.\\d+\\.\\w+", false);
|
return new McuPackageDirectoryVersionDetector("rgl_*_obj_*", "\\d+\\.\\d+\\.\\w+", false);
|
||||||
@@ -385,9 +384,9 @@ static McuPackageVersionDetector* generatePackageVersionDetector(QString envVar)
|
|||||||
/// Create the McuPackage by checking the "boardSdk" property in the JSON file for the board.
|
/// Create the McuPackage by checking the "boardSdk" property in the JSON file for the board.
|
||||||
/// The name of the environment variable pointing to the the SDK for the board will be defined in the "envVar" property
|
/// The name of the environment variable pointing to the the SDK for the board will be defined in the "envVar" property
|
||||||
/// inside the "boardSdk".
|
/// inside the "boardSdk".
|
||||||
static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc)
|
static McuPackage *createBoardSdkPackage(const McuTargetDescription &desc)
|
||||||
{
|
{
|
||||||
const auto generateSdkName = [](const QString& envVar) {
|
const auto generateSdkName = [](const QString &envVar) {
|
||||||
auto postfixPos = envVar.indexOf("_SDK_PATH");
|
auto postfixPos = envVar.indexOf("_SDK_PATH");
|
||||||
if (postfixPos < 0) {
|
if (postfixPos < 0) {
|
||||||
postfixPos = envVar.indexOf("_DIR");
|
postfixPos = envVar.indexOf("_DIR");
|
||||||
@@ -395,14 +394,16 @@ static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc)
|
|||||||
auto sdkName = postfixPos > 0 ? envVar.left(postfixPos) : envVar;
|
auto sdkName = postfixPos > 0 ? envVar.left(postfixPos) : envVar;
|
||||||
return QString::fromLatin1("MCU SDK (%1)").arg(sdkName);
|
return QString::fromLatin1("MCU SDK (%1)").arg(sdkName);
|
||||||
};
|
};
|
||||||
const QString sdkName = desc.boardSdk.name.isEmpty() ? generateSdkName(desc.boardSdk.envVar) : desc.boardSdk.name;
|
const QString sdkName = desc.boardSdk.name.isEmpty() ? generateSdkName(desc.boardSdk.envVar)
|
||||||
|
: desc.boardSdk.name;
|
||||||
|
|
||||||
const FilePath defaultPath = [&] {
|
const FilePath defaultPath = [&] {
|
||||||
const auto envVar = desc.boardSdk.envVar.toLatin1();
|
const auto envVar = desc.boardSdk.envVar.toLatin1();
|
||||||
if (qEnvironmentVariableIsSet(envVar))
|
if (qEnvironmentVariableIsSet(envVar))
|
||||||
return FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
return FilePath::fromUserInput(qEnvironmentVariable(envVar));
|
||||||
if (!desc.boardSdk.defaultPath.isEmpty()) {
|
if (!desc.boardSdk.defaultPath.isEmpty()) {
|
||||||
FilePath defaultPath = FilePath::fromUserInput(QDir::rootPath() + desc.boardSdk.defaultPath);
|
FilePath defaultPath = FilePath::fromUserInput(QDir::rootPath()
|
||||||
|
+ desc.boardSdk.defaultPath);
|
||||||
if (defaultPath.exists())
|
if (defaultPath.exists())
|
||||||
return defaultPath;
|
return defaultPath;
|
||||||
}
|
}
|
||||||
@@ -420,7 +421,8 @@ static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc)
|
|||||||
versionDetector);
|
versionDetector);
|
||||||
}
|
}
|
||||||
|
|
||||||
static McuPackage *createFreeRTOSSourcesPackage(const QString &envVar, const FilePath &boardSdkDir,
|
static McuPackage *createFreeRTOSSourcesPackage(const QString &envVar,
|
||||||
|
const FilePath &boardSdkDir,
|
||||||
const QString &freeRTOSBoardSdkSubDir)
|
const QString &freeRTOSBoardSdkSubDir)
|
||||||
{
|
{
|
||||||
const QString envVarPrefix = envVar.chopped(int(strlen("_FREERTOS_DIR")));
|
const QString envVarPrefix = envVar.chopped(int(strlen("_FREERTOS_DIR")));
|
||||||
@@ -447,10 +449,10 @@ struct McuTargetFactory
|
|||||||
, vendorPkgs(vendorPkgs)
|
, vendorPkgs(vendorPkgs)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QVector<McuTarget *> createTargets(const McuTargetDescription& description)
|
QVector<McuTarget *> createTargets(const McuTargetDescription &description)
|
||||||
{
|
{
|
||||||
auto qulVersion = QVersionNumber::fromString(description.qulVersion);
|
auto qulVersion = QVersionNumber::fromString(description.qulVersion);
|
||||||
if (qulVersion <= QVersionNumber({1,3})) {
|
if (qulVersion <= QVersionNumber({1, 3})) {
|
||||||
if (description.platform.type == McuTargetDescription::TargetType::Desktop)
|
if (description.platform.type == McuTargetDescription::TargetType::Desktop)
|
||||||
return createDesktopTargetsLegacy(description);
|
return createDesktopTargetsLegacy(description);
|
||||||
|
|
||||||
@@ -481,16 +483,16 @@ protected:
|
|||||||
tcPkg = createUnsupportedToolChainPackage();
|
tcPkg = createUnsupportedToolChainPackage();
|
||||||
for (auto os : {McuTarget::OS::BareMetal, McuTarget::OS::FreeRTOS}) {
|
for (auto os : {McuTarget::OS::BareMetal, McuTarget::OS::FreeRTOS}) {
|
||||||
for (int colorDepth : desc.platform.colorDepths) {
|
for (int colorDepth : desc.platform.colorDepths) {
|
||||||
QVector<McuPackage*> required3rdPartyPkgs = { tcPkg };
|
QVector<McuPackage *> required3rdPartyPkgs = {tcPkg};
|
||||||
if (vendorPkgs.contains(desc.platform.vendor))
|
if (vendorPkgs.contains(desc.platform.vendor))
|
||||||
required3rdPartyPkgs.push_back(vendorPkgs.value(desc.platform.vendor));
|
required3rdPartyPkgs.push_back(vendorPkgs.value(desc.platform.vendor));
|
||||||
|
|
||||||
FilePath boardSdkDefaultPath;
|
FilePath boardSdkDefaultPath;
|
||||||
if (!desc.boardSdk.envVar.isEmpty()) {
|
if (!desc.boardSdk.envVar.isEmpty()) {
|
||||||
if (!boardSdkPkgs.contains(desc.boardSdk.envVar)) {
|
if (!boardSdkPkgs.contains(desc.boardSdk.envVar)) {
|
||||||
auto boardSdkPkg = desc.boardSdk.envVar != "RGL_DIR"
|
auto boardSdkPkg = desc.boardSdk.envVar != "RGL_DIR"
|
||||||
? createBoardSdkPackage(desc)
|
? createBoardSdkPackage(desc)
|
||||||
: createRGLPackage();
|
: createRGLPackage();
|
||||||
boardSdkPkgs.insert(desc.boardSdk.envVar, boardSdkPkg);
|
boardSdkPkgs.insert(desc.boardSdk.envVar, boardSdkPkg);
|
||||||
}
|
}
|
||||||
auto boardSdkPkg = boardSdkPkgs.value(desc.boardSdk.envVar);
|
auto boardSdkPkg = boardSdkPkgs.value(desc.boardSdk.envVar);
|
||||||
@@ -502,15 +504,19 @@ protected:
|
|||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if (!freeRTOSPkgs.contains(desc.freeRTOS.envVar)) {
|
if (!freeRTOSPkgs.contains(desc.freeRTOS.envVar)) {
|
||||||
freeRTOSPkgs.insert(desc.freeRTOS.envVar, createFreeRTOSSourcesPackage(
|
freeRTOSPkgs
|
||||||
desc.freeRTOS.envVar, boardSdkDefaultPath,
|
.insert(desc.freeRTOS.envVar,
|
||||||
desc.freeRTOS.boardSdkSubDir));
|
createFreeRTOSSourcesPackage(desc.freeRTOS.envVar,
|
||||||
|
boardSdkDefaultPath,
|
||||||
|
desc.freeRTOS.boardSdkSubDir));
|
||||||
}
|
}
|
||||||
required3rdPartyPkgs.append(freeRTOSPkgs.value(desc.freeRTOS.envVar));
|
required3rdPartyPkgs.append(freeRTOSPkgs.value(desc.freeRTOS.envVar));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto platform = McuTarget::Platform{ desc.platform.id, desc.platform.name, desc.platform.vendor };
|
const auto platform = McuTarget::Platform{desc.platform.id,
|
||||||
|
desc.platform.name,
|
||||||
|
desc.platform.vendor};
|
||||||
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
||||||
platform,
|
platform,
|
||||||
os,
|
os,
|
||||||
@@ -525,18 +531,23 @@ protected:
|
|||||||
return mcuTargets;
|
return mcuTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<McuTarget *> createDesktopTargetsLegacy(const McuTargetDescription& desc)
|
QVector<McuTarget *> createDesktopTargetsLegacy(const McuTargetDescription &desc)
|
||||||
{
|
{
|
||||||
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchain.id);
|
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchain.id);
|
||||||
if (!tcPkg)
|
if (!tcPkg)
|
||||||
tcPkg = createUnsupportedToolChainPackage();
|
tcPkg = createUnsupportedToolChainPackage();
|
||||||
const auto platform = McuTarget::Platform{ desc.platform.id, desc.platform.name, desc.platform.vendor };
|
const auto platform = McuTarget::Platform{desc.platform.id,
|
||||||
|
desc.platform.name,
|
||||||
|
desc.platform.vendor};
|
||||||
auto desktopTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
auto desktopTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
||||||
platform, McuTarget::OS::Desktop, {}, tcPkg);
|
platform,
|
||||||
return { desktopTarget };
|
McuTarget::OS::Desktop,
|
||||||
|
{},
|
||||||
|
tcPkg);
|
||||||
|
return {desktopTarget};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<McuTarget *> createTargetsImpl(const McuTargetDescription& desc)
|
QVector<McuTarget *> createTargetsImpl(const McuTargetDescription &desc)
|
||||||
{
|
{
|
||||||
// OS deduction
|
// OS deduction
|
||||||
const auto os = [&] {
|
const auto os = [&] {
|
||||||
@@ -550,15 +561,14 @@ protected:
|
|||||||
QVector<McuTarget *> mcuTargets;
|
QVector<McuTarget *> mcuTargets;
|
||||||
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchain.id);
|
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchain.id);
|
||||||
if (tcPkg) {
|
if (tcPkg) {
|
||||||
if (QVersionNumber::fromString(desc.qulVersion) >= QVersionNumber({1,8}))
|
if (QVersionNumber::fromString(desc.qulVersion) >= QVersionNumber({1, 8}))
|
||||||
tcPkg->setVersions(desc.toolchain.versions);
|
tcPkg->setVersions(desc.toolchain.versions);
|
||||||
} else
|
} else
|
||||||
tcPkg = createUnsupportedToolChainPackage();
|
tcPkg = createUnsupportedToolChainPackage();
|
||||||
for (int colorDepth : desc.platform.colorDepths) {
|
for (int colorDepth : desc.platform.colorDepths) {
|
||||||
QVector<McuPackage*> required3rdPartyPkgs;
|
QVector<McuPackage *> required3rdPartyPkgs;
|
||||||
// Desktop toolchains don't need any additional settings
|
// Desktop toolchains don't need any additional settings
|
||||||
if (tcPkg
|
if (tcPkg && !tcPkg->isDesktopToolchain()
|
||||||
&& !tcPkg->isDesktopToolchain()
|
|
||||||
&& tcPkg->type() != McuToolChainPackage::Type::Unsupported)
|
&& tcPkg->type() != McuToolChainPackage::Type::Unsupported)
|
||||||
required3rdPartyPkgs.append(tcPkg);
|
required3rdPartyPkgs.append(tcPkg);
|
||||||
|
|
||||||
@@ -574,7 +584,7 @@ protected:
|
|||||||
boardSdkPkgs.insert(desc.boardSdk.envVar, boardSdkPkg);
|
boardSdkPkgs.insert(desc.boardSdk.envVar, boardSdkPkg);
|
||||||
}
|
}
|
||||||
auto boardSdkPkg = boardSdkPkgs.value(desc.boardSdk.envVar);
|
auto boardSdkPkg = boardSdkPkgs.value(desc.boardSdk.envVar);
|
||||||
if (QVersionNumber::fromString(desc.qulVersion) >= QVersionNumber({1,8}))
|
if (QVersionNumber::fromString(desc.qulVersion) >= QVersionNumber({1, 8}))
|
||||||
boardSdkPkg->setVersions(desc.boardSdk.versions);
|
boardSdkPkg->setVersions(desc.boardSdk.versions);
|
||||||
boardSdkDefaultPath = boardSdkPkg->defaultPath();
|
boardSdkDefaultPath = boardSdkPkg->defaultPath();
|
||||||
required3rdPartyPkgs.append(boardSdkPkg);
|
required3rdPartyPkgs.append(boardSdkPkg);
|
||||||
@@ -583,14 +593,16 @@ protected:
|
|||||||
// Free RTOS specific settings
|
// Free RTOS specific settings
|
||||||
if (!desc.freeRTOS.envVar.isEmpty()) {
|
if (!desc.freeRTOS.envVar.isEmpty()) {
|
||||||
if (!freeRTOSPkgs.contains(desc.freeRTOS.envVar)) {
|
if (!freeRTOSPkgs.contains(desc.freeRTOS.envVar)) {
|
||||||
freeRTOSPkgs.insert(desc.freeRTOS.envVar, createFreeRTOSSourcesPackage(
|
freeRTOSPkgs.insert(desc.freeRTOS.envVar,
|
||||||
desc.freeRTOS.envVar, boardSdkDefaultPath,
|
createFreeRTOSSourcesPackage(desc.freeRTOS.envVar,
|
||||||
desc.freeRTOS.boardSdkSubDir));
|
boardSdkDefaultPath,
|
||||||
|
desc.freeRTOS.boardSdkSubDir));
|
||||||
}
|
}
|
||||||
required3rdPartyPkgs.append(freeRTOSPkgs.value(desc.freeRTOS.envVar));
|
required3rdPartyPkgs.append(freeRTOSPkgs.value(desc.freeRTOS.envVar));
|
||||||
}
|
}
|
||||||
|
|
||||||
const McuTarget::Platform platform({ desc.platform.id, desc.platform.name, desc.platform.vendor });
|
const McuTarget::Platform platform(
|
||||||
|
{desc.platform.id, desc.platform.name, desc.platform.vendor});
|
||||||
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
||||||
platform,
|
platform,
|
||||||
os,
|
os,
|
||||||
@@ -639,13 +651,14 @@ static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescrip
|
|||||||
mcuTargets.append(newTargets);
|
mcuTargets.append(newTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
packages->append(Utils::transform<QVector<McuPackage *> >(
|
packages->append(
|
||||||
tcPkgs.values(), [&](McuToolChainPackage *tcPkg) { return tcPkg; }));
|
Utils::transform<QVector<McuPackage *>>(tcPkgs.values(),
|
||||||
|
[&](McuToolChainPackage *tcPkg) { return tcPkg; }));
|
||||||
for (auto *package : vendorPkgs)
|
for (auto *package : vendorPkgs)
|
||||||
packages->append(package);
|
packages->append(package);
|
||||||
packages->append(targetFactory.getMcuPackages());
|
packages->append(targetFactory.getMcuPackages());
|
||||||
|
|
||||||
return mcuTargets;
|
return mcuTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FilePath kitsPath(const Utils::FilePath &dir)
|
Utils::FilePath kitsPath(const Utils::FilePath &dir)
|
||||||
@@ -659,7 +672,8 @@ static QFileInfoList targetDescriptionFiles(const Utils::FilePath &dir)
|
|||||||
return kitsDir.entryInfoList();
|
return kitsDir.entryInfoList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static McuTargetDescription parseDescriptionJsonCommon(const QString &qulVersion, const QJsonObject &target)
|
static McuTargetDescription parseDescriptionJsonCommon(const QString &qulVersion,
|
||||||
|
const QJsonObject &target)
|
||||||
{
|
{
|
||||||
const QString compatVersion = target.value("compatVersion").toString();
|
const QString compatVersion = target.value("compatVersion").toString();
|
||||||
const QJsonObject toolchain = target.value("toolchain").toObject();
|
const QJsonObject toolchain = target.value("toolchain").toObject();
|
||||||
@@ -667,58 +681,66 @@ static McuTargetDescription parseDescriptionJsonCommon(const QString &qulVersion
|
|||||||
const QJsonObject freeRTOS = target.value("freeRTOS").toObject();
|
const QJsonObject freeRTOS = target.value("freeRTOS").toObject();
|
||||||
|
|
||||||
const QVariantList toolchainVersions = toolchain.value("versions").toArray().toVariantList();
|
const QVariantList toolchainVersions = toolchain.value("versions").toArray().toVariantList();
|
||||||
const auto toolchainVersionsList = Utils::transform<QStringList>(
|
const auto toolchainVersionsList = Utils::transform<QStringList>(toolchainVersions,
|
||||||
toolchainVersions, [&](const QVariant &version) { return version.toString(); });
|
[&](const QVariant &version) {
|
||||||
|
return version.toString();
|
||||||
|
});
|
||||||
const QVariantList boardSdkVersions = boardSdk.value("versions").toArray().toVariantList();
|
const QVariantList boardSdkVersions = boardSdk.value("versions").toArray().toVariantList();
|
||||||
const auto boardSdkVersionsList = Utils::transform<QStringList>(
|
const auto boardSdkVersionsList = Utils::transform<QStringList>(boardSdkVersions,
|
||||||
boardSdkVersions, [&](const QVariant &version) { return version.toString(); });
|
[&](const QVariant &version) {
|
||||||
|
return version.toString();
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {qulVersion,
|
||||||
qulVersion,
|
compatVersion,
|
||||||
compatVersion,
|
{},
|
||||||
{},
|
{
|
||||||
{
|
toolchain.value("id").toString(),
|
||||||
toolchain.value("id").toString(),
|
toolchainVersionsList,
|
||||||
toolchainVersionsList,
|
},
|
||||||
},
|
{
|
||||||
{
|
boardSdk.value("name").toString(),
|
||||||
boardSdk.value("name").toString(),
|
boardSdk.value("defaultPath").toString(),
|
||||||
boardSdk.value("defaultPath").toString(),
|
boardSdk.value("envVar").toString(),
|
||||||
boardSdk.value("envVar").toString(),
|
boardSdkVersionsList,
|
||||||
boardSdkVersionsList,
|
},
|
||||||
},
|
{
|
||||||
{
|
freeRTOS.value("envVar").toString(),
|
||||||
freeRTOS.value("envVar").toString(),
|
freeRTOS.value("boardSdkSubDir").toString(),
|
||||||
freeRTOS.value("boardSdkSubDir").toString(),
|
}};
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static McuTargetDescription parseDescriptionJsonV1x(const QString &qulVersion, const QJsonObject &target)
|
static McuTargetDescription parseDescriptionJsonV1x(const QString &qulVersion,
|
||||||
|
const QJsonObject &target)
|
||||||
{
|
{
|
||||||
auto description = parseDescriptionJsonCommon(qulVersion, target);
|
auto description = parseDescriptionJsonCommon(qulVersion, target);
|
||||||
|
|
||||||
const QVariantList colorDepths = target.value("colorDepths").toArray().toVariantList();
|
const QVariantList colorDepths = target.value("colorDepths").toArray().toVariantList();
|
||||||
const auto colorDepthsVector = Utils::transform<QVector<int> >(
|
const auto colorDepthsVector = Utils::transform<QVector<int>>(colorDepths,
|
||||||
colorDepths, [&](const QVariant &colorDepth) { return colorDepth.toInt(); });
|
[&](const QVariant &colorDepth) {
|
||||||
|
return colorDepth.toInt();
|
||||||
|
});
|
||||||
|
|
||||||
description.platform = {
|
description.platform = {target.value("platform").toString(),
|
||||||
target.value("platform").toString(),
|
target.value("platformName").toString(),
|
||||||
target.value("platformName").toString(),
|
target.value("platformVendor").toString(),
|
||||||
target.value("platformVendor").toString(),
|
colorDepthsVector,
|
||||||
colorDepthsVector,
|
description.boardSdk.envVar.isEmpty()
|
||||||
description.boardSdk.envVar.isEmpty() ? McuTargetDescription::TargetType::Desktop : McuTargetDescription::TargetType::MCU
|
? McuTargetDescription::TargetType::Desktop
|
||||||
};
|
: McuTargetDescription::TargetType::MCU};
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
static McuTargetDescription parseDescriptionJsonV2x(const QString &qulVersion, const QJsonObject &target)
|
static McuTargetDescription parseDescriptionJsonV2x(const QString &qulVersion,
|
||||||
|
const QJsonObject &target)
|
||||||
{
|
{
|
||||||
const QJsonObject platform = target.value("platform").toObject();
|
const QJsonObject platform = target.value("platform").toObject();
|
||||||
|
|
||||||
const QVariantList colorDepths = platform.value("colorDepths").toArray().toVariantList();
|
const QVariantList colorDepths = platform.value("colorDepths").toArray().toVariantList();
|
||||||
const auto colorDepthsVector = Utils::transform<QVector<int> >(
|
const auto colorDepthsVector = Utils::transform<QVector<int>>(colorDepths,
|
||||||
colorDepths, [&](const QVariant &colorDepth) { return colorDepth.toInt(); });
|
[&](const QVariant &colorDepth) {
|
||||||
|
return colorDepth.toInt();
|
||||||
|
});
|
||||||
const QString platformName = platform.value("platformName").toString();
|
const QString platformName = platform.value("platformName").toString();
|
||||||
McuTargetDescription description = parseDescriptionJsonCommon(qulVersion, target);
|
McuTargetDescription description = parseDescriptionJsonCommon(qulVersion, target);
|
||||||
description.platform = {
|
description.platform = {
|
||||||
@@ -726,7 +748,8 @@ static McuTargetDescription parseDescriptionJsonV2x(const QString &qulVersion, c
|
|||||||
platformName,
|
platformName,
|
||||||
platform.value("vendor").toString(),
|
platform.value("vendor").toString(),
|
||||||
colorDepthsVector,
|
colorDepthsVector,
|
||||||
platformName == "Desktop" ? McuTargetDescription::TargetType::Desktop : McuTargetDescription::TargetType::MCU,
|
platformName == "Desktop" ? McuTargetDescription::TargetType::Desktop
|
||||||
|
: McuTargetDescription::TargetType::MCU,
|
||||||
};
|
};
|
||||||
|
|
||||||
return description;
|
return description;
|
||||||
@@ -740,9 +763,12 @@ static McuTargetDescription parseDescriptionJson(const QByteArray &data)
|
|||||||
const QString qulVersion = target.value("qulVersion").toString();
|
const QString qulVersion = target.value("qulVersion").toString();
|
||||||
|
|
||||||
switch (QVersionNumber::fromString(qulVersion).majorVersion()) {
|
switch (QVersionNumber::fromString(qulVersion).majorVersion()) {
|
||||||
case 1: return parseDescriptionJsonV1x(qulVersion, target);
|
case 1:
|
||||||
case 2: return parseDescriptionJsonV2x(qulVersion, target);
|
return parseDescriptionJsonV1x(qulVersion, target);
|
||||||
default: return { qulVersion };
|
case 2:
|
||||||
|
return parseDescriptionJsonV2x(qulVersion, target);
|
||||||
|
default:
|
||||||
|
return {qulVersion};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,10 +787,10 @@ bool checkDeprecatedSdkError(const Utils::FilePath &qulDir, QString &message)
|
|||||||
if (oldSdkQtcRequiredVersion.contains(sdkDetectedVersion)) {
|
if (oldSdkQtcRequiredVersion.contains(sdkDetectedVersion)) {
|
||||||
message = McuTarget::tr("Qt for MCUs SDK version %1 detected, "
|
message = McuTarget::tr("Qt for MCUs SDK version %1 detected, "
|
||||||
"only supported by Qt Creator version %2. "
|
"only supported by Qt Creator version %2. "
|
||||||
"This version of Qt Creator requires Qt for MCUs %3 or greater."
|
"This version of Qt Creator requires Qt for MCUs %3 or greater.")
|
||||||
).arg(sdkDetectedVersion,
|
.arg(sdkDetectedVersion,
|
||||||
oldSdkQtcRequiredVersion.value(sdkDetectedVersion),
|
oldSdkQtcRequiredVersion.value(sdkDetectedVersion),
|
||||||
McuSupportOptions::minimalQulVersion().toString());
|
McuSupportOptions::minimalQulVersion().toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -783,26 +809,25 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
|||||||
const McuTargetDescription desc = parseDescriptionJson(file.readAll());
|
const McuTargetDescription desc = parseDescriptionJson(file.readAll());
|
||||||
const auto pth = Utils::FilePath::fromString(fileInfo.filePath());
|
const auto pth = Utils::FilePath::fromString(fileInfo.filePath());
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const int compatVersion = desc.compatVersion.toInt(&ok);
|
const int compatVersion = desc.compatVersion.toInt(&ok);
|
||||||
if (!desc.compatVersion.isEmpty() && ok && compatVersion > MAX_COMPATIBILITY_VERSION) {
|
if (!desc.compatVersion.isEmpty() && ok && compatVersion > MAX_COMPATIBILITY_VERSION) {
|
||||||
printMessage(McuTarget::tr("Skipped %1. Unsupported version \"%2\".").arg(
|
printMessage(McuTarget::tr("Skipped %1. Unsupported version \"%2\".")
|
||||||
QDir::toNativeSeparators(pth.fileNameWithPathComponents(1)),
|
.arg(QDir::toNativeSeparators(pth.fileNameWithPathComponents(1)),
|
||||||
desc.qulVersion),
|
desc.qulVersion),
|
||||||
false);
|
false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (QVersionNumber::fromString(desc.qulVersion) < McuSupportOptions::minimalQulVersion()) {
|
if (QVersionNumber::fromString(desc.qulVersion) < McuSupportOptions::minimalQulVersion()) {
|
||||||
const QString qtcSupportText = oldSdkQtcRequiredVersion.contains(desc.qulVersion) ?
|
const QString qtcSupportText
|
||||||
McuTarget::tr("Detected version \"%1\", only supported by Qt Creator %2.")
|
= oldSdkQtcRequiredVersion.contains(desc.qulVersion)
|
||||||
.arg(desc.qulVersion, oldSdkQtcRequiredVersion.value(desc.qulVersion))
|
? McuTarget::tr("Detected version \"%1\", only supported by Qt Creator %2.")
|
||||||
: McuTarget::tr("Unsupported version \"%1\".")
|
.arg(desc.qulVersion, oldSdkQtcRequiredVersion.value(desc.qulVersion))
|
||||||
.arg(desc.qulVersion);
|
: McuTarget::tr("Unsupported version \"%1\".").arg(desc.qulVersion);
|
||||||
printMessage(McuTarget::tr("Skipped %1. %2 Qt for MCUs version >= %3 required.")
|
printMessage(McuTarget::tr("Skipped %1. %2 Qt for MCUs version >= %3 required.")
|
||||||
.arg(
|
.arg(QDir::toNativeSeparators(pth.fileNameWithPathComponents(1)),
|
||||||
QDir::toNativeSeparators(pth.fileNameWithPathComponents(1)),
|
qtcSupportText,
|
||||||
qtcSupportText,
|
McuSupportOptions::minimalQulVersion().toString()),
|
||||||
McuSupportOptions::minimalQulVersion().toString()),
|
false);
|
||||||
false);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
descriptions.append(desc);
|
descriptions.append(desc);
|
||||||
@@ -812,7 +837,8 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
|||||||
if (descriptions.empty()) {
|
if (descriptions.empty()) {
|
||||||
if (kitsPath(dir).exists()) {
|
if (kitsPath(dir).exists()) {
|
||||||
printMessage(McuTarget::tr("No valid kit descriptions found at %1.")
|
printMessage(McuTarget::tr("No valid kit descriptions found at %1.")
|
||||||
.arg(kitsPath(dir).toUserOutput()), true);
|
.arg(kitsPath(dir).toUserOutput()),
|
||||||
|
true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
QString deprecationMessage;
|
QString deprecationMessage;
|
||||||
@@ -827,45 +853,53 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
|||||||
// Desktop JSON file is shipped starting from Qul 1.5.
|
// Desktop JSON file is shipped starting from Qul 1.5.
|
||||||
// This whole section could be removed when minimalQulVersion will reach 1.5 or above
|
// This whole section could be removed when minimalQulVersion will reach 1.5 or above
|
||||||
{
|
{
|
||||||
const bool hasDesktopDescription = contains(descriptions, [](const McuTargetDescription &desc) {
|
const bool hasDesktopDescription
|
||||||
return desc.platform.type == McuTargetDescription::TargetType::Desktop;
|
= contains(descriptions, [](const McuTargetDescription &desc) {
|
||||||
});
|
return desc.platform.type == McuTargetDescription::TargetType::Desktop;
|
||||||
|
});
|
||||||
|
|
||||||
if (!hasDesktopDescription) {
|
if (!hasDesktopDescription) {
|
||||||
QVector<FilePath> desktopLibs;
|
QVector<FilePath> desktopLibs;
|
||||||
if (HostOsInfo::isWindowsHost()) {
|
if (HostOsInfo::isWindowsHost()) {
|
||||||
desktopLibs << dir / "lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib"; // older versions of QUL (<1.5?)
|
desktopLibs << dir / "lib/QulQuickUltralite_QT_32bpp_Windows_Release.lib"; // older versions of QUL (<1.5?)
|
||||||
desktopLibs << dir / "lib/QulQuickUltralitePlatform_QT_32bpp_Windows_msvc_Release.lib"; // newer versions of QUL
|
desktopLibs
|
||||||
|
<< dir / "lib/QulQuickUltralitePlatform_QT_32bpp_Windows_msvc_Release.lib"; // newer versions of QUL
|
||||||
} else {
|
} else {
|
||||||
desktopLibs << dir / "lib/libQulQuickUltralite_QT_32bpp_Linux_Debug.a"; // older versions of QUL (<1.5?)
|
desktopLibs << dir / "lib/libQulQuickUltralite_QT_32bpp_Linux_Debug.a"; // older versions of QUL (<1.5?)
|
||||||
desktopLibs << dir / "lib/libQulQuickUltralitePlatform_QT_32bpp_Linux_gnu_Debug.a"; // newer versions of QUL
|
desktopLibs << dir / "lib/libQulQuickUltralitePlatform_QT_32bpp_Linux_gnu_Debug.a"; // newer versions of QUL
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anyOf(desktopLibs, [](const FilePath &desktopLib) {
|
if (anyOf(desktopLibs, [](const FilePath &desktopLib) { return desktopLib.exists(); })) {
|
||||||
return desktopLib.exists(); })
|
|
||||||
) {
|
|
||||||
McuTargetDescription desktopDescription;
|
McuTargetDescription desktopDescription;
|
||||||
desktopDescription.qulVersion = descriptions.empty() ?
|
desktopDescription.qulVersion
|
||||||
McuSupportOptions::minimalQulVersion().toString()
|
= descriptions.empty() ? McuSupportOptions::minimalQulVersion().toString()
|
||||||
: descriptions.first().qulVersion;
|
: descriptions.first().qulVersion;
|
||||||
desktopDescription.platform.id = "Qt";
|
desktopDescription.platform.id = "Qt";
|
||||||
desktopDescription.platform.name = "Desktop";
|
desktopDescription.platform.name = "Desktop";
|
||||||
desktopDescription.platform.vendor = "Qt";
|
desktopDescription.platform.vendor = "Qt";
|
||||||
desktopDescription.platform.colorDepths = {32};
|
desktopDescription.platform.colorDepths = {32};
|
||||||
desktopDescription.toolchain.id = HostOsInfo::isWindowsHost() ? QString("msvc") : QString("gcc");
|
desktopDescription.toolchain.id = HostOsInfo::isWindowsHost() ? QString("msvc")
|
||||||
|
: QString("gcc");
|
||||||
desktopDescription.platform.type = McuTargetDescription::TargetType::Desktop;
|
desktopDescription.platform.type = McuTargetDescription::TargetType::Desktop;
|
||||||
descriptions.prepend(desktopDescription);
|
descriptions.prepend(desktopDescription);
|
||||||
} else {
|
} else {
|
||||||
// show error only on 1.x SDKs, but skip on 2.x
|
// show error only on 1.x SDKs, but skip on 2.x
|
||||||
const FilePath desktopLibV2 = HostOsInfo::isWindowsHost() ?
|
const FilePath desktopLibV2
|
||||||
dir / "lib/QulPlatform_qt_32bpp_Windows_msvc_Release.lib"
|
= HostOsInfo::isWindowsHost()
|
||||||
|
? dir / "lib/QulPlatform_qt_32bpp_Windows_msvc_Release.lib"
|
||||||
: dir / "lib/libQulPlatform_qt_32bpp_Linux_gnu_Release.a";
|
: dir / "lib/libQulPlatform_qt_32bpp_Linux_gnu_Release.a";
|
||||||
if (dir.exists() && !desktopLibV2.exists())
|
if (dir.exists() && !desktopLibV2.exists())
|
||||||
printMessage(McuTarget::tr("Skipped creating fallback desktop kit: Could not find any of %1.")
|
printMessage(
|
||||||
.arg(transform(desktopLibs, [](const auto &path) {
|
McuTarget::tr(
|
||||||
return QDir::toNativeSeparators(path.fileNameWithPathComponents(1));
|
"Skipped creating fallback desktop kit: Could not find any of %1.")
|
||||||
}).toList().join(" or ")),
|
.arg(transform(desktopLibs,
|
||||||
false);
|
[](const auto &path) {
|
||||||
|
return QDir::toNativeSeparators(
|
||||||
|
path.fileNameWithPathComponents(1));
|
||||||
|
})
|
||||||
|
.toList()
|
||||||
|
.join(" or ")),
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -873,16 +907,20 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
|||||||
repo->mcuTargets.append(targetsFromDescriptions(descriptions, &(repo->packages)));
|
repo->mcuTargets.append(targetsFromDescriptions(descriptions, &(repo->packages)));
|
||||||
|
|
||||||
// Keep targets sorted lexicographically
|
// Keep targets sorted lexicographically
|
||||||
std::sort(repo->mcuTargets.begin(), repo->mcuTargets.end(), [] (const McuTarget* lhs, const McuTarget* rhs) {
|
std::sort(repo->mcuTargets.begin(),
|
||||||
return McuSupportOptions::kitName(lhs) < McuSupportOptions::kitName(rhs);
|
repo->mcuTargets.end(),
|
||||||
});
|
[](const McuTarget *lhs, const McuTarget *rhs) {
|
||||||
|
return McuSupportOptions::kitName(lhs) < McuSupportOptions::kitName(rhs);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath packagePathFromSettings(const QString &settingsKey, QSettings::Scope scope, const FilePath &defaultPath)
|
FilePath packagePathFromSettings(const QString &settingsKey,
|
||||||
|
QSettings::Scope scope,
|
||||||
|
const FilePath &defaultPath)
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::settings(scope);
|
QSettings *settings = Core::ICore::settings(scope);
|
||||||
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/' +
|
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/'
|
||||||
QLatin1String(Constants::SETTINGS_KEY_PACKAGE_PREFIX) + settingsKey;
|
+ QLatin1String(Constants::SETTINGS_KEY_PACKAGE_PREFIX) + settingsKey;
|
||||||
const QString path = settings->value(key, defaultPath.toString()).toString();
|
const QString path = settings->value(key, defaultPath.toString()).toString();
|
||||||
return FilePath::fromUserInput(path);
|
return FilePath::fromUserInput(path);
|
||||||
}
|
}
|
||||||
|
@@ -43,20 +43,15 @@ QString matchRegExp(const QString &text, const QString ®Exp)
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
McuPackageVersionDetector::McuPackageVersionDetector()
|
McuPackageVersionDetector::McuPackageVersionDetector() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
McuPackageExecutableVersionDetector::McuPackageExecutableVersionDetector(
|
McuPackageExecutableVersionDetector::McuPackageExecutableVersionDetector(
|
||||||
const QString &detectionPath,
|
const QString &detectionPath, const QStringList &detectionArgs, const QString &detectionRegExp)
|
||||||
const QStringList &detectionArgs,
|
|
||||||
const QString &detectionRegExp)
|
|
||||||
: McuPackageVersionDetector()
|
: McuPackageVersionDetector()
|
||||||
, m_detectionPath(detectionPath)
|
, m_detectionPath(detectionPath)
|
||||||
, m_detectionArgs(detectionArgs)
|
, m_detectionArgs(detectionArgs)
|
||||||
, m_detectionRegExp(detectionRegExp)
|
, m_detectionRegExp(detectionRegExp)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
QString McuPackageExecutableVersionDetector::parseVersion(const QString &packagePath) const
|
QString McuPackageExecutableVersionDetector::parseVersion(const QString &packagePath) const
|
||||||
{
|
{
|
||||||
@@ -76,8 +71,7 @@ QString McuPackageExecutableVersionDetector::parseVersion(const QString &package
|
|||||||
binaryProcess.waitForFinished(execTimeout);
|
binaryProcess.waitForFinished(execTimeout);
|
||||||
if (binaryProcess.exitStatus() == QProcess::NormalExit) {
|
if (binaryProcess.exitStatus() == QProcess::NormalExit) {
|
||||||
const QString processOutput = QString::fromUtf8(
|
const QString processOutput = QString::fromUtf8(
|
||||||
binaryProcess.readAllStandardOutput().append(
|
binaryProcess.readAllStandardOutput().append(binaryProcess.readAllStandardError()));
|
||||||
binaryProcess.readAllStandardError()));
|
|
||||||
return matchRegExp(processOutput, m_detectionRegExp);
|
return matchRegExp(processOutput, m_detectionRegExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,23 +83,23 @@ McuPackageXmlVersionDetector::McuPackageXmlVersionDetector(const QString &filePa
|
|||||||
const QString &versionElement,
|
const QString &versionElement,
|
||||||
const QString &versionAttribute,
|
const QString &versionAttribute,
|
||||||
const QString &versionRegExp)
|
const QString &versionRegExp)
|
||||||
: m_filePattern(filePattern),
|
: m_filePattern(filePattern)
|
||||||
m_versionElement(versionElement),
|
, m_versionElement(versionElement)
|
||||||
m_versionAttribute(versionAttribute),
|
, m_versionAttribute(versionAttribute)
|
||||||
m_versionRegExp(versionRegExp)
|
, m_versionRegExp(versionRegExp)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
QString McuPackageXmlVersionDetector::parseVersion(const QString &packagePath) const
|
QString McuPackageXmlVersionDetector::parseVersion(const QString &packagePath) const
|
||||||
{
|
{
|
||||||
const auto files = QDir(packagePath, m_filePattern).entryInfoList();
|
const auto files = QDir(packagePath, m_filePattern).entryInfoList();
|
||||||
for (const auto &xmlFile: files) {
|
for (const auto &xmlFile : files) {
|
||||||
QFile sdkXmlFile = QFile(xmlFile.absoluteFilePath());
|
QFile sdkXmlFile = QFile(xmlFile.absoluteFilePath());
|
||||||
sdkXmlFile.open(QFile::OpenModeFlag::ReadOnly);
|
sdkXmlFile.open(QFile::OpenModeFlag::ReadOnly);
|
||||||
QXmlStreamReader xmlReader(&sdkXmlFile);
|
QXmlStreamReader xmlReader(&sdkXmlFile);
|
||||||
while (xmlReader.readNext()) {
|
while (xmlReader.readNext()) {
|
||||||
if (xmlReader.name() == m_versionElement) {
|
if (xmlReader.name() == m_versionElement) {
|
||||||
const QString versionString = xmlReader.attributes().value(m_versionAttribute).toString();
|
const QString versionString
|
||||||
|
= xmlReader.attributes().value(m_versionAttribute).toString();
|
||||||
const QString matched = matchRegExp(versionString, m_versionRegExp);
|
const QString matched = matchRegExp(versionString, m_versionRegExp);
|
||||||
return !matched.isEmpty() ? matched : versionString;
|
return !matched.isEmpty() ? matched : versionString;
|
||||||
}
|
}
|
||||||
@@ -118,17 +112,16 @@ QString McuPackageXmlVersionDetector::parseVersion(const QString &packagePath) c
|
|||||||
McuPackageDirectoryVersionDetector::McuPackageDirectoryVersionDetector(const QString &filePattern,
|
McuPackageDirectoryVersionDetector::McuPackageDirectoryVersionDetector(const QString &filePattern,
|
||||||
const QString &versionRegExp,
|
const QString &versionRegExp,
|
||||||
const bool isFile)
|
const bool isFile)
|
||||||
: m_filePattern(filePattern),
|
: m_filePattern(filePattern)
|
||||||
m_versionRegExp(versionRegExp),
|
, m_versionRegExp(versionRegExp)
|
||||||
m_isFile(isFile)
|
, m_isFile(isFile)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
QString McuPackageDirectoryVersionDetector::parseVersion(const QString &packagePath) const
|
QString McuPackageDirectoryVersionDetector::parseVersion(const QString &packagePath) const
|
||||||
{
|
{
|
||||||
const auto files = QDir(packagePath, m_filePattern)
|
const auto files = QDir(packagePath, m_filePattern)
|
||||||
.entryInfoList(m_isFile ? QDir::Filter::Files : QDir::Filter::Dirs);
|
.entryInfoList(m_isFile ? QDir::Filter::Files : QDir::Filter::Dirs);
|
||||||
for (const auto &entry: files) {
|
for (const auto &entry : files) {
|
||||||
const QString matched = matchRegExp(entry.fileName(), m_versionRegExp);
|
const QString matched = matchRegExp(entry.fileName(), m_versionRegExp);
|
||||||
if (!matched.isEmpty())
|
if (!matched.isEmpty())
|
||||||
return matched;
|
return matched;
|
||||||
@@ -138,8 +131,7 @@ QString McuPackageDirectoryVersionDetector::parseVersion(const QString &packageP
|
|||||||
|
|
||||||
McuPackagePathVersionDetector::McuPackagePathVersionDetector(const QString &versionRegExp)
|
McuPackagePathVersionDetector::McuPackagePathVersionDetector(const QString &versionRegExp)
|
||||||
: m_versionRegExp(versionRegExp)
|
: m_versionRegExp(versionRegExp)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
QString McuPackagePathVersionDetector::parseVersion(const QString &packagePath) const
|
QString McuPackagePathVersionDetector::parseVersion(const QString &packagePath) const
|
||||||
{
|
{
|
||||||
@@ -148,5 +140,5 @@ QString McuPackagePathVersionDetector::parseVersion(const QString &packagePath)
|
|||||||
return matchRegExp(packagePath, m_versionRegExp);
|
return matchRegExp(packagePath, m_versionRegExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // namespace Internal
|
||||||
} // McuSupport
|
} // namespace McuSupport
|
||||||
|
@@ -47,6 +47,7 @@ public:
|
|||||||
const QStringList &detectionArgs,
|
const QStringList &detectionArgs,
|
||||||
const QString &detectionRegExp);
|
const QString &detectionRegExp);
|
||||||
QString parseVersion(const QString &packagePath) const final;
|
QString parseVersion(const QString &packagePath) const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_detectionPath;
|
const QString m_detectionPath;
|
||||||
const QStringList m_detectionArgs;
|
const QStringList m_detectionArgs;
|
||||||
@@ -62,6 +63,7 @@ public:
|
|||||||
const QString &versionAttribute,
|
const QString &versionAttribute,
|
||||||
const QString &versionRegExp);
|
const QString &versionRegExp);
|
||||||
QString parseVersion(const QString &packagePath) const final;
|
QString parseVersion(const QString &packagePath) const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_filePattern;
|
const QString m_filePattern;
|
||||||
const QString m_versionElement;
|
const QString m_versionElement;
|
||||||
@@ -73,8 +75,11 @@ private:
|
|||||||
class McuPackageDirectoryVersionDetector : public McuPackageVersionDetector
|
class McuPackageDirectoryVersionDetector : public McuPackageVersionDetector
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
McuPackageDirectoryVersionDetector(const QString &filePattern, const QString &versionRegExp, const bool isFile);
|
McuPackageDirectoryVersionDetector(const QString &filePattern,
|
||||||
|
const QString &versionRegExp,
|
||||||
|
const bool isFile);
|
||||||
QString parseVersion(const QString &packagePath) const final;
|
QString parseVersion(const QString &packagePath) const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_filePattern;
|
const QString m_filePattern;
|
||||||
const QString m_versionRegExp;
|
const QString m_versionRegExp;
|
||||||
@@ -87,9 +92,10 @@ class McuPackagePathVersionDetector : public McuPackageVersionDetector
|
|||||||
public:
|
public:
|
||||||
McuPackagePathVersionDetector(const QString &versionRegExp);
|
McuPackagePathVersionDetector(const QString &versionRegExp);
|
||||||
QString parseVersion(const QString &packagePath) const final;
|
QString parseVersion(const QString &packagePath) const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_versionRegExp;
|
const QString m_versionRegExp;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // namespace Internal
|
||||||
} // McuSupport
|
} // namespace McuSupport
|
||||||
|
Reference in New Issue
Block a user