forked from qt-creator/qt-creator
McuSupport: Update library path for Windows platform
The Qt shared library for Windows desktop platform has been moved from Qul 2.3.0 to support MinGW toolchain. The updated library path needs to be configured correctly. Task-number: QTCREATORBUG-28303 Change-Id: I7cf8150bfb4a66731904ea49089849496305f22e Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -196,12 +196,22 @@ public:
|
||||
EnvironmentItems changes;
|
||||
QStringList pathAdditions; // clazy:exclude=inefficient-qlist-soft
|
||||
|
||||
// The Desktop version depends on the Qt shared libs in Qul_DIR/bin.
|
||||
// If CMake's fileApi is avaialble, we can rely on the "Add library search path to PATH"
|
||||
// feature of the run configuration. Otherwise, we just prepend the path, here.
|
||||
if (mcuTarget->toolChainPackage()->isDesktopToolchain()
|
||||
&& !CMakeProjectManager::CMakeToolManager::defaultCMakeTool()->hasFileApi())
|
||||
pathAdditions.append((qtForMCUsSdkPackage->path() / "bin").toUserOutput());
|
||||
// The Desktop version depends on the Qt shared libs.
|
||||
// As CMake's fileApi is available, we can rely on the "Add library search path to PATH"
|
||||
// feature of the run configuration.
|
||||
//
|
||||
// Since MinGW support is added from Qul 2.3.0,
|
||||
// the Qt shared libs for Windows desktop platform have been moved
|
||||
// from Qul_DIR/bin to Qul_DIR/lib/(msvc|gnu)
|
||||
// and the QPA plugin has been moved to the same location.
|
||||
// So Windows host requires to add the path in this case.
|
||||
if (mcuTarget->toolChainPackage()->isDesktopToolchain() && HostOsInfo::isWindowsHost()
|
||||
&& !McuSupportOptions::isLegacyVersion(mcuTarget->qulVersion())) {
|
||||
const FilePath libPath = (qtForMCUsSdkPackage->path() / "lib"
|
||||
/ mcuTarget->desktopCompilerId());
|
||||
pathAdditions.append(libPath.toUserOutput());
|
||||
changes.append({"QT_QPA_PLATFORM_PLUGIN_PATH", libPath.toUserOutput()});
|
||||
}
|
||||
|
||||
auto processPackage = [&pathAdditions](const McuPackagePtr &package) {
|
||||
if (package->isAddToSystemPath())
|
||||
@@ -261,6 +271,12 @@ public:
|
||||
true);
|
||||
}
|
||||
|
||||
if (!McuSupportOptions::isLegacyVersion(mcuTarget->qulVersion())
|
||||
&& HostOsInfo::isWindowsHost()) {
|
||||
// From 2.3.0, QUL_COMPILER_NAME needs to be set on Windows
|
||||
// to select proper cmake files depending on the toolchain for Windows.
|
||||
configMap.insert("QUL_COMPILER_NAME", mcuTarget->desktopCompilerId().toLatin1());
|
||||
}
|
||||
} else {
|
||||
const FilePath cMakeToolchainFile = mcuTarget->toolChainFilePackage()->path();
|
||||
|
||||
|
||||
@@ -61,6 +61,26 @@ bool McuTarget::isValid() const
|
||||
});
|
||||
}
|
||||
|
||||
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()) {
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
OS os() const;
|
||||
int colorDepth() const;
|
||||
bool isValid() const;
|
||||
QString desktopCompilerId() const;
|
||||
void printPackageProblems() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user