McuSupport: Add optional color depth (bpp) property to McuTarget

...include that in kit names and add it as "QUL_COLOR_DEPTH" CMake
parameter.

Change-Id: I14ba7ce465c54d525683be2660d2e24b6ecfed6c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2019-11-21 01:22:28 +01:00
parent b738a9d02d
commit f8f6f53960
2 changed files with 29 additions and 5 deletions

View File

@@ -251,6 +251,16 @@ bool McuTarget::isValid() const
}); });
} }
int McuTarget::colorDepth() const
{
return m_colorDepth;
}
void McuTarget::setColorDepth(int colorDepth)
{
m_colorDepth = colorDepth;
}
static McuPackage *createQtForMCUsPackage() static McuPackage *createQtForMCUsPackage()
{ {
auto result = new McuPackage( auto result = new McuPackage(
@@ -387,6 +397,12 @@ McuSupportOptions::McuSupportOptions(QObject *parent)
// STM // STM
auto mcuTarget = new McuTarget(vendorStm, "stm32f7508", stmEvalPackages); auto mcuTarget = new McuTarget(vendorStm, "stm32f7508", stmEvalPackages);
mcuTarget->setToolChainFile("CMake/stm32f7508-discovery.cmake"); mcuTarget->setToolChainFile("CMake/stm32f7508-discovery.cmake");
mcuTarget->setColorDepth(32);
mcuTargets.append(mcuTarget);
mcuTarget = new McuTarget(vendorStm, "stm32f7508", stmEvalPackages);
mcuTarget->setToolChainFile("CMake/stm32f7508-discovery.cmake");
mcuTarget->setColorDepth(16);
mcuTargets.append(mcuTarget); mcuTargets.append(mcuTarget);
mcuTarget = new McuTarget(vendorStm, "stm32f769i", stmEvalPackages); mcuTarget = new McuTarget(vendorStm, "stm32f769i", stmEvalPackages);
@@ -407,6 +423,7 @@ McuSupportOptions::McuSupportOptions(QObject *parent)
// Desktop // Desktop
mcuTarget = new McuTarget(vendorQt, "Desktop", desktopPackages); mcuTarget = new McuTarget(vendorQt, "Desktop", desktopPackages);
mcuTarget->setQulPlatform("Qt"); mcuTarget->setQulPlatform("Qt");
mcuTarget->setColorDepth(32);
mcuTargets.append(mcuTarget); mcuTargets.append(mcuTarget);
for (auto package : packages) for (auto package : packages)
@@ -552,11 +569,11 @@ static void setKitCMakeOptions(ProjectExplorer::Kit *k, const McuTarget* mcuTarg
if (!mcuTarget->qulPlatform().isEmpty()) if (!mcuTarget->qulPlatform().isEmpty())
config.append(CMakeConfigItem("QUL_PLATFORM", config.append(CMakeConfigItem("QUL_PLATFORM",
mcuTarget->qulPlatform().toUtf8())); mcuTarget->qulPlatform().toUtf8()));
if (mcuTargetIsDesktop(mcuTarget)) { if (mcuTargetIsDesktop(mcuTarget))
config.append(CMakeConfigItem("CMAKE_PREFIX_PATH", "%{Qt:QT_INSTALL_PREFIX}")); config.append(CMakeConfigItem("CMAKE_PREFIX_PATH", "%{Qt:QT_INSTALL_PREFIX}"));
// TODO: Hack! Implement color depth variants of all targets if (mcuTarget->colorDepth() >= 0)
config.append(CMakeConfigItem("QUL_COLOR_DEPTH", "32")); config.append(CMakeConfigItem("QUL_COLOR_DEPTH",
} QString::number(mcuTarget->colorDepth()).toLatin1()));
CMakeConfigurationKitAspect::setConfiguration(k, config); CMakeConfigurationKitAspect::setConfiguration(k, config);
if (Utils::HostOsInfo::isWindowsHost()) if (Utils::HostOsInfo::isWindowsHost())
CMakeGeneratorKitAspect::setGenerator(k, "NMake Makefiles JOM"); CMakeGeneratorKitAspect::setGenerator(k, "NMake Makefiles JOM");
@@ -565,7 +582,11 @@ static void setKitCMakeOptions(ProjectExplorer::Kit *k, const McuTarget* mcuTarg
QString McuSupportOptions::kitName(const McuTarget *mcuTarget) const QString McuSupportOptions::kitName(const McuTarget *mcuTarget) const
{ {
// TODO: get version from qulSdkPackage and insert into name // TODO: get version from qulSdkPackage and insert into name
return QString::fromLatin1("Qt for MCUs - %1 %2").arg(mcuTarget->vendor(), mcuTarget->model()); const QString colorDepth = mcuTarget->colorDepth() > 0
? QString::fromLatin1(" %1bpp").arg(mcuTarget->colorDepth())
: "";
return QString::fromLatin1("Qt for MCUs - %1 %2%3")
.arg(mcuTarget->vendor(), mcuTarget->model(), colorDepth);
} }
QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTargt) QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTargt)

View File

@@ -110,6 +110,8 @@ public:
QString toolChainFile() const; QString toolChainFile() const;
void setQulPlatform(const QString &qulPlatform); void setQulPlatform(const QString &qulPlatform);
QString qulPlatform() const; QString qulPlatform() const;
void setColorDepth(int colorDepth);
int colorDepth() const;
bool isValid() const; bool isValid() const;
private: private:
@@ -118,6 +120,7 @@ private:
const QVector<McuPackage*> m_packages; const QVector<McuPackage*> m_packages;
QString m_toolChainFile; QString m_toolChainFile;
QString m_qulPlatform; QString m_qulPlatform;
int m_colorDepth = -1;
}; };
class McuSupportOptions : public QObject class McuSupportOptions : public QObject