From 4b272a729e45a7330124604b7025ab0a49b58bbf Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Tue, 2 May 2023 07:01:23 +0300 Subject: Qt: Fix compiled-qml on iOS and Qt6 Task-number: QBS-1732 Change-Id: Id5e6a3aa65ea276093d25d8b939dd59bbe090eda Reviewed-by: Christian Kandeler --- share/qbs/module-providers/Qt/templates/qml.js | 24 ++++++++++++++++++++---- share/qbs/module-providers/Qt/templates/qml.qbs | 8 +------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/share/qbs/module-providers/Qt/templates/qml.js b/share/qbs/module-providers/Qt/templates/qml.js index 2a2ff85ab..ad76a0d0f 100644 --- a/share/qbs/module-providers/Qt/templates/qml.js +++ b/share/qbs/module-providers/Qt/templates/qml.js @@ -39,17 +39,32 @@ function getPrlRhs(line) return line.split('=')[1].trim(); } -function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDir, qtPluginDir, - qtDir) +function getLibsForPlugin(pluginData, product) { + var targetOS = product.qbs.targetOS; + var toolchain = product.qbs.toolchain; + var buildVariant = product.Qt.core.qtBuildVariant; + var qtLibDir = product.Qt.core.libPath; + var qtPluginDir = product.Qt.core.pluginPath; + var qtDir = product.Qt.core.installPrefixPath; + var qtQmlPath = product.Qt.qml.qmlPath; + if (!pluginData.path) return ""; var prlFileName = ""; if (!targetOS.contains("windows")) prlFileName += "lib"; prlFileName += pluginData.plugin; - if (buildVariant === "debug" && targetOS.contains("windows")) - prlFileName += "d"; + if (buildVariant === "debug") { + if (targetOS.contains("windows")) { + prlFileName += "d"; + } else if (product.Qt.core.versionMajor >= 6 && + (targetOS.contains("ios") + || targetOS.contains("tvos") + || targetOS.contains("watchos"))) { + prlFileName += "_debug"; + } + } prlFileName += ".prl"; var prlFilePath = FileInfo.joinPaths(pluginData.path, prlFileName); if (!File.exists(prlFilePath)) { @@ -77,6 +92,7 @@ function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDi otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_LIBS\]/g, qtLibDir); otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PLUGINS\]/g, qtPluginDir); otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PREFIX\]/g, qtDir); + otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_QML\]/g, qtQmlPath); otherLibs = otherLibs.concat(otherLibsLine.split(' ')); } } diff --git a/share/qbs/module-providers/Qt/templates/qml.qbs b/share/qbs/module-providers/Qt/templates/qml.qbs index f15705cc5..de1318695 100644 --- a/share/qbs/module-providers/Qt/templates/qml.qbs +++ b/share/qbs/module-providers/Qt/templates/qml.qbs @@ -170,13 +170,7 @@ QtModule { } if (cppFile) cppFile.writeLine("Q_IMPORT_PLUGIN(" + className + ")"); - var libs = Qml.getLibsForPlugin(scannerData[p], - product.Qt.core.qtBuildVariant, - product.qbs.targetOS, - product.qbs.toolchain, - product.Qt.core.libPath, - product.Qt.core.pluginPath, - product.Qt.core.installPrefixPath); + var libs = Qml.getLibsForPlugin(scannerData[p], product); for (var i = 0; i < libs.length; ++i) { var lib = libs[i]; if (!lib.endsWith(product.cpp.objectSuffix) -- cgit v1.2.1