diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2022-03-22 14:14:39 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2022-03-25 15:55:17 +0000 |
commit | ea199ebaa096913fd456f6ec1d433be904b85dbd (patch) | |
tree | 3a759d1caefc8c8a38a1ada1d3cc27a16f1b5eee /share/qbs | |
parent | e6d0980e47601dbb80f40672781a2940c566fb77 (diff) | |
download | qbs-ea199ebaa096913fd456f6ec1d433be904b85dbd.tar.gz |
Qt support: Fix static builds against Qt 6
Qt 6 prl files can contain object files these days, which we must de-
duplicate manually when gathering plugin libraries.
Task-number: QBS-1692
Change-Id: I479cf759b53bde0908f150de86405a810f5b2dea
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'share/qbs')
-rw-r--r-- | share/qbs/module-providers/Qt/templates/qml.js | 6 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/qml.qbs | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/share/qbs/module-providers/Qt/templates/qml.js b/share/qbs/module-providers/Qt/templates/qml.js index ea8293f2d..a159aa907 100644 --- a/share/qbs/module-providers/Qt/templates/qml.js +++ b/share/qbs/module-providers/Qt/templates/qml.js @@ -59,7 +59,7 @@ function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDi var prlFile = new TextFile(prlFilePath, TextFile.ReadOnly); try { var pluginLib; - var otherLibs = ""; + var otherLibs = []; var line; while (!prlFile.atEof()) { line = prlFile.readLine().trim(); @@ -74,12 +74,12 @@ function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDi otherLibsLine = otherLibsLine.replace(/-l([^ ]+)/g, "$1" + ".lib"); } otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_LIBS\]/g, qtLibDir); - otherLibs += otherLibsLine + '\n'; + otherLibs = otherLibs.concat(otherLibsLine.split(' ')); } } if (!pluginLib) throw "Malformed prl file '" + prlFilePath + "'."; - return pluginLib + ' ' + otherLibs; + return [pluginLib].concat(otherLibs); } finally { prlFile.close(); } diff --git a/share/qbs/module-providers/Qt/templates/qml.qbs b/share/qbs/module-providers/Qt/templates/qml.qbs index 23cb60426..88e973141 100644 --- a/share/qbs/module-providers/Qt/templates/qml.qbs +++ b/share/qbs/module-providers/Qt/templates/qml.qbs @@ -1,3 +1,4 @@ +import qbs.FileInfo import qbs.Host import qbs.TextFile import '../QtModule.qbs' as QtModule @@ -156,6 +157,7 @@ QtModule { if (cppFile) cppFile.writeLine("#include <QtPlugin>"); var plugins = { }; + var libsWithUniqueObjects = []; for (var p in scannerData) { var plugin = scannerData[p].plugin; if (!plugin || plugins[plugin]) @@ -173,8 +175,16 @@ QtModule { product.qbs.targetOS, product.qbs.toolchain, product.Qt.core.libPath); - listFile.write(libs + ' '); + for (var i = 0; i < libs.length; ++i) { + var lib = libs[i]; + if (!lib.endsWith(product.cpp.objectSuffix) + || (!libsWithUniqueObjects.contains(lib) + && !product.cpp.staticLibraries.contains(FileInfo.cleanPath(lib)))) { + libsWithUniqueObjects.push(lib); + } + } } + listFile.write(libsWithUniqueObjects.join("\n")); } finally { if (cppFile) cppFile.close(); |