diff options
author | Kwangsub Kim <kwangsub.kim@qt.io> | 2022-10-20 16:55:41 +0200 |
---|---|---|
committer | Kwangsub Kim <kwangsub.kim@qt.io> | 2022-11-08 10:24:18 +0000 |
commit | d881932695756a735d5dd151da3ff03e0bb00d54 (patch) | |
tree | 7c1ead3f5697ac37ce106a7124b64eaf6fae4388 | |
parent | c392cb8acf89aeca5cba9813e4926829be8b981d (diff) |
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>
-rw-r--r-- | src/plugins/mcusupport/mcukitmanager.cpp | 28 | ||||
-rw-r--r-- | src/plugins/mcusupport/mcutarget.cpp | 20 | ||||
-rw-r--r-- | src/plugins/mcusupport/mcutarget.h | 1 |
3 files changed, 43 insertions, 6 deletions
diff --git a/src/plugins/mcusupport/mcukitmanager.cpp b/src/plugins/mcusupport/mcukitmanager.cpp index 19917de3bb..ae5c5f4b15 100644 --- a/src/plugins/mcusupport/mcukitmanager.cpp +++ b/src/plugins/mcusupport/mcukitmanager.cpp @@ -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(); diff --git a/src/plugins/mcusupport/mcutarget.cpp b/src/plugins/mcusupport/mcutarget.cpp index 4314bdb72a..2ca6e2596a 100644 --- a/src/plugins/mcusupport/mcutarget.cpp +++ b/src/plugins/mcusupport/mcutarget.cpp @@ -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()) { diff --git a/src/plugins/mcusupport/mcutarget.h b/src/plugins/mcusupport/mcutarget.h index d42cf015d7..6dd1cd5fe3 100644 --- a/src/plugins/mcusupport/mcutarget.h +++ b/src/plugins/mcusupport/mcutarget.h @@ -53,6 +53,7 @@ public: OS os() const; int colorDepth() const; bool isValid() const; + QString desktopCompilerId() const; void printPackageProblems() const; private: |