2019-10-22 14:33:31 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2022-02-11 13:51:42 +01:00
|
|
|
** Copyright (C) 2022 The Qt Company Ltd.
|
2020-07-02 16:04:31 +02:00
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
#include <utils/environmentfwd.h>
|
2019-10-22 14:33:31 +02:00
|
|
|
#include <QObject>
|
2019-10-23 06:44:21 +02:00
|
|
|
#include <QVector>
|
2020-03-25 15:09:02 +01:00
|
|
|
#include <QVersionNumber>
|
2019-10-22 14:33:31 +02:00
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QWidget)
|
|
|
|
|
|
|
|
|
|
namespace Utils {
|
2020-03-18 03:17:35 +01:00
|
|
|
class FilePath;
|
2019-10-22 14:33:31 +02:00
|
|
|
class PathChooser;
|
2019-12-11 21:17:53 +01:00
|
|
|
class InfoLabel;
|
2019-10-22 14:33:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class Kit;
|
2020-02-26 16:41:52 +01:00
|
|
|
class ToolChain;
|
2022-02-11 13:51:42 +01:00
|
|
|
} // namespace ProjectExplorer
|
2019-10-22 14:33:31 +02:00
|
|
|
|
|
|
|
|
namespace McuSupport {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
class McuAbstractPackage;
|
2022-02-01 14:30:35 +01:00
|
|
|
class McuToolChainPackage;
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2022-02-01 14:30:35 +01:00
|
|
|
void printMessage(const QString &message, bool important);
|
2020-02-26 16:41:52 +01:00
|
|
|
|
2019-11-15 08:38:55 +01:00
|
|
|
class McuTarget : public QObject
|
2019-10-22 14:33:31 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2020-04-27 20:51:08 +02:00
|
|
|
enum class OS {
|
|
|
|
|
Desktop,
|
|
|
|
|
BareMetal,
|
|
|
|
|
FreeRTOS
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-18 11:16:37 +02:00
|
|
|
struct Platform {
|
|
|
|
|
QString name;
|
|
|
|
|
QString displayName;
|
|
|
|
|
QString vendor;
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-07 16:17:35 +01:00
|
|
|
enum { UnspecifiedColorDepth = -1 };
|
|
|
|
|
|
|
|
|
|
McuTarget(const QVersionNumber &qulVersion,
|
|
|
|
|
const Platform &platform,
|
|
|
|
|
OS os,
|
2022-02-11 13:51:42 +01:00
|
|
|
const QVector<McuAbstractPackage *> &packages,
|
2022-02-07 16:17:35 +01:00
|
|
|
const McuToolChainPackage *toolChainPackage,
|
|
|
|
|
int colorDepth = UnspecifiedColorDepth);
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2022-02-01 16:07:50 +01:00
|
|
|
const QVersionNumber &qulVersion() const;
|
2022-02-11 13:51:42 +01:00
|
|
|
const QVector<McuAbstractPackage *> &packages() const;
|
2020-04-23 23:30:40 +02:00
|
|
|
const McuToolChainPackage *toolChainPackage() const;
|
2022-02-01 16:07:50 +01:00
|
|
|
const Platform &platform() const;
|
2020-04-27 20:51:08 +02:00
|
|
|
OS os() const;
|
2019-11-21 01:22:28 +01:00
|
|
|
int colorDepth() const;
|
2019-11-13 18:37:27 +01:00
|
|
|
bool isValid() const;
|
2020-12-04 16:32:34 +01:00
|
|
|
void printPackageProblems() const;
|
2019-10-22 14:33:31 +02:00
|
|
|
|
|
|
|
|
private:
|
2020-06-30 17:09:03 +02:00
|
|
|
const QVersionNumber m_qulVersion;
|
2020-09-18 11:16:37 +02:00
|
|
|
const Platform m_platform;
|
2022-02-07 16:17:35 +01:00
|
|
|
const OS m_os;
|
2022-02-11 13:51:42 +01:00
|
|
|
const QVector<McuAbstractPackage *> m_packages;
|
2020-04-23 23:30:40 +02:00
|
|
|
const McuToolChainPackage *m_toolChainPackage;
|
2022-02-07 16:17:35 +01:00
|
|
|
const int m_colorDepth;
|
2022-02-11 13:51:42 +01:00
|
|
|
}; // class McuTarget
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2021-10-27 06:55:29 +02:00
|
|
|
class McuSdkRepository
|
2021-09-29 17:23:11 +02:00
|
|
|
{
|
2021-10-27 06:55:29 +02:00
|
|
|
public:
|
2022-02-11 13:51:42 +01:00
|
|
|
QVector<McuAbstractPackage *> packages;
|
|
|
|
|
QVector<McuTarget *> mcuTargets;
|
2021-09-29 17:23:11 +02:00
|
|
|
|
|
|
|
|
void deletePackagesAndTargets();
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-22 14:33:31 +02:00
|
|
|
class McuSupportOptions : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2021-03-10 16:38:45 +01:00
|
|
|
enum UpgradeOption {
|
|
|
|
|
Ignore,
|
|
|
|
|
Keep,
|
|
|
|
|
Replace
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
explicit McuSupportOptions(QObject *parent = nullptr);
|
2019-10-22 14:33:31 +02:00
|
|
|
~McuSupportOptions() override;
|
|
|
|
|
|
2022-02-11 13:51:42 +01:00
|
|
|
McuAbstractPackage *qtForMCUsSdkPackage = nullptr;
|
2021-09-29 17:23:11 +02:00
|
|
|
McuSdkRepository sdkRepository;
|
2019-10-22 14:33:31 +02:00
|
|
|
|
2020-03-18 03:17:35 +01:00
|
|
|
void setQulDir(const Utils::FilePath &dir);
|
2022-02-11 13:51:42 +01:00
|
|
|
static void setKitEnvironment(ProjectExplorer::Kit *, const McuTarget *, const McuAbstractPackage *);
|
|
|
|
|
static void updateKitEnvironment(ProjectExplorer::Kit *, const McuTarget *);
|
|
|
|
|
static void remapQul2xCmakeVars(ProjectExplorer::Kit *, const Utils::EnvironmentItems &);
|
2020-03-24 18:58:29 +01:00
|
|
|
static Utils::FilePath qulDirFromSettings();
|
2020-03-18 03:17:35 +01:00
|
|
|
|
2020-04-23 23:30:40 +02:00
|
|
|
static QString kitName(const McuTarget* mcuTarget);
|
2019-11-12 15:14:20 +01:00
|
|
|
|
2021-03-31 16:47:22 +02:00
|
|
|
static QList<ProjectExplorer::Kit *> existingKits(const McuTarget *mcuTarget);
|
2022-02-11 13:51:42 +01:00
|
|
|
static QList<ProjectExplorer::Kit *> matchingKits(const McuTarget *mcuTarget, const McuAbstractPackage *qtForMCUsSdkPackage);
|
|
|
|
|
static QList<ProjectExplorer::Kit *> upgradeableKits(const McuTarget *mcuTarget, const McuAbstractPackage *qtForMCUsSdkPackage);
|
2021-04-08 17:14:55 +02:00
|
|
|
static QList<ProjectExplorer::Kit *> kitsWithMismatchedDependencies(const McuTarget *mcuTarget);
|
2020-04-22 23:24:54 +02:00
|
|
|
static QList<ProjectExplorer::Kit *> outdatedKits();
|
|
|
|
|
static void removeOutdatedKits();
|
2022-02-11 13:51:42 +01:00
|
|
|
static ProjectExplorer::Kit *newKit(const McuTarget *mcuTarget, const McuAbstractPackage *qtForMCUsSdk);
|
2020-10-16 15:10:17 +02:00
|
|
|
static void createAutomaticKits();
|
2021-03-10 16:38:45 +01:00
|
|
|
static UpgradeOption askForKitUpgrades();
|
|
|
|
|
static void upgradeKits(UpgradeOption upgradeOption);
|
2022-02-11 13:51:42 +01:00
|
|
|
static void upgradeKitInPlace(ProjectExplorer::Kit *kit,
|
|
|
|
|
const McuTarget *mcuTarget,
|
|
|
|
|
const McuAbstractPackage *qtForMCUsSdk);
|
2021-04-08 17:14:55 +02:00
|
|
|
static void fixKitsDependencies();
|
2021-03-10 16:38:45 +01:00
|
|
|
void checkUpgradeableKits();
|
2021-02-09 17:27:02 +01:00
|
|
|
static void fixExistingKits();
|
2020-03-18 03:17:35 +01:00
|
|
|
void populatePackagesAndTargets();
|
2020-03-24 18:58:29 +01:00
|
|
|
static void registerQchFiles();
|
2020-04-02 19:31:52 +02:00
|
|
|
static void registerExamples();
|
2020-03-18 03:17:35 +01:00
|
|
|
|
2020-06-30 17:09:03 +02:00
|
|
|
static const QVersionNumber &minimalQulVersion();
|
2020-03-25 15:09:02 +01:00
|
|
|
|
2021-03-31 16:47:22 +02:00
|
|
|
static QVersionNumber kitQulVersion(const ProjectExplorer::Kit *kit);
|
2022-02-11 13:51:42 +01:00
|
|
|
static bool kitUpToDate(const ProjectExplorer::Kit *kit,
|
|
|
|
|
const McuTarget *mcuTarget,
|
|
|
|
|
const McuAbstractPackage *qtForMCUsSdkPackage);
|
|
|
|
|
|
2020-03-18 03:17:35 +01:00
|
|
|
private:
|
|
|
|
|
void deletePackagesAndTargets();
|
2019-10-22 14:33:31 +02:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void changed();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace McuSupport
|