2019-10-22 14:33:31 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2020-07-02 16:04:31 +02:00
|
|
|
** Copyright (C) 2020 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2019-10-22 14:33:31 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "mcusupportconstants.h"
|
|
|
|
|
#include "mcusupportoptions.h"
|
2020-03-12 14:25:49 +01:00
|
|
|
#include "mcusupportsdk.h"
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2020-04-07 18:19:32 +02:00
|
|
|
#include <cmakeprojectmanager/cmaketoolmanager.h>
|
2019-10-22 14:33:31 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2020-03-24 18:58:29 +01:00
|
|
|
#include <coreplugin/helpmanager.h>
|
2019-10-22 14:33:31 +02:00
|
|
|
#include <cmakeprojectmanager/cmakekitinformation.h>
|
|
|
|
|
#include <debugger/debuggeritem.h>
|
|
|
|
|
#include <debugger/debuggeritemmanager.h>
|
|
|
|
|
#include <debugger/debuggerkitinformation.h>
|
2020-04-07 18:19:32 +02:00
|
|
|
#include <projectexplorer/abi.h>
|
2019-10-22 14:33:31 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <projectexplorer/toolchain.h>
|
|
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
|
|
|
|
#include <projectexplorer/kitmanager.h>
|
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
2020-04-07 18:19:32 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2020-04-02 19:31:52 +02:00
|
|
|
#include <qtsupport/qtversionmanager.h>
|
2019-10-22 14:33:31 +02:00
|
|
|
#include <utils/algorithm.h>
|
|
|
|
|
#include <utils/fileutils.h>
|
2019-12-11 21:17:53 +01:00
|
|
|
#include <utils/infolabel.h>
|
2019-10-22 14:33:31 +02:00
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
#include <utils/utilsicons.h>
|
|
|
|
|
|
|
|
|
|
#include <QDesktopServices>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
|
|
namespace McuSupport {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2020-06-29 23:27:16 +02:00
|
|
|
static const int KIT_VERSION = 6; // Bumps up whenever details in Kit creation change
|
2020-04-22 23:24:54 +02:00
|
|
|
|
2020-06-05 00:33:06 +02:00
|
|
|
static QString packagePathFromSettings(const QString &settingsKey,
|
|
|
|
|
QSettings::Scope scope = QSettings::UserScope,
|
|
|
|
|
const QString &defaultPath = {})
|
2020-03-24 18:58:29 +01:00
|
|
|
{
|
2020-06-05 00:33:06 +02:00
|
|
|
QSettings *s = Core::ICore::settings(scope);
|
2020-03-24 18:58:29 +01:00
|
|
|
s->beginGroup(Constants::SETTINGS_GROUP);
|
|
|
|
|
const QString path = s->value(QLatin1String(Constants::SETTINGS_KEY_PACKAGE_PREFIX)
|
|
|
|
|
+ settingsKey, defaultPath).toString();
|
|
|
|
|
s->endGroup();
|
2020-06-05 00:33:06 +02:00
|
|
|
return Utils::FilePath::fromFileInfo(path).toString();
|
2020-03-24 18:58:29 +01:00
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
McuPackage::McuPackage(const QString &label, const QString &defaultPath,
|
|
|
|
|
const QString &detectionPath, const QString &settingsKey)
|
2019-10-22 14:33:31 +02:00
|
|
|
: m_label(label)
|
2020-06-05 00:33:06 +02:00
|
|
|
, m_defaultPath(packagePathFromSettings(settingsKey, QSettings::SystemScope, defaultPath))
|
2019-10-22 14:33:31 +02:00
|
|
|
, m_detectionPath(detectionPath)
|
|
|
|
|
, m_settingsKey(settingsKey)
|
|
|
|
|
{
|
2020-06-05 00:33:06 +02:00
|
|
|
m_path = packagePathFromSettings(settingsKey, QSettings::UserScope, m_defaultPath);
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
QString McuPackage::path() const
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
2020-04-09 11:35:12 +02:00
|
|
|
return QFileInfo(m_fileChooser->filePath().toString() + m_relativePathModifier).absoluteFilePath();
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
QString McuPackage::label() const
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
return m_label;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-03 09:46:44 +02:00
|
|
|
QString McuPackage::defaultPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_defaultPath;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
QString McuPackage::detectionPath() const
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
return m_detectionPath;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
QWidget *McuPackage::widget()
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
if (m_widget)
|
|
|
|
|
return m_widget;
|
|
|
|
|
|
|
|
|
|
m_widget = new QWidget;
|
|
|
|
|
m_fileChooser = new Utils::PathChooser;
|
2020-06-05 00:33:06 +02:00
|
|
|
m_fileChooser->lineEdit()->setButtonIcon(Utils::FancyLineEdit::Right,
|
|
|
|
|
Utils::Icons::RESET.icon());
|
|
|
|
|
m_fileChooser->lineEdit()->setButtonVisible(Utils::FancyLineEdit::Right, true);
|
|
|
|
|
connect(m_fileChooser->lineEdit(), &Utils::FancyLineEdit::rightButtonClicked, [&](){
|
|
|
|
|
m_fileChooser->setPath(m_defaultPath);
|
|
|
|
|
});
|
2019-10-22 14:33:31 +02:00
|
|
|
|
|
|
|
|
auto layout = new QGridLayout(m_widget);
|
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
2019-12-11 21:17:53 +01:00
|
|
|
m_infoLabel = new Utils::InfoLabel();
|
2019-10-22 14:33:31 +02:00
|
|
|
|
|
|
|
|
if (!m_downloadUrl.isEmpty()) {
|
|
|
|
|
auto downLoadButton = new QToolButton;
|
2020-06-26 12:23:01 +02:00
|
|
|
downLoadButton->setIcon(Utils::Icons::ONLINE.icon());
|
2019-10-22 14:33:31 +02:00
|
|
|
downLoadButton->setToolTip(tr("Download from \"%1\"").arg(m_downloadUrl));
|
|
|
|
|
QObject::connect(downLoadButton, &QToolButton::pressed, [this]{
|
|
|
|
|
QDesktopServices::openUrl(m_downloadUrl);
|
|
|
|
|
});
|
|
|
|
|
layout->addWidget(downLoadButton, 0, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
layout->addWidget(m_fileChooser, 0, 0, 1, 2);
|
2019-12-11 21:17:53 +01:00
|
|
|
layout->addWidget(m_infoLabel, 1, 0, 1, -1);
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2019-11-13 18:37:27 +01:00
|
|
|
m_fileChooser->setPath(m_path);
|
|
|
|
|
|
|
|
|
|
QObject::connect(m_fileChooser, &Utils::PathChooser::pathChanged,
|
|
|
|
|
[this](){
|
|
|
|
|
updateStatus();
|
|
|
|
|
emit changed();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
updateStatus();
|
2019-10-22 14:33:31 +02:00
|
|
|
return m_widget;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
McuPackage::Status McuPackage::status() const
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
return m_status;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
void McuPackage::setDownloadUrl(const QString &url)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
m_downloadUrl = url;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
void McuPackage::setEnvironmentVariableName(const QString &name)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
m_environmentVariableName = name;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
QString McuPackage::environmentVariableName() const
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
return m_environmentVariableName;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
void McuPackage::setAddToPath(bool addToPath)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
m_addToPath = addToPath;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
bool McuPackage::addToPath() const
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
return m_addToPath;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
void McuPackage::writeToSettings() const
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
2020-06-03 09:28:47 +02:00
|
|
|
const QString key = QLatin1String(Constants::SETTINGS_GROUP) + '/' +
|
|
|
|
|
QLatin1String(Constants::SETTINGS_KEY_PACKAGE_PREFIX) + m_settingsKey;
|
|
|
|
|
QSettings *uS = Core::ICore::settings();
|
2020-06-05 00:33:06 +02:00
|
|
|
if (m_path == m_defaultPath)
|
2020-06-03 09:28:47 +02:00
|
|
|
uS->remove(key);
|
|
|
|
|
else
|
|
|
|
|
uS->setValue(key, m_path);
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
void McuPackage::setRelativePathModifier(const QString &path)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
m_relativePathModifier = path;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
void McuPackage::updateStatus()
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
m_path = m_fileChooser->rawPath();
|
|
|
|
|
const bool validPath = m_fileChooser->isValid();
|
|
|
|
|
const Utils::FilePath detectionPath = Utils::FilePath::fromString(
|
2020-04-09 11:35:12 +02:00
|
|
|
m_fileChooser->filePath().toString() + "/" + m_detectionPath);
|
2019-10-22 14:33:31 +02:00
|
|
|
const QString displayDetectionPath = Utils::FilePath::fromString(m_detectionPath).toUserOutput();
|
2020-04-09 23:50:03 +02:00
|
|
|
const bool validPackage = m_detectionPath.isEmpty() || detectionPath.exists();
|
2019-10-22 14:33:31 +02:00
|
|
|
|
|
|
|
|
m_status = validPath ? (validPackage ? ValidPackage : ValidPathInvalidPackage) : InvalidPath;
|
|
|
|
|
|
2019-12-11 21:17:53 +01:00
|
|
|
m_infoLabel->setType(m_status == ValidPackage ? Utils::InfoLabel::Ok
|
|
|
|
|
: Utils::InfoLabel::NotOk);
|
2019-10-22 14:33:31 +02:00
|
|
|
|
|
|
|
|
QString statusText;
|
|
|
|
|
switch (m_status) {
|
|
|
|
|
case ValidPackage:
|
2020-04-09 23:50:03 +02:00
|
|
|
statusText = m_detectionPath.isEmpty()
|
|
|
|
|
? "Path exists." // TODO tr()
|
|
|
|
|
: tr("Path is valid, \"%1\" was found.").arg(displayDetectionPath);
|
2019-10-22 14:33:31 +02:00
|
|
|
break;
|
|
|
|
|
case ValidPathInvalidPackage:
|
|
|
|
|
statusText = tr("Path exists, but does not contain \"%1\".").arg(displayDetectionPath);
|
|
|
|
|
break;
|
|
|
|
|
case InvalidPath:
|
|
|
|
|
statusText = tr("Path does not exist.");
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-12-11 21:17:53 +01:00
|
|
|
m_infoLabel->setText(statusText);
|
2020-06-05 00:33:06 +02:00
|
|
|
m_fileChooser->lineEdit()->button(Utils::FancyLineEdit::Right)->setEnabled(
|
|
|
|
|
m_path != m_defaultPath);
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2020-02-26 16:41:52 +01:00
|
|
|
McuToolChainPackage::McuToolChainPackage(const QString &label, const QString &defaultPath,
|
|
|
|
|
const QString &detectionPath, const QString &settingsKey,
|
|
|
|
|
McuToolChainPackage::Type type)
|
|
|
|
|
: McuPackage(label, defaultPath, detectionPath, settingsKey)
|
|
|
|
|
, m_type(type)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
McuToolChainPackage::Type McuToolChainPackage::type() const
|
|
|
|
|
{
|
|
|
|
|
return m_type;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
static ProjectExplorer::ToolChain *desktopToolChain(Utils::Id language)
|
2020-04-07 18:19:32 +02:00
|
|
|
{
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
|
|
|
|
ToolChain *toolChain = ToolChainManager::toolChain([language](const ToolChain *t) {
|
|
|
|
|
const Abi abi = t->targetAbi();
|
|
|
|
|
return (abi.os() != Abi::WindowsOS
|
|
|
|
|
|| (abi.osFlavor() == Abi::WindowsMsvc2017Flavor
|
|
|
|
|
|| abi.osFlavor() == Abi::WindowsMsvc2019Flavor))
|
|
|
|
|
&& abi.architecture() == Abi::X86Architecture
|
|
|
|
|
&& abi.wordWidth() == 64
|
|
|
|
|
&& t->language() == language;
|
|
|
|
|
});
|
|
|
|
|
return toolChain;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
static ProjectExplorer::ToolChain* armGccToolChain(const Utils::FilePath &path, Utils::Id language)
|
2020-02-26 16:41:52 +01:00
|
|
|
{
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
|
|
|
|
ToolChain *toolChain = ToolChainManager::toolChain([&path, language](const ToolChain *t){
|
|
|
|
|
return t->compilerCommand() == path && t->language() == language;
|
|
|
|
|
});
|
|
|
|
|
if (!toolChain) {
|
|
|
|
|
ToolChainFactory *gccFactory =
|
|
|
|
|
Utils::findOrDefault(ToolChainFactory::allToolChainFactories(), [](ToolChainFactory *f){
|
|
|
|
|
return f->supportedToolChainType() == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID;
|
|
|
|
|
});
|
|
|
|
|
if (gccFactory) {
|
|
|
|
|
const QList<ToolChain*> detected = gccFactory->detectForImport({path, language});
|
|
|
|
|
if (!detected.isEmpty()) {
|
|
|
|
|
toolChain = detected.first();
|
|
|
|
|
toolChain->setDetection(ToolChain::ManualDetection);
|
|
|
|
|
toolChain->setDisplayName("Arm GCC");
|
|
|
|
|
ToolChainManager::registerToolChain(toolChain);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toolChain;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
ProjectExplorer::ToolChain *McuToolChainPackage::toolChain(Utils::Id language) const
|
2020-02-26 16:41:52 +01:00
|
|
|
{
|
2020-04-07 18:19:32 +02:00
|
|
|
ProjectExplorer::ToolChain *tc = nullptr;
|
|
|
|
|
if (m_type == TypeDesktop) {
|
|
|
|
|
tc = desktopToolChain(language);
|
|
|
|
|
} else {
|
|
|
|
|
const QLatin1String compilerName(
|
|
|
|
|
language == ProjectExplorer::Constants::C_LANGUAGE_ID ? "gcc" : "g++");
|
|
|
|
|
const Utils::FilePath compiler = Utils::FilePath::fromUserInput(
|
|
|
|
|
Utils::HostOsInfo::withExecutableSuffix(
|
|
|
|
|
path() + (
|
|
|
|
|
m_type == TypeArmGcc
|
|
|
|
|
? "/bin/arm-none-eabi-%1" : m_type == TypeIAR
|
|
|
|
|
? "/foo/bar-iar-%1" : "/bar/foo-keil-%1")).arg(compilerName));
|
|
|
|
|
|
|
|
|
|
tc = armGccToolChain(compiler, language);
|
|
|
|
|
}
|
2020-02-26 16:41:52 +01:00
|
|
|
return tc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString McuToolChainPackage::cmakeToolChainFileName() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String(m_type == TypeArmGcc
|
2020-04-09 23:50:03 +02:00
|
|
|
? "armgcc" : m_type == McuToolChainPackage::TypeIAR
|
|
|
|
|
? "iar" : m_type == McuToolChainPackage::TypeKEIL
|
|
|
|
|
? "keil" : "ghs") + QLatin1String(".cmake");
|
2020-02-26 16:41:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant McuToolChainPackage::debuggerId() const
|
|
|
|
|
{
|
|
|
|
|
using namespace Debugger;
|
|
|
|
|
|
|
|
|
|
const Utils::FilePath command = Utils::FilePath::fromUserInput(
|
|
|
|
|
Utils::HostOsInfo::withExecutableSuffix(path() + (
|
|
|
|
|
m_type == TypeArmGcc
|
|
|
|
|
? "/bin/arm-none-eabi-gdb-py" : m_type == TypeIAR
|
|
|
|
|
? "/foo/bar-iar-gdb" : "/bar/foo-keil-gdb")));
|
|
|
|
|
const DebuggerItem *debugger = DebuggerItemManager::findByCommand(command);
|
|
|
|
|
QVariant debuggerId;
|
|
|
|
|
if (!debugger) {
|
|
|
|
|
DebuggerItem newDebugger;
|
|
|
|
|
newDebugger.setCommand(command);
|
2020-03-12 13:46:25 +01:00
|
|
|
const QString displayName = m_type == TypeArmGcc
|
|
|
|
|
? McuPackage::tr("Arm GDB at %1")
|
|
|
|
|
: m_type == TypeIAR ? QLatin1String("/foo/bar-iar-gdb")
|
|
|
|
|
: QLatin1String("/bar/foo-keil-gdb");
|
2020-02-26 16:41:52 +01:00
|
|
|
newDebugger.setUnexpandedDisplayName(displayName.arg(command.toUserOutput()));
|
|
|
|
|
debuggerId = DebuggerItemManager::registerDebugger(newDebugger);
|
|
|
|
|
} else {
|
|
|
|
|
debuggerId = debugger->id();
|
|
|
|
|
}
|
|
|
|
|
return debuggerId;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-30 17:09:03 +02:00
|
|
|
McuTarget::McuTarget(const QVersionNumber &qulVersion, const QString &vendor,
|
|
|
|
|
const QString &platform, OS os,
|
2020-04-23 23:30:40 +02:00
|
|
|
const QVector<McuPackage *> &packages,
|
|
|
|
|
const McuToolChainPackage *toolChainPackage)
|
2020-06-30 17:09:03 +02:00
|
|
|
: m_qulVersion(qulVersion)
|
|
|
|
|
, m_vendor(vendor)
|
2020-02-06 00:17:04 +01:00
|
|
|
, m_qulPlatform(platform)
|
2020-04-27 20:51:08 +02:00
|
|
|
, m_os(os)
|
2019-10-22 14:33:31 +02:00
|
|
|
, m_packages(packages)
|
2020-02-26 16:41:52 +01:00
|
|
|
, m_toolChainPackage(toolChainPackage)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-20 13:32:10 +01:00
|
|
|
QString McuTarget::vendor() const
|
|
|
|
|
{
|
|
|
|
|
return m_vendor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVector<McuPackage *> McuTarget::packages() const
|
|
|
|
|
{
|
|
|
|
|
return m_packages;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-23 23:30:40 +02:00
|
|
|
const McuToolChainPackage *McuTarget::toolChainPackage() const
|
2019-11-20 13:32:10 +01:00
|
|
|
{
|
2020-02-26 16:41:52 +01:00
|
|
|
return m_toolChainPackage;
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-27 20:51:08 +02:00
|
|
|
McuTarget::OS McuTarget::os() const
|
|
|
|
|
{
|
|
|
|
|
return m_os;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-20 13:32:10 +01:00
|
|
|
QString McuTarget::qulPlatform() const
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
2019-11-20 13:32:10 +01:00
|
|
|
return m_qulPlatform;
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
bool McuTarget::isValid() const
|
2019-11-13 18:37:27 +01:00
|
|
|
{
|
2019-11-15 08:38:55 +01:00
|
|
|
return !Utils::anyOf(packages(), [](McuPackage *package) {
|
|
|
|
|
return package->status() != McuPackage::ValidPackage;
|
2019-11-13 18:37:27 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-30 17:09:03 +02:00
|
|
|
QVersionNumber McuTarget::qulVersion() const
|
|
|
|
|
{
|
|
|
|
|
return m_qulVersion;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-21 01:22:28 +01:00
|
|
|
int McuTarget::colorDepth() const
|
|
|
|
|
{
|
|
|
|
|
return m_colorDepth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void McuTarget::setColorDepth(int colorDepth)
|
|
|
|
|
{
|
|
|
|
|
m_colorDepth = colorDepth;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-22 14:33:31 +02:00
|
|
|
McuSupportOptions::McuSupportOptions(QObject *parent)
|
|
|
|
|
: QObject(parent)
|
2020-03-12 14:25:49 +01:00
|
|
|
, qtForMCUsSdkPackage(Sdk::createQtForMCUsPackage())
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
2020-03-18 03:17:35 +01:00
|
|
|
connect(qtForMCUsSdkPackage, &McuPackage::changed,
|
|
|
|
|
this, &McuSupportOptions::populatePackagesAndTargets);
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
McuSupportOptions::~McuSupportOptions()
|
2020-03-18 03:17:35 +01:00
|
|
|
{
|
|
|
|
|
deletePackagesAndTargets();
|
|
|
|
|
delete qtForMCUsSdkPackage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void McuSupportOptions::populatePackagesAndTargets()
|
|
|
|
|
{
|
|
|
|
|
setQulDir(Utils::FilePath::fromUserInput(qtForMCUsSdkPackage->path()));
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-02 19:31:52 +02:00
|
|
|
static Utils::FilePath qulDocsDir()
|
|
|
|
|
{
|
|
|
|
|
const Utils::FilePath qulDir = McuSupportOptions::qulDirFromSettings();
|
|
|
|
|
if (qulDir.isEmpty() || !qulDir.exists())
|
|
|
|
|
return {};
|
|
|
|
|
const Utils::FilePath docsDir = qulDir.pathAppended("docs");
|
|
|
|
|
return docsDir.exists() ? docsDir : Utils::FilePath();
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-24 18:58:29 +01:00
|
|
|
void McuSupportOptions::registerQchFiles()
|
|
|
|
|
{
|
2020-04-02 19:31:52 +02:00
|
|
|
const QString docsDir = qulDocsDir().toString();
|
|
|
|
|
if (docsDir.isEmpty())
|
2020-03-24 18:58:29 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const QStringList qchFiles = {
|
2020-04-02 19:31:52 +02:00
|
|
|
docsDir + "/quickultralite.qch",
|
|
|
|
|
docsDir + "/quickultralitecmake.qch"
|
2020-03-24 18:58:29 +01:00
|
|
|
};
|
|
|
|
|
Core::HelpManager::registerDocumentation(
|
|
|
|
|
Utils::filtered(qchFiles,
|
|
|
|
|
[](const QString &file) { return QFileInfo::exists(file); }));
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-02 19:31:52 +02:00
|
|
|
void McuSupportOptions::registerExamples()
|
|
|
|
|
{
|
|
|
|
|
const Utils::FilePath docsDir = qulDocsDir();
|
|
|
|
|
if (docsDir.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const Utils::FilePath examplesDir =
|
|
|
|
|
McuSupportOptions::qulDirFromSettings().pathAppended("demos");
|
|
|
|
|
if (!examplesDir.exists())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QtSupport::QtVersionManager::registerExampleSet("Qt for MCUs", docsDir.toString(),
|
|
|
|
|
examplesDir.toString());
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-18 03:17:35 +01:00
|
|
|
void McuSupportOptions::deletePackagesAndTargets()
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
qDeleteAll(packages);
|
|
|
|
|
packages.clear();
|
2019-11-15 08:38:55 +01:00
|
|
|
qDeleteAll(mcuTargets);
|
|
|
|
|
mcuTargets.clear();
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-30 17:09:03 +02:00
|
|
|
const QVersionNumber &McuSupportOptions::minimalQulVersion()
|
2020-03-25 15:09:02 +01:00
|
|
|
{
|
2020-06-29 23:27:16 +02:00
|
|
|
static const QVersionNumber v({1, 3});
|
2020-03-25 15:09:02 +01:00
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-18 03:17:35 +01:00
|
|
|
void McuSupportOptions::setQulDir(const Utils::FilePath &dir)
|
|
|
|
|
{
|
|
|
|
|
deletePackagesAndTargets();
|
2020-05-07 12:38:28 +02:00
|
|
|
Sdk::targetsAndPackages(dir, &packages, &mcuTargets);
|
2020-03-18 03:17:35 +01:00
|
|
|
//packages.append(qtForMCUsSdkPackage);
|
|
|
|
|
for (auto package : packages) {
|
|
|
|
|
connect(package, &McuPackage::changed, [this](){
|
|
|
|
|
emit changed();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
emit changed();
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-24 18:58:29 +01:00
|
|
|
Utils::FilePath McuSupportOptions::qulDirFromSettings()
|
|
|
|
|
{
|
|
|
|
|
return Utils::FilePath::fromUserInput(
|
2020-06-05 00:33:06 +02:00
|
|
|
packagePathFromSettings(Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK,
|
|
|
|
|
QSettings::UserScope));
|
2020-03-24 18:58:29 +01:00
|
|
|
}
|
|
|
|
|
|
2019-12-06 17:58:38 +01:00
|
|
|
static Utils::FilePath jomExecutablePath()
|
|
|
|
|
{
|
|
|
|
|
return Utils::HostOsInfo::isWindowsHost() ?
|
|
|
|
|
Utils::FilePath::fromUserInput(Core::ICore::libexecPath() + "/jom.exe")
|
|
|
|
|
: Utils::FilePath();
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-12 10:39:18 +01:00
|
|
|
static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k,
|
2019-11-15 08:38:55 +01:00
|
|
|
const McuTarget* mcuTarget)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
using namespace ProjectExplorer;
|
2020-04-23 23:30:40 +02:00
|
|
|
using namespace Constants;
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2019-11-12 10:39:18 +01:00
|
|
|
k->setUnexpandedDisplayName(kitName);
|
2020-04-23 23:30:40 +02:00
|
|
|
k->setValue(KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor());
|
|
|
|
|
k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform());
|
|
|
|
|
k->setValue(KIT_MCUTARGET_COLORDEPTH_KEY, mcuTarget->colorDepth());
|
2020-06-30 17:09:03 +02:00
|
|
|
k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, mcuTarget->qulVersion().toString());
|
2020-04-23 23:30:40 +02:00
|
|
|
k->setValue(KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION);
|
2020-04-27 20:51:08 +02:00
|
|
|
k->setValue(KIT_MCUTARGET_OS_KEY, static_cast<int>(mcuTarget->os()));
|
2019-11-13 18:37:27 +01:00
|
|
|
k->setAutoDetected(true);
|
|
|
|
|
k->makeSticky();
|
2020-04-07 18:19:32 +02:00
|
|
|
if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop)
|
2020-04-23 23:30:40 +02:00
|
|
|
k->setDeviceTypeForIcon(DEVICE_TYPE);
|
2020-06-26 13:59:38 +02:00
|
|
|
QSet<Utils::Id> irrelevant = {
|
2020-04-07 18:19:32 +02:00
|
|
|
SysRootKitAspect::id(),
|
|
|
|
|
QtSupport::QtKitAspect::id()
|
|
|
|
|
};
|
|
|
|
|
if (jomExecutablePath().exists()) // TODO: add id() getter to CMakeGeneratorKitAspect
|
|
|
|
|
irrelevant.insert("CMake.GeneratorKitInformation");
|
|
|
|
|
k->setIrrelevantAspects(irrelevant);
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2020-02-26 16:41:52 +01:00
|
|
|
static void setKitToolchains(ProjectExplorer::Kit *k, const McuToolChainPackage *tcPackage)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
2020-04-09 23:50:03 +02:00
|
|
|
// No Green Hills toolchain, because support for it is missing.
|
|
|
|
|
if (tcPackage->type() == McuToolChainPackage::TypeGHS)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-02-26 16:41:52 +01:00
|
|
|
ProjectExplorer::ToolChainKitAspect::setToolChain(k, tcPackage->toolChain(
|
|
|
|
|
ProjectExplorer::Constants::C_LANGUAGE_ID));
|
|
|
|
|
ProjectExplorer::ToolChainKitAspect::setToolChain(k, tcPackage->toolChain(
|
|
|
|
|
ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2020-02-26 16:41:52 +01:00
|
|
|
static void setKitDebugger(ProjectExplorer::Kit *k, const McuToolChainPackage *tcPackage)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
2020-04-07 18:19:32 +02:00
|
|
|
// Qt Creator seems to be smart enough to deduce the right Kit debugger from the ToolChain
|
2020-04-09 23:50:03 +02:00
|
|
|
// We rely on that at least in the Desktop case.
|
|
|
|
|
if (tcPackage->type() == McuToolChainPackage::TypeDesktop
|
|
|
|
|
// No Green Hills debugger, because support for it is missing.
|
|
|
|
|
|| tcPackage->type() == McuToolChainPackage::TypeGHS)
|
2020-04-07 18:19:32 +02:00
|
|
|
return;
|
|
|
|
|
|
2020-02-26 16:41:52 +01:00
|
|
|
Debugger::DebuggerKitAspect::setDebugger(k, tcPackage->debuggerId());
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-07 18:19:32 +02:00
|
|
|
static void setKitDevice(ProjectExplorer::Kit *k, const McuTarget* mcuTarget)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
2020-04-07 18:19:32 +02:00
|
|
|
// "Device Type" Desktop is the default. We use that for the Qt for MCUs Desktop Kit
|
|
|
|
|
if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-02-26 16:41:52 +01:00
|
|
|
ProjectExplorer::DeviceTypeKitAspect::setDeviceTypeId(k, Constants::DEVICE_TYPE);
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-04 19:59:50 +01:00
|
|
|
static void setKitEnvironment(ProjectExplorer::Kit *k, const McuTarget* mcuTarget,
|
2020-04-23 23:30:40 +02:00
|
|
|
const McuPackage *qtForMCUsSdkPackage)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
|
|
|
|
Utils::EnvironmentItems changes;
|
|
|
|
|
QStringList pathAdditions;
|
2020-03-04 19:59:50 +01:00
|
|
|
|
2020-04-07 18:19:32 +02:00
|
|
|
// The Desktop version depends on the Qt shared libs in Qul_DIR/bin.
|
|
|
|
|
// 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.
|
|
|
|
|
if (mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop
|
|
|
|
|
&& !CMakeProjectManager::CMakeToolManager::defaultCMakeTool()->hasFileApi())
|
|
|
|
|
pathAdditions.append(QDir::toNativeSeparators(qtForMCUsSdkPackage->path() + "/bin"));
|
|
|
|
|
|
2020-04-23 23:30:40 +02:00
|
|
|
auto processPackage = [&pathAdditions, &changes](const McuPackage *package) {
|
2019-10-22 14:33:31 +02:00
|
|
|
if (package->addToPath())
|
|
|
|
|
pathAdditions.append(QDir::toNativeSeparators(package->path()));
|
|
|
|
|
if (!package->environmentVariableName().isEmpty())
|
|
|
|
|
changes.append({package->environmentVariableName(),
|
|
|
|
|
QDir::toNativeSeparators(package->path())});
|
2020-04-23 23:30:40 +02:00
|
|
|
};
|
|
|
|
|
for (auto package : mcuTarget->packages())
|
|
|
|
|
processPackage(package);
|
|
|
|
|
processPackage(qtForMCUsSdkPackage);
|
|
|
|
|
|
2019-10-31 16:01:35 +01:00
|
|
|
pathAdditions.append("${Path}");
|
2019-10-31 16:04:59 +01:00
|
|
|
pathAdditions.append(QDir::toNativeSeparators(Core::ICore::libexecPath() + "/clang/bin"));
|
2019-11-28 21:13:40 +01:00
|
|
|
const QString path = QLatin1String(Utils::HostOsInfo().isWindowsHost() ? "Path" : "PATH");
|
2019-11-28 18:17:37 +01:00
|
|
|
changes.append({path, pathAdditions.join(Utils::HostOsInfo::pathListSeparator())});
|
2019-10-22 14:33:31 +02:00
|
|
|
EnvironmentKitAspect::setEnvironmentChanges(k, changes);
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
static void setKitCMakeOptions(ProjectExplorer::Kit *k, const McuTarget* mcuTarget,
|
2019-11-12 10:39:18 +01:00
|
|
|
const QString &qulDir)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
using namespace CMakeProjectManager;
|
|
|
|
|
|
|
|
|
|
CMakeConfig config = CMakeConfigurationKitAspect::configuration(k);
|
2020-04-09 23:50:03 +02:00
|
|
|
// CMake ToolChain file for ghs handles CMAKE_*_COMPILER autonomously
|
|
|
|
|
if (mcuTarget->toolChainPackage()->type() != McuToolChainPackage::TypeGHS) {
|
|
|
|
|
config.append(CMakeConfigItem("CMAKE_CXX_COMPILER", "%{Compiler:Executable:Cxx}"));
|
|
|
|
|
config.append(CMakeConfigItem("CMAKE_C_COMPILER", "%{Compiler:Executable:C}"));
|
|
|
|
|
}
|
2020-04-07 18:19:32 +02:00
|
|
|
if (mcuTarget->toolChainPackage()->type() != McuToolChainPackage::TypeDesktop)
|
2020-02-26 16:41:52 +01:00
|
|
|
config.append(CMakeConfigItem(
|
|
|
|
|
"CMAKE_TOOLCHAIN_FILE",
|
|
|
|
|
(qulDir + "/lib/cmake/Qul/toolchain/"
|
|
|
|
|
+ mcuTarget->toolChainPackage()->cmakeToolChainFileName()).toUtf8()));
|
2020-02-06 00:17:04 +01:00
|
|
|
config.append(CMakeConfigItem("QUL_GENERATORS",
|
2020-02-26 16:41:52 +01:00
|
|
|
(qulDir + "/lib/cmake/Qul/QulGenerators.cmake").toUtf8()));
|
2020-02-06 00:17:04 +01:00
|
|
|
config.append(CMakeConfigItem("QUL_PLATFORM",
|
|
|
|
|
mcuTarget->qulPlatform().toUtf8()));
|
2020-04-27 20:51:08 +02:00
|
|
|
if (mcuTarget->os() == McuTarget::OS::FreeRTOS)
|
|
|
|
|
config.append(CMakeConfigItem("OS", "FreeRTOS"));
|
2019-11-21 01:22:28 +01:00
|
|
|
if (mcuTarget->colorDepth() >= 0)
|
|
|
|
|
config.append(CMakeConfigItem("QUL_COLOR_DEPTH",
|
|
|
|
|
QString::number(mcuTarget->colorDepth()).toLatin1()));
|
2019-12-06 17:58:38 +01:00
|
|
|
const Utils::FilePath jom = jomExecutablePath();
|
|
|
|
|
if (jom.exists()) {
|
|
|
|
|
config.append(CMakeConfigItem("CMAKE_MAKE_PROGRAM", jom.toString().toLatin1()));
|
2019-10-31 16:01:35 +01:00
|
|
|
CMakeGeneratorKitAspect::setGenerator(k, "NMake Makefiles JOM");
|
2019-12-06 17:58:38 +01:00
|
|
|
}
|
|
|
|
|
CMakeConfigurationKitAspect::setConfiguration(k, config);
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-07 18:19:32 +02:00
|
|
|
static void setKitQtVersionOptions(ProjectExplorer::Kit *k)
|
|
|
|
|
{
|
|
|
|
|
QtSupport::QtKitAspect::setQtVersion(k, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-23 23:30:40 +02:00
|
|
|
QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
|
2019-11-12 15:14:20 +01:00
|
|
|
{
|
2020-04-27 20:51:08 +02:00
|
|
|
const QString os = QLatin1String(mcuTarget->os()
|
|
|
|
|
== McuTarget::OS::FreeRTOS ? " FreeRTOS" : "");
|
2019-11-21 01:22:28 +01:00
|
|
|
const QString colorDepth = mcuTarget->colorDepth() > 0
|
|
|
|
|
? QString::fromLatin1(" %1bpp").arg(mcuTarget->colorDepth())
|
|
|
|
|
: "";
|
2020-04-07 18:19:32 +02:00
|
|
|
// Hack: Use the platform name in the kit name. Exception for the "Qt" platform: use "Desktop"
|
|
|
|
|
const QString targetName =
|
|
|
|
|
mcuTarget->toolChainPackage()->type() == McuToolChainPackage::TypeDesktop
|
|
|
|
|
? "Desktop"
|
|
|
|
|
: mcuTarget->qulPlatform();
|
2020-04-27 20:51:08 +02:00
|
|
|
return QString::fromLatin1("Qt for MCUs %1 - %2%3%4")
|
2020-06-30 17:09:03 +02:00
|
|
|
.arg(mcuTarget->qulVersion().toString(), targetName, os, colorDepth);
|
2019-11-12 15:14:20 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-23 23:30:40 +02:00
|
|
|
QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
using namespace ProjectExplorer;
|
2020-04-23 23:30:40 +02:00
|
|
|
using namespace Constants;
|
|
|
|
|
return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
|
|
|
|
|
return kit->isAutoDetected()
|
|
|
|
|
&& kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
|
|
|
|
|
&& (!mcuTarget || (
|
|
|
|
|
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->vendor()
|
|
|
|
|
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->qulPlatform()
|
|
|
|
|
&& kit->value(KIT_MCUTARGET_COLORDEPTH_KEY) == mcuTarget->colorDepth()
|
2020-04-27 20:51:08 +02:00
|
|
|
&& kit->value(KIT_MCUTARGET_OS_KEY).toInt()
|
|
|
|
|
== static_cast<int>(mcuTarget->os())
|
2020-04-23 23:30:40 +02:00
|
|
|
));
|
2019-10-22 14:33:31 +02:00
|
|
|
});
|
2019-11-13 18:37:27 +01:00
|
|
|
}
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2020-04-22 23:24:54 +02:00
|
|
|
QList<ProjectExplorer::Kit *> McuSupportOptions::outdatedKits()
|
|
|
|
|
{
|
|
|
|
|
return Utils::filtered(ProjectExplorer::KitManager::kits(), [](ProjectExplorer::Kit *kit) {
|
|
|
|
|
return kit->isAutoDetected()
|
|
|
|
|
&& !kit->value(Constants::KIT_MCUTARGET_VENDOR_KEY).isNull()
|
|
|
|
|
&& kit->value(Constants::KIT_MCUTARGET_KITVERSION_KEY) != KIT_VERSION;
|
2019-10-22 14:33:31 +02:00
|
|
|
});
|
2019-11-13 18:37:27 +01:00
|
|
|
}
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2020-04-22 23:24:54 +02:00
|
|
|
void McuSupportOptions::removeOutdatedKits()
|
|
|
|
|
{
|
|
|
|
|
for (auto kit : McuSupportOptions::outdatedKits())
|
|
|
|
|
ProjectExplorer::KitManager::deregisterKit(kit);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-23 23:30:40 +02:00
|
|
|
ProjectExplorer::Kit *McuSupportOptions::newKit(const McuTarget *mcuTarget,
|
|
|
|
|
const McuPackage *qtForMCUsSdk)
|
2019-11-13 18:37:27 +01:00
|
|
|
{
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
2020-04-23 23:30:40 +02:00
|
|
|
const auto init = [mcuTarget, qtForMCUsSdk](Kit *k) {
|
2019-11-13 18:37:27 +01:00
|
|
|
KitGuard kitGuard(k);
|
|
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
setKitProperties(kitName(mcuTarget), k, mcuTarget);
|
2020-04-07 18:19:32 +02:00
|
|
|
setKitDevice(k, mcuTarget);
|
|
|
|
|
setKitToolchains(k, mcuTarget->toolChainPackage());
|
|
|
|
|
setKitDebugger(k, mcuTarget->toolChainPackage());
|
2020-04-23 23:30:40 +02:00
|
|
|
setKitEnvironment(k, mcuTarget, qtForMCUsSdk);
|
|
|
|
|
setKitCMakeOptions(k, mcuTarget, qtForMCUsSdk->path());
|
2020-04-07 18:19:32 +02:00
|
|
|
setKitQtVersionOptions(k);
|
2019-11-13 18:37:27 +01:00
|
|
|
|
|
|
|
|
k->setup();
|
|
|
|
|
k->fix();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return KitManager::registerKit(init);
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // McuSupport
|