diff options
Diffstat (limited to 'share/qbs/module-providers/Qt/templates')
14 files changed, 51 insertions, 178 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 62e05327b..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.systemFrameworkPaths: 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 883e34465..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 68276070f..6d548f194 100644 --- a/share/qbs/module-providers/Qt/templates/android_support.qbs +++ b/share/qbs/module-providers/Qt/templates/android_support.qbs @@ -21,7 +21,7 @@ Module { property string _qtBinaryDir property string _qtInstallDir property bool _enableSdkSupport: product.type && product.type.contains("android.package") - && !consoleApplication + && !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") @@ -220,9 +220,11 @@ Module { 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 c3c68164f..485402716 100644 --- a/share/qbs/module-providers/Qt/templates/core.qbs +++ b/share/qbs/module-providers/Qt/templates/core.qbs @@ -18,7 +18,7 @@ Module { && qbs.targetPlatform === targetPlatform + "-simulator" Depends { name: "cpp" } - Depends { name: "Sanitizers.address" } + Depends { name: "Sanitizers.address"; condition: config.contains("sanitize_address") } Depends { name: "Qt.android_support"; condition: qbs.targetOS.contains("android") } Properties { @@ -57,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] @@ -75,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] : ""; } @@ -106,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 @@ -120,8 +124,6 @@ Module { property stringList moduleConfig: @moduleConfig@ - Sanitizers.address.enabled: config.contains("sanitize_address") - Properties { condition: moduleConfig.contains("use_gold_linker") cpp.linkerVariant: "gold" @@ -150,6 +152,8 @@ 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: { @@ -195,8 +199,7 @@ 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 @@ -219,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 @@ -545,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 08e1e49e7..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 { diff --git a/share/qbs/module-providers/Qt/templates/gui.qbs b/share/qbs/module-providers/Qt/templates/gui.qbs index 6ba5e48c4..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" diff --git a/share/qbs/module-providers/Qt/templates/module.qbs b/share/qbs/module-providers/Qt/templates/module.qbs index ccafe4122..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@} 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 36f60f8a3..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, 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)) { @@ -74,8 +90,10 @@ 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(' ')); + otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_QML\]/g, qtQmlPath); + otherLibs = otherLibs.concat(otherLibsLine.split(' ').map(FileInfo.cleanPath)); } } if (!pluginLib) diff --git a/share/qbs/module-providers/Qt/templates/qml.qbs b/share/qbs/module-providers/Qt/templates/qml.qbs index 747558f10..0a938e58d 100644 --- a/share/qbs/module-providers/Qt/templates/qml.qbs +++ b/share/qbs/module-providers/Qt/templates/qml.qbs @@ -1,7 +1,6 @@ import qbs.FileInfo import qbs.Host import qbs.TextFile -import '../QtModule.qbs' as QtModule import "qml.js" as Qml QtModule { @@ -170,12 +169,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.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) diff --git a/share/qbs/module-providers/Qt/templates/qmlcache.qbs b/share/qbs/module-providers/Qt/templates/qmlcache.qbs index 9a5956884..7047884c0 100644 --- a/share/qbs/module-providers/Qt/templates/qmlcache.qbs +++ b/share/qbs/module-providers/Qt/templates/qmlcache.qbs @@ -1,6 +1,5 @@ import qbs.File import qbs.FileInfo -import qbs.Host import qbs.Process import qbs.Utilities @@ -11,7 +10,7 @@ Module { throw "qmlcachegen unsupported for this target"; } property string qmlCacheGenPath: FileInfo.joinPaths(Qt.core.qmlLibExecPath, "qmlcachegen") - + (Host.os().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 e677143ea..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(); diff --git a/share/qbs/module-providers/Qt/templates/quick.qbs b/share/qbs/module-providers/Qt/templates/quick.qbs index 276246d6d..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 { @@ -75,7 +74,7 @@ QtModule { : Qt.core.binPath property string compilerBaseName: (_compilerIsQmlCacheGen ? "qmlcachegen" : "qtquickcompiler") property string compilerFilePath: FileInfo.joinPaths(_compilerBaseDir, - compilerBaseName + product.cpp.executableSuffix) + 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 fdd11e952..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"; |