1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "mcukitmanager.h"
#include "mcupackage.h"
#include "mcusupportplugin.h"
#include "mcusupporttr.h"
#include "mcutarget.h"
#include <utils/algorithm.h>
using namespace Utils;
namespace McuSupport::Internal {
McuTarget::McuTarget(const QVersionNumber &qulVersion,
const Platform &platform,
OS os,
const Packages &packages,
const McuToolChainPackagePtr &toolChainPackage,
const McuPackagePtr &toolChainFilePackage,
int colorDepth)
: m_qulVersion(qulVersion)
, m_platform(platform)
, m_os(os)
, m_packages(packages)
, m_toolChainPackage(toolChainPackage)
, m_toolChainFilePackage(toolChainFilePackage)
, m_colorDepth(colorDepth)
{}
Packages McuTarget::packages() const
{
return m_packages;
}
McuToolChainPackagePtr McuTarget::toolChainPackage() const
{
return m_toolChainPackage;
}
McuPackagePtr McuTarget::toolChainFilePackage() const
{
return m_toolChainFilePackage;
}
McuTarget::OS McuTarget::os() const
{
return m_os;
}
McuTarget::Platform McuTarget::platform() const
{
return m_platform;
}
bool McuTarget::isValid() const
{
return Utils::allOf(packages(), [](const McuPackagePtr &package) {
package->updateStatus();
return package->isValidStatus();
});
}
QString McuTarget::desktopCompilerId() const
{
// MinGW shares CMake configuration with GCC
// and it is distinguished from MSVC by CMake compiler ID.
// This provides the compiler ID to set up a different Qul configuration
// for MSVC and MinGW.
if (m_toolChainPackage) {
switch (m_toolChainPackage->toolchainType()) {
case McuToolChainPackage::ToolChainType::MSVC:
return QLatin1String("msvc");
case McuToolChainPackage::ToolChainType::GCC:
case McuToolChainPackage::ToolChainType::MinGW:
return QLatin1String("gnu");
default:
return QLatin1String("unsupported");
}
}
return QLatin1String("invalid");
}
void McuTarget::printPackageProblems() const
{
for (auto package : packages()) {
package->updateStatus();
if (!package->isValidStatus())
printMessage(Tr::tr("Error creating kit for target %1, package %2: %3")
.arg(McuKitManager::generateKitNameFromTarget(this),
package->label(),
package->statusText()),
true);
if (package->status() == McuAbstractPackage::Status::ValidPackageMismatchedVersion)
printMessage(Tr::tr("Warning creating kit for target %1, package %2: %3")
.arg(McuKitManager::generateKitNameFromTarget(this),
package->label(),
package->statusText()),
false);
}
}
QVersionNumber McuTarget::qulVersion() const
{
return m_qulVersion;
}
int McuTarget::colorDepth() const
{
return m_colorDepth;
}
} // namespace McuSupport::Internal
|