McuSupport: Set jom via CMAKE_MAKE_PROGRAM instead of adding it to Path

Let's add less to the Path variable of the Kit's build environment. If
jom.exe is present, define it via CMAKE_MAKE_PROGRAM, set the CMake
Generator to Jom and hide the CMake Generator setting.

Change-Id: I58de73dc631f753d3e5c1706e593afb923fcb588
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alessandro Portale
2019-12-06 17:58:38 +01:00
parent a44562f676
commit 9eed77fe86

View File

@@ -487,6 +487,13 @@ static bool mcuTargetIsDesktop(const McuTarget* mcuTarget)
return mcuTarget->qulPlatform() == "Qt"; return mcuTarget->qulPlatform() == "Qt";
} }
static Utils::FilePath jomExecutablePath()
{
return Utils::HostOsInfo::isWindowsHost() ?
Utils::FilePath::fromUserInput(Core::ICore::libexecPath() + "/jom.exe")
: Utils::FilePath();
}
static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k, static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k,
const McuTarget* mcuTarget) const McuTarget* mcuTarget)
{ {
@@ -500,9 +507,13 @@ static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k,
if (mcuTargetIsDesktop(mcuTarget)) { if (mcuTargetIsDesktop(mcuTarget)) {
k->setDeviceTypeForIcon(Constants::DEVICE_TYPE); k->setDeviceTypeForIcon(Constants::DEVICE_TYPE);
} else { } else {
k->setIrrelevantAspects({SysRootKitAspect::id(), QSet<Core::Id> irrelevant = {
SysRootKitAspect::id(),
"QtSupport.QtInformation" // QtKitAspect::id() "QtSupport.QtInformation" // QtKitAspect::id()
}); };
if (jomExecutablePath().exists()) // TODO: add id() getter to CMakeGeneratorKitAspect
irrelevant.insert("CMake.GeneratorKitInformation");
k->setIrrelevantAspects(irrelevant);
} }
} }
@@ -564,8 +575,6 @@ static void setKitEnvironment(ProjectExplorer::Kit *k, const McuTarget* mcuTarge
QDir::toNativeSeparators(package->path())}); QDir::toNativeSeparators(package->path())});
} }
pathAdditions.append("${Path}"); pathAdditions.append("${Path}");
if (Utils::HostOsInfo::isWindowsHost())
pathAdditions.append(QDir::toNativeSeparators(Core::ICore::libexecPath())); // for jom
pathAdditions.append(QDir::toNativeSeparators(Core::ICore::libexecPath() + "/clang/bin")); pathAdditions.append(QDir::toNativeSeparators(Core::ICore::libexecPath() + "/clang/bin"));
const QString path = QLatin1String(Utils::HostOsInfo().isWindowsHost() ? "Path" : "PATH"); const QString path = QLatin1String(Utils::HostOsInfo().isWindowsHost() ? "Path" : "PATH");
changes.append({path, pathAdditions.join(Utils::HostOsInfo::pathListSeparator())}); changes.append({path, pathAdditions.join(Utils::HostOsInfo::pathListSeparator())});
@@ -591,10 +600,13 @@ static void setKitCMakeOptions(ProjectExplorer::Kit *k, const McuTarget* mcuTarg
if (mcuTarget->colorDepth() >= 0) if (mcuTarget->colorDepth() >= 0)
config.append(CMakeConfigItem("QUL_COLOR_DEPTH", config.append(CMakeConfigItem("QUL_COLOR_DEPTH",
QString::number(mcuTarget->colorDepth()).toLatin1())); QString::number(mcuTarget->colorDepth()).toLatin1()));
CMakeConfigurationKitAspect::setConfiguration(k, config); const Utils::FilePath jom = jomExecutablePath();
if (Utils::HostOsInfo::isWindowsHost()) if (jom.exists()) {
config.append(CMakeConfigItem("CMAKE_MAKE_PROGRAM", jom.toString().toLatin1()));
CMakeGeneratorKitAspect::setGenerator(k, "NMake Makefiles JOM"); CMakeGeneratorKitAspect::setGenerator(k, "NMake Makefiles JOM");
} }
CMakeConfigurationKitAspect::setConfiguration(k, config);
}
QString McuSupportOptions::kitName(const McuTarget *mcuTarget) const QString McuSupportOptions::kitName(const McuTarget *mcuTarget) const
{ {