diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2022-07-07 11:16:08 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2022-07-07 12:01:21 +0000 |
commit | 5d45d6e6a5b4fbb13b9ee3e5949dbfd1978c667a (patch) | |
tree | 94a4df37652ac756a592cf148bd99e6b452b5749 | |
parent | 764213fc53fe387dfc66f1b606516c6f9f9df567 (diff) | |
download | qbs-5d45d6e6a5b4fbb13b9ee3e5949dbfd1978c667a.tar.gz |
Qt support: Fix static builds
- prl files can refer to QT_INSTALL_PLUGINS
- object files can appear in QMAKE_PRL_LIBS
Change-Id: I2ab707ab3677a1e7be71c93f211677b5df04b23f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | share/qbs/module-providers/Qt/setup-qt.js | 1 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/qml.js | 4 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/qml.qbs | 1 | ||||
-rw-r--r-- | share/qbs/modules/cpp/cpp.js | 16 |
4 files changed, 17 insertions, 5 deletions
diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js index 72b21c395..040f9d951 100644 --- a/share/qbs/module-providers/Qt/setup-qt.js +++ b/share/qbs/module-providers/Qt/setup-qt.js @@ -763,6 +763,7 @@ function doSetupLibraries(modInfo, qtProps, debugBuild, nonExistingPrlFiles, and for (i = 0; i < parts.length; ++i) { var part = parts[i]; part = part.replace("$$[QT_INSTALL_LIBS]", qtProps.libraryPath); + part = part.replace("$$[QT_INSTALL_PLUGINS]", qtProps.pluginPath); part = part.replace("$$[QT_INSTALL_PREFIX]", qtProps.installPrefixPath); if (part.startsWith("-l")) { libs.push(part.slice(2)); diff --git a/share/qbs/module-providers/Qt/templates/qml.js b/share/qbs/module-providers/Qt/templates/qml.js index 36f60f8a3..2a2ff85ab 100644 --- a/share/qbs/module-providers/Qt/templates/qml.js +++ b/share/qbs/module-providers/Qt/templates/qml.js @@ -39,7 +39,8 @@ function getPrlRhs(line) return line.split('=')[1].trim(); } -function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDir, qtDir) +function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDir, qtPluginDir, + qtDir) { if (!pluginData.path) return ""; @@ -74,6 +75,7 @@ function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDi otherLibsLine = otherLibsLine.replace(/-l([^ ]+)/g, "$1" + ".lib"); } otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_LIBS\]/g, qtLibDir); + otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PLUGINS\]/g, qtPluginDir); otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PREFIX\]/g, qtDir); 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 747558f10..f15705cc5 100644 --- a/share/qbs/module-providers/Qt/templates/qml.qbs +++ b/share/qbs/module-providers/Qt/templates/qml.qbs @@ -175,6 +175,7 @@ QtModule { product.qbs.targetOS, product.qbs.toolchain, product.Qt.core.libPath, + product.Qt.core.pluginPath, product.Qt.core.installPrefixPath); for (var i = 0; i < libs.length; ++i) { var lib = libs[i]; diff --git a/share/qbs/modules/cpp/cpp.js b/share/qbs/modules/cpp/cpp.js index 846a4cfad..b93d42f21 100644 --- a/share/qbs/modules/cpp/cpp.js +++ b/share/qbs/modules/cpp/cpp.js @@ -220,6 +220,7 @@ function precompiledHeaderOutputArtifacts(input, product, lang, generateObjects) function collectLibraryDependencies(product) { var seen = {}; + var seenObjectFiles = []; var result = []; function addFilePath(filePath, wholeArchive, productName) { @@ -248,16 +249,23 @@ function collectLibraryDependencies(product) { function sanitizedModuleListProperty(obj, moduleName, propertyName) { return ensureArray(ModUtils.sanitizedModuleProperty(obj, moduleName, propertyName)); } - function handleExternalLibraries(tag, suffix) { + function handleExternalLibraries(tag, libSuffix, objSuffix) { var externalLibs = sanitizedModuleListProperty(obj, "cpp", tag) || []; externalLibs.forEach(function(libName) { - if (!libName.endsWith(suffix) && !libName.startsWith('@')) - libName += suffix; + var isObjectFile = objSuffix && libName.endsWith(objSuffix); + if (isObjectFile) { + if (seenObjectFiles.contains(libName)) + return; + seenObjectFiles.push(libName); + } + if (!libName.endsWith(libSuffix) && !isObjectFile && !libName.startsWith('@')) + libName += libSuffix; addFilePath(libName, false); }); } handleExternalLibraries("staticLibraries", - obj.moduleProperty("cpp", "staticLibrarySuffix")); + obj.moduleProperty("cpp", "staticLibrarySuffix"), + obj.moduleProperty("cpp", "objectSuffix")); handleExternalLibraries("dynamicLibraries", obj.moduleProperty("cpp", "dynamicLibraryImportSuffix")); } |