2022-03-01 21:27:49 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** 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 "mcutargetfactory.h"
|
2022-03-09 17:29:07 +01:00
|
|
|
#include "mcuhelpers.h"
|
2022-03-01 21:27:49 +01:00
|
|
|
#include "mcupackage.h"
|
|
|
|
|
#include "mcutarget.h"
|
|
|
|
|
#include "mcutargetdescription.h"
|
|
|
|
|
|
|
|
|
|
#include <QVersionNumber>
|
|
|
|
|
|
|
|
|
|
namespace McuSupport::Internal::Sdk {
|
|
|
|
|
|
2022-03-09 17:29:07 +01:00
|
|
|
QPair<Targets, Packages> McuTargetFactory::createTargets(const McuTargetDescription &desc)
|
2022-03-01 21:27:49 +01:00
|
|
|
{
|
2022-03-09 17:29:07 +01:00
|
|
|
Targets mcuTargets;
|
|
|
|
|
Packages packages;
|
2022-03-01 21:27:49 +01:00
|
|
|
|
|
|
|
|
for (int colorDepth : desc.platform.colorDepths) {
|
2022-03-09 17:29:07 +01:00
|
|
|
const McuTarget::Platform platform(
|
|
|
|
|
{desc.platform.id, desc.platform.name, desc.platform.vendor});
|
2022-03-01 21:27:49 +01:00
|
|
|
|
2022-03-09 17:29:07 +01:00
|
|
|
Packages targetPackages = createPackages(desc);
|
2022-03-28 16:42:51 +02:00
|
|
|
packages.unite(targetPackages);
|
|
|
|
|
mcuTargets.append(McuTargetPtr{
|
|
|
|
|
new McuTarget{QVersionNumber::fromString(desc.qulVersion),
|
|
|
|
|
platform,
|
|
|
|
|
deduceOperatingSystem(desc),
|
|
|
|
|
targetPackages,
|
|
|
|
|
McuToolChainPackagePtr{new McuToolChainPackage{
|
|
|
|
|
{}, {}, {}, {}, McuToolChainPackage::ToolChainType::Unsupported}},
|
|
|
|
|
colorDepth}});
|
2022-03-09 17:29:07 +01:00
|
|
|
}
|
|
|
|
|
return {mcuTargets, packages};
|
|
|
|
|
}
|
2022-03-01 21:27:49 +01:00
|
|
|
|
2022-03-09 17:29:07 +01:00
|
|
|
QList<PackageDescription> aggregatePackageEntries(const McuTargetDescription &desc)
|
|
|
|
|
{
|
|
|
|
|
QList<PackageDescription> result;
|
|
|
|
|
result.append(desc.boardSdk.packages);
|
|
|
|
|
result.append(desc.freeRTOS.packages);
|
|
|
|
|
result.append(desc.toolchain.packages);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2022-03-01 21:27:49 +01:00
|
|
|
|
2022-03-09 17:29:07 +01:00
|
|
|
Packages McuTargetFactory::createPackages(const McuTargetDescription &desc)
|
|
|
|
|
{
|
|
|
|
|
Packages packages;
|
|
|
|
|
QList<PackageDescription> packageDescriptions = aggregatePackageEntries(desc);
|
2022-03-01 21:27:49 +01:00
|
|
|
|
2022-03-09 17:29:07 +01:00
|
|
|
for (const PackageDescription &pkgDesc : packageDescriptions) {
|
2022-03-28 16:42:51 +02:00
|
|
|
packages.insert(McuPackagePtr{new McuPackage{
|
2022-03-09 17:29:07 +01:00
|
|
|
pkgDesc.label,
|
|
|
|
|
pkgDesc.defaultPath,
|
|
|
|
|
pkgDesc.validationPath,
|
|
|
|
|
pkgDesc.setting,
|
|
|
|
|
pkgDesc.cmakeVar,
|
|
|
|
|
pkgDesc.envVar,
|
2022-03-28 16:42:51 +02:00
|
|
|
}});
|
2022-03-01 21:27:49 +01:00
|
|
|
}
|
2022-03-09 17:29:07 +01:00
|
|
|
|
|
|
|
|
return packages;
|
2022-03-01 21:27:49 +01:00
|
|
|
}
|
2022-03-09 17:29:07 +01:00
|
|
|
|
2022-03-01 21:27:49 +01:00
|
|
|
} // namespace McuSupport::Internal::Sdk
|