diff options
Diffstat (limited to 'share/qbs/module-providers/Qt/templates')
14 files changed, 116 insertions, 210 deletions
diff --git a/share/qbs/module-providers/Qt/templates/QtModule.qbs b/share/qbs/module-providers/Qt/templates/QtModule.qbs deleted file mode 100644 index aa7c1d15a..000000000 --- a/share/qbs/module-providers/Qt/templates/QtModule.qbs +++ /dev/null @@ -1,86 +0,0 @@ -import qbs.FileInfo - -Module { - condition: (qbs.targetPlatform === targetPlatform || isCombinedUIKitBuild) - && (!qbs.architecture - || architectures.length === 0 - || architectures.contains(qbs.architecture)) - - readonly property bool isCombinedUIKitBuild: ["ios", "tvos", "watchos"].contains(targetPlatform) - && ["x86", "x86_64"].contains(qbs.architecture) - && qbs.targetPlatform === targetPlatform + "-simulator" - - Depends { name: "cpp" } - Depends { name: "Qt.core" } - - Depends { name: "Qt.plugin_support" } - property stringList pluginTypes - Qt.plugin_support.pluginTypes: pluginTypes - Depends { - condition: Qt.core.staticBuild && !isPlugin - name: "Qt"; - submodules: { - // We have to pull in all plugins here, because dependency resolving happens - // before module merging, and we don't know yet if someone set - // Qt.pluginSupport.pluginsByType in the product. - // The real filtering is done later by the plugin module files themselves. - var list = []; - var allPlugins = Qt.plugin_support.allPluginsByType; - for (var i = 0; i < (pluginTypes || []).length; ++i) - Array.prototype.push.apply(list, allPlugins[pluginTypes[i]]) - return list; - } - } - - property string qtModuleName - property path binPath: Qt.core.binPath - property path incPath: Qt.core.incPath - property path libPath: Qt.core.libPath - property string qtLibInfix: Qt.core.libInfix - property string libNameForLinkerDebug - property string libNameForLinkerRelease - property string libNameForLinker: Qt.core.qtBuildVariant === "debug" - ? libNameForLinkerDebug : libNameForLinkerRelease - property string libFilePathDebug - property string libFilePathRelease - property string libFilePath: Qt.core.qtBuildVariant === "debug" - ? libFilePathDebug : libFilePathRelease - version: Qt.core.version - property bool hasLibrary: true - property bool isStaticLibrary: false - property bool isPlugin: false - - property stringList architectures - property string targetPlatform - property stringList staticLibsDebug - property stringList staticLibsRelease - property stringList dynamicLibsDebug - property stringList dynamicLibsRelease - property stringList linkerFlagsDebug - property stringList linkerFlagsRelease - property stringList staticLibs: Qt.core.qtBuildVariant === "debug" - ? staticLibsDebug : staticLibsRelease - property stringList dynamicLibs: Qt.core.qtBuildVariant === "debug" - ? dynamicLibsDebug : dynamicLibsRelease - property stringList frameworksDebug - property stringList frameworksRelease - property stringList frameworkPathsDebug - property stringList frameworkPathsRelease - property stringList mFrameworks: Qt.core.qtBuildVariant === "debug" - ? frameworksDebug : frameworksRelease - property stringList mFrameworkPaths: Qt.core.qtBuildVariant === "debug" - ? frameworkPathsDebug: frameworkPathsRelease - cpp.linkerFlags: Qt.core.qtBuildVariant === "debug" - ? linkerFlagsDebug : linkerFlagsRelease - property bool enableLinking: qtModuleName != undefined && hasLibrary - property stringList moduleConfig - - Properties { - condition: enableLinking - cpp.staticLibraries: staticLibs - cpp.dynamicLibraries: dynamicLibs - cpp.frameworks: mFrameworks.concat(!isStaticLibrary && Qt.core.frameworkBuild - ? [libNameForLinker] : []) - cpp.frameworkPaths: mFrameworkPaths - } -} diff --git a/share/qbs/module-providers/Qt/templates/QtPlugin.qbs b/share/qbs/module-providers/Qt/templates/QtPlugin.qbs deleted file mode 100644 index 88bfa5a65..000000000 --- a/share/qbs/module-providers/Qt/templates/QtPlugin.qbs +++ /dev/null @@ -1,51 +0,0 @@ -import qbs.FileInfo -import qbs.TextFile - -QtModule { - isPlugin: true - - property string className - property stringList extendsModules - - enableLinking: { - if (!base) - return false; - if (!isStaticLibrary) - return false; - if (!Qt.plugin_support.linkPlugins) - return false; - if (!(Qt.plugin_support.enabledPlugins || []).contains(qtModuleName)) - return false; - if (!extendsModules || extendsModules.length === 0) - return true; - for (var i = 0; i < extendsModules.length; ++i) { - var moduleName = extendsModules[i]; - if (product.Qt[moduleName] && product.Qt[moduleName].present) - return true; - } - return false; - } - - Rule { - condition: enableLinking - multiplex: true - Artifact { - filePath: product.targetName + "_qt_plugin_import_" - + product.moduleProperty(product.moduleName, "qtModuleName") + ".cpp" - fileTags: "cpp" - } - - prepare: { - var cmd = new JavaScriptCommand(); - var pluginName = product.moduleProperty(product.moduleName, "qtModuleName"); - cmd.description = "Creating static import for plugin '" + pluginName + "'."; - cmd.sourceCode = function() { - var f = new TextFile(output.filePath, TextFile.WriteOnly); - var className = product.moduleProperty(product.moduleName, "className"); - f.writeLine("#include <QtPlugin>\n\nQ_IMPORT_PLUGIN(" + className + ")"); - f.close(); - }; - return cmd; - } - } -} diff --git a/share/qbs/module-providers/Qt/templates/android_support.qbs b/share/qbs/module-providers/Qt/templates/android_support.qbs index ea19bba4a..6d548f194 100644 --- a/share/qbs/module-providers/Qt/templates/android_support.qbs +++ b/share/qbs/module-providers/Qt/templates/android_support.qbs @@ -10,6 +10,7 @@ Module { version: @version@ property string qmlRootDir: product.sourceDirectory property stringList extraPrefixDirs + property stringList qmlImportPaths property stringList deploymentDependencies // qmake: ANDROID_DEPLOYMENT_DEPENDENCIES property stringList extraPlugins // qmake: ANDROID_EXTRA_PLUGINS property stringList extraLibs // qmake: ANDROID_EXTRA_LIBS @@ -19,17 +20,9 @@ Module { property string rccFilePath property string _qtBinaryDir property string _qtInstallDir - // TODO: Remove in 1.21 - // From 1.21 product property used from an export item will point to the - // importingProduct property. So using the importingProduct property will be useless - // and the change will be reverted - property var _importingProduct: (typeof importingProduct !== "undefined") ? importingProduct : - product - property bool _enableSdkSupport: _importingProduct.type - && _importingProduct.type.contains("android.package") - && !consoleApplication - property bool _enableNdkSupport: !_importingProduct.aggregate - || _importingProduct.multiplexConfigurationId + property bool _enableSdkSupport: product.type && product.type.contains("android.package") + && !product.consoleApplication + property bool _enableNdkSupport: !product.aggregate || product.multiplexConfigurationId property string _templatesBaseDir: FileInfo.joinPaths(_qtInstallDir, "src", "android") property string _deployQtOutDir: FileInfo.joinPaths(product.buildDirectory, "deployqt_out") @@ -110,6 +103,7 @@ Module { var nativeLibs = inputs["android.nativelibrary"]; var architectures = []; var triples = []; + var qtInstallDirectories = []; var hostArch; var targetArchitecture; if (nativeLibs.length === 1) { @@ -119,6 +113,7 @@ Module { if (product.Qt.android_support._multiAbi) { architectures.push(theBinary.Android.ndk.abi); triples.push(theBinary.cpp.toolchainTriple); + qtInstallDirectories.push(theBinary.Qt.android_support._qtInstallDir); } } else { for (i = 0; i < nativeLibs.length; ++i) { @@ -127,6 +122,8 @@ Module { if (candidate.product.name === product.name) { architectures.push(candidate.Android.ndk.abi); triples.push(candidate.cpp.toolchainTriple); + qtInstallDirectories.push( + candidate.Qt.android_support._qtInstallDir); hostArch = candidate.Android.ndk.hostArch; targetArchitecture = candidate.Android.ndk.abi; theBinary = candidate; @@ -162,7 +159,20 @@ Module { f.writeLine("{"); f.writeLine('"description": "This file was generated by qbs to be read by ' + 'androiddeployqt and should not be modified by hand.",'); - f.writeLine('"qt": "' + product.Qt.android_support._qtInstallDir + '",'); + if (Utilities.versionCompare(product.Qt.core.version, "6.3.0") >= 0) { + var line = '"qt": {'; + for (var i = 0; i < qtInstallDirectories.length && i < architectures.length; + ++i) { + line = line + '"' + architectures[i] + '":"' + + qtInstallDirectories[i] + '"'; + if (i < qtInstallDirectories.length-1 || i < architectures.length-1) + line = line + ','; + } + line = line + "},"; + f.writeLine(line); + } else { + f.writeLine('"qt": "' + product.Qt.android_support._qtInstallDir + '",'); + } f.writeLine('"sdk": "' + product.Android.sdk.sdkDir + '",'); f.writeLine('"sdkBuildToolsRevision": "' + product.Android.sdk.buildToolsVersion + '",'); @@ -203,13 +213,18 @@ Module { var prefixDirs = product.Qt.android_support.extraPrefixDirs; if (prefixDirs && prefixDirs.length > 0) f.writeLine('"extraPrefixDirs": ' + JSON.stringify(prefixDirs) + ','); - if ((product.qmlImportPaths instanceof Array) && product.qmlImportPaths.length > 0) + var qmlImportPaths = product.Qt.android_support.qmlImportPaths; + if (qmlImportPaths && qmlImportPaths.length > 0) + f.writeLine('"qml-import-paths": "' + qmlImportPaths.join(',') + '",'); + else if ((product.qmlImportPaths instanceof Array) && product.qmlImportPaths.length > 0) f.writeLine('"qml-import-paths": "' + product.qmlImportPaths.join(',') + '",'); if (Utilities.versionCompare(product.Qt.android_support.version, "6.0") >= 0) { - f.writeLine('"qml-importscanner-binary": "' + - product.Qt.core.qmlImportScannerFilePath + '",'); - f.writeLine('"rcc-binary": "' + product.Qt.android_support.rccFilePath + '",'); + f.writeLine('"qml-importscanner-binary": "' + + product.Qt.core.qmlImportScannerFilePath + FileInfo.executableSuffix() + + '",'); + f.writeLine('"rcc-binary": "' + product.Qt.android_support.rccFilePath + + FileInfo.executableSuffix() + '",'); if (inputs["qrc"] && inputs["qrc"].length > 0) { var qrcFiles = []; diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs index c3b26eb50..485402716 100644 --- a/share/qbs/module-providers/Qt/templates/core.qbs +++ b/share/qbs/module-providers/Qt/templates/core.qbs @@ -18,6 +18,7 @@ Module { && qbs.targetPlatform === targetPlatform + "-simulator" Depends { name: "cpp" } + Depends { name: "Sanitizers.address"; condition: config.contains("sanitize_address") } Depends { name: "Qt.android_support"; condition: qbs.targetOS.contains("android") } Properties { @@ -43,6 +44,7 @@ Module { property path installPath: @installPath@ property path incPath: @incPath@ property path libPath: @libPath@ + property path installPrefixPath: @installPrefixPath@ property path libExecPath: @libExecPath@ property path qmlLibExecPath: @qmlLibExecPath@ property path pluginPath: @pluginPath@ @@ -55,6 +57,7 @@ Module { property string qdocName: versionMajor >= 5 ? "qdoc" : "qdoc3" property stringList qdocEnvironment property path docPath: @docPath@ + property string helpGeneratorLibExecPath: @helpGeneratorLibExecPath@ property stringList helpGeneratorArgs: versionMajor >= 5 ? ["-platform", "minimal"] : [] property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : [] property int versionMajor: versionParts[0] @@ -73,6 +76,8 @@ Module { property string qtBuildVariant: { if (availableBuildVariants.contains(qbs.buildVariant)) return qbs.buildVariant; + if (qbs.buildVariant === "profiling" && availableBuildVariants.contains("release")) + return "release"; return availableBuildVariants.length > 0 ? availableBuildVariants[0] : ""; } @@ -104,6 +109,7 @@ Module { property string libFilePathRelease: @libFilePathRelease@ property string libFilePath: qtBuildVariant === "debug" ? libFilePathDebug : libFilePathRelease + property bool useRPaths: qbs.targetOS.contains("linux") && !qbs.targetOS.contains("android") property stringList coreLibPaths: @libraryPaths@ property bool hasLibrary: true @@ -117,6 +123,7 @@ Module { property bool lreleaseMultiplexMode: false property stringList moduleConfig: @moduleConfig@ + Properties { condition: moduleConfig.contains("use_gold_linker") cpp.linkerVariant: "gold" @@ -145,13 +152,13 @@ Module { if (Utilities.versionCompare(version, "5.6.0") < 0) defines.push("main=qtmn"); } + if (qbs.toolchain.contains("msvc")) + defines.push("_ENABLE_EXTENDED_ALIGNED_STORAGE"); return defines; } cpp.driverFlags: { var flags = []; if (qbs.toolchain.contains("gcc")) { - if (config.contains("sanitize_address")) - flags.push("-fsanitize=address"); if (config.contains("sanitize_undefined")) flags.push("-fsanitize=undefined"); if (config.contains("sanitize_thread")) @@ -161,11 +168,8 @@ Module { } return flags; } - cpp.includePaths: { - var paths = @includes@; - paths.push(mkspecPath, generatedHeadersDir); - return paths; - } + cpp.includePaths: generatedHeadersDir + cpp.systemIncludePaths: @includes@.concat(mkspecPath) cpp.libraryPaths: { var libPaths = [libPath]; if (staticBuild && pluginPath) @@ -184,7 +188,7 @@ Module { } cpp.dynamicLibraries: dynamicLibs cpp.linkerFlags: coreLinkerFlags - cpp.frameworkPaths: coreFrameworkPaths.concat(frameworkBuild ? [libPath] : []) + cpp.systemFrameworkPaths: coreFrameworkPaths.concat(frameworkBuild ? [libPath] : []) cpp.frameworks: { var frameworks = coreFrameworks if (frameworkBuild) @@ -195,19 +199,21 @@ Module { return undefined; return frameworks; } - cpp.rpaths: qbs.targetOS.contains('linux') && !qbs.targetOS.contains("android") ? [libPath] : - undefined + cpp.rpaths: useRPaths ? libPath : undefined cpp.runtimeLibrary: qbs.toolchain.contains("msvc") ? config.contains("static_runtime") ? "static" : "dynamic" : original - cpp.positionIndependentCode: versionMajor >= 5 ? true : undefined + cpp.positionIndependentCode: versionMajor >= 5 ? true : original cpp.cxxFlags: { var flags = []; if (qbs.toolchain.contains('msvc')) { if (versionMajor < 5) flags.push('/Zc:wchar_t-'); + if (Utilities.versionCompare(version, "6.3") >= 0 + && Utilities.versionCompare(cpp.compilerVersion, "19.10") >= 0) { + flags.push("/permissive-"); + } } - return flags; } cpp.cxxStandardLibrary: { @@ -216,12 +222,12 @@ Module { return "libc++"; return original; } - cpp.minimumWindowsVersion: @minWinVersion@ - cpp.minimumMacosVersion: @minMacVersion@ - cpp.minimumIosVersion: @minIosVersion@ - cpp.minimumTvosVersion: @minTvosVersion@ - cpp.minimumWatchosVersion: @minWatchosVersion@ - cpp.minimumAndroidVersion: @minAndroidVersion@ + cpp.minimumWindowsVersion: @minWinVersion_optional@ + cpp.minimumMacosVersion: @minMacVersion_optional@ + cpp.minimumIosVersion: @minIosVersion_optional@ + cpp.minimumTvosVersion: @minTvosVersion_optional@ + cpp.minimumWatchosVersion: @minWatchosVersion_optional@ + cpp.minimumAndroidVersion: @minAndroidVersion_optional@ // Universal Windows Platform support cpp.windowsApiFamily: mkspecName.startsWith("winrt-") ? "pc" : undefined @@ -502,7 +508,7 @@ Module { var args = ['-silent', '-qm', output.filePath].concat(inputFilePaths); var cmd = new Command(product.Qt.core.binPath + '/' + product.Qt.core.lreleaseName, args); - cmd.description = 'Creating ' + output.fileName; + cmd.description = 'creating ' + output.fileName; cmd.highlight = 'filegen'; return cmd; } @@ -542,7 +548,8 @@ Module { args = args.concat(product.Qt.core.helpGeneratorArgs); args.push("-o"); args.push(output.filePath); - var cmd = new Command(product.Qt.core.binPath + "/qhelpgenerator", args); + var cmd = new Command( + product.Qt.core.helpGeneratorLibExecPath + "/qhelpgenerator", args); cmd.description = 'qhelpgenerator ' + input.fileName; cmd.highlight = 'filegen'; cmd.stdoutFilterFunction = function(output) { diff --git a/share/qbs/module-providers/Qt/templates/dbus.qbs b/share/qbs/module-providers/Qt/templates/dbus.qbs index 90bbe2864..bbda5a4f2 100644 --- a/share/qbs/module-providers/Qt/templates/dbus.qbs +++ b/share/qbs/module-providers/Qt/templates/dbus.qbs @@ -1,6 +1,5 @@ import qbs.FileInfo import qbs.ModUtils -import "../QtModule.qbs" as QtModule import "dbus.js" as DBus QtModule { @@ -62,7 +61,7 @@ QtModule { moduleConfig: @moduleConfig@ cpp.defines: @defines@ - cpp.includePaths: @includes@ + cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ diff --git a/share/qbs/module-providers/Qt/templates/gui.qbs b/share/qbs/module-providers/Qt/templates/gui.qbs index 1d45c6f1e..db491eafe 100644 --- a/share/qbs/module-providers/Qt/templates/gui.qbs +++ b/share/qbs/module-providers/Qt/templates/gui.qbs @@ -1,7 +1,6 @@ import qbs.FileInfo import qbs.ModUtils import qbs.Utilities -import '../QtModule.qbs' as QtModule QtModule { qtModuleName: "Gui" @@ -28,7 +27,7 @@ QtModule { : product.Qt.core.libExecPath + '/' + product.Qt.gui.uicName; var cmd = new Command(uicPath, [input.filePath, '-o', output.filePath]); - cmd.description = 'uic ' + input.fileName; + cmd.description = 'generating ' + output.fileName; cmd.highlight = 'codegen'; return cmd; } @@ -59,7 +58,7 @@ QtModule { : undefined cpp.defines: @defines@ - cpp.includePaths: @includes@ + cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ Properties { diff --git a/share/qbs/module-providers/Qt/templates/module.qbs b/share/qbs/module-providers/Qt/templates/module.qbs index b09f79a87..9f0313ab5 100644 --- a/share/qbs/module-providers/Qt/templates/module.qbs +++ b/share/qbs/module-providers/Qt/templates/module.qbs @@ -1,5 +1,3 @@ -import '../QtModule.qbs' as QtModule - QtModule { qtModuleName: @name@ Depends { name: "Qt"; submodules: @dependencies@} @@ -24,7 +22,7 @@ QtModule { pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ - cpp.includePaths: @includes@ + cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ } diff --git a/share/qbs/module-providers/Qt/templates/plugin.qbs b/share/qbs/module-providers/Qt/templates/plugin.qbs index e73e2a4d9..34d4f4153 100644 --- a/share/qbs/module-providers/Qt/templates/plugin.qbs +++ b/share/qbs/module-providers/Qt/templates/plugin.qbs @@ -1,5 +1,3 @@ -import '../QtPlugin.qbs' as QtPlugin - QtPlugin { qtModuleName: @name@ Depends { name: "Qt"; submodules: @dependencies@} diff --git a/share/qbs/module-providers/Qt/templates/qml.js b/share/qbs/module-providers/Qt/templates/qml.js index ea8293f2d..38462dcf7 100644 --- a/share/qbs/module-providers/Qt/templates/qml.js +++ b/share/qbs/module-providers/Qt/templates/qml.js @@ -39,16 +39,32 @@ function getPrlRhs(line) return line.split('=')[1].trim(); } -function getLibsForPlugin(pluginData, buildVariant, targetOS, toolchain, qtLibDir) +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)) { @@ -59,7 +75,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 +90,15 @@ 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'; + 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(' ').map(FileInfo.cleanPath)); } } 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 9b4dfa36c..0a938e58d 100644 --- a/share/qbs/module-providers/Qt/templates/qml.qbs +++ b/share/qbs/module-providers/Qt/templates/qml.qbs @@ -1,5 +1,6 @@ +import qbs.FileInfo +import qbs.Host import qbs.TextFile -import '../QtModule.qbs' as QtModule import "qml.js" as Qml QtModule { @@ -46,7 +47,7 @@ QtModule { pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ - cpp.includePaths: @includes@ + cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ @@ -135,7 +136,7 @@ QtModule { prepare: { var cmd = new JavaScriptCommand(); if (inputs["qt.qml.qml"]) - cmd.description = "Creating " + outputs["cpp"][0].fileName; + cmd.description = "creating " + outputs["cpp"][0].fileName; else cmd.silent = true; cmd.sourceCode = function() { @@ -144,7 +145,7 @@ QtModule { qmlInputs = []; var scannerData = Qml.scannerData(product.Qt.qml.qmlImportScannerFilePath, qmlInputs.map(function(inp) { return inp.filePath; }), - product.Qt.qml.qmlPath, product.qbs.hostOS); + product.Qt.qml.qmlPath, Host.os()); var cppFile; var listFile; try { @@ -155,6 +156,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]) @@ -167,13 +169,17 @@ 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); - listFile.write(libs + ' '); + 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) + || (!libsWithUniqueObjects.contains(lib) + && !product.cpp.staticLibraries.contains(FileInfo.cleanPath(lib)))) { + libsWithUniqueObjects.push(lib); + } + } } + listFile.write(libsWithUniqueObjects.join("\n")); } finally { if (cppFile) cppFile.close(); diff --git a/share/qbs/module-providers/Qt/templates/qmlcache.qbs b/share/qbs/module-providers/Qt/templates/qmlcache.qbs index 38338d106..7047884c0 100644 --- a/share/qbs/module-providers/Qt/templates/qmlcache.qbs +++ b/share/qbs/module-providers/Qt/templates/qmlcache.qbs @@ -10,7 +10,7 @@ Module { throw "qmlcachegen unsupported for this target"; } property string qmlCacheGenPath: FileInfo.joinPaths(Qt.core.qmlLibExecPath, "qmlcachegen") - + (qbs.hostOS.contains("windows") ? ".exe" : "") + + FileInfo.executableSuffix() property bool supportsAllArchitectures: Utilities.versionCompare(Qt.core.version, "5.11") >= 0 property string installDir diff --git a/share/qbs/module-providers/Qt/templates/quick.js b/share/qbs/module-providers/Qt/templates/quick.js index ec1402345..d7e58984f 100644 --- a/share/qbs/module-providers/Qt/templates/quick.js +++ b/share/qbs/module-providers/Qt/templates/quick.js @@ -37,7 +37,7 @@ function scanQrc(product, qrcFilePath) { var result = []; var process = new Process(); try { - var rcc = FileInfo.joinPaths(Rcc.fullPath(product) + product.cpp.executableSuffix); + var rcc = FileInfo.joinPaths(Rcc.fullPath(product) + FileInfo.executableSuffix()); var exitCode = process.exec(rcc, ["--list", qrcFilePath], true); for (;;) { var line = process.readLine(); @@ -70,7 +70,7 @@ function contentFromQrc(product, qrcFilePath) { var supportsFiltering = product.Qt.quick._supportsQmlJsFiltering; var filesInQrc = scanQrc(product, qrcFilePath); var qmlJsFiles = filesInQrc.filter(function (filePath) { - return (/\.(js|qml)$/).test(filePath); + return (/\.(mjs|js|qml)$/).test(filePath); } ); var content = {}; if (!supportsFiltering || filesInQrc.length - qmlJsFiles.length > 0) { diff --git a/share/qbs/module-providers/Qt/templates/quick.qbs b/share/qbs/module-providers/Qt/templates/quick.qbs index 00174150e..5fc4aa349 100644 --- a/share/qbs/module-providers/Qt/templates/quick.qbs +++ b/share/qbs/module-providers/Qt/templates/quick.qbs @@ -33,7 +33,6 @@ import qbs.FileInfo import qbs.Process import qbs.TextFile import qbs.Utilities -import '../QtModule.qbs' as QtModule import 'quick.js' as QC QtModule { @@ -60,7 +59,7 @@ QtModule { pluginTypes: @pluginTypes@ moduleConfig: @moduleConfig@ cpp.defines: @defines@ - cpp.includePaths: @includes@ + cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ @@ -71,9 +70,12 @@ QtModule { readonly property string _generatedLoaderFileName: _compilerIsQmlCacheGen ? "qmlcache_loader.cpp" : "qtquickcompiler_loader.cpp" + property string _compilerBaseDir: _compilerIsQmlCacheGen ? Qt.core.qmlLibExecPath + : Qt.core.binPath property string compilerBaseName: (_compilerIsQmlCacheGen ? "qmlcachegen" : "qtquickcompiler") - property string compilerFilePath: FileInfo.joinPaths(Qt.core.binPath, - compilerBaseName + product.cpp.executableSuffix) + property string compilerFilePath: FileInfo.joinPaths(_compilerBaseDir, + compilerBaseName + FileInfo.executableSuffix()) + property bool compilerAvailable: File.exists(compilerFilePath); property bool useCompiler: compilerAvailable && !_compilerIsQmlCacheGen diff --git a/share/qbs/module-providers/Qt/templates/scxml.qbs b/share/qbs/module-providers/Qt/templates/scxml.qbs index 7125ec53c..757041b52 100644 --- a/share/qbs/module-providers/Qt/templates/scxml.qbs +++ b/share/qbs/module-providers/Qt/templates/scxml.qbs @@ -1,10 +1,11 @@ import qbs.FileInfo import qbs.Utilities -import "../QtModule.qbs" as QtModule QtModule { qtModuleName: "Scxml" + property string _qscxmlcDir: Utilities.versionCompare(Qt.core.version, "6.3") >= 0 + ? Qt.core.libExecPath : Qt.core.binPath property string qscxmlcName: "qscxmlc" property string className property string namespace @@ -26,8 +27,7 @@ QtModule { prepare: { var compilerName = product.moduleProperty("Qt.scxml", "qscxmlcName"); - var compilerPath = FileInfo.joinPaths(input.moduleProperty("Qt.core", "binPath"), - compilerName); + var compilerPath = FileInfo.joinPaths(input.Qt.scxml._qscxmlcDir, compilerName); var args = ["--header", outputs["hpp"][0].filePath, "--impl", outputs["cpp"][0].filePath]; var cxx98 = input.moduleProperty("cpp", "cxxLanguageVersion") === "c++98"; @@ -73,7 +73,7 @@ QtModule { moduleConfig: @moduleConfig@ cpp.defines: @defines@ - cpp.includePaths: @includes@ + cpp.systemIncludePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @additionalContent@ |