aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/module-providers/Qt/templates/QtModule.qbs
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-01-18 16:02:43 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2019-02-12 09:12:39 +0000
commitc4e60ed8283aa7a86e13c09113e7fec6bf41cc42 (patch)
tree6cefbf3ece17e255c3962e69573abc88bef060ef /share/qbs/module-providers/Qt/templates/QtModule.qbs
parent17058d1fc537e40e7dda9d6e48ccfb24ea1220f7 (diff)
Detect Qt via a module provider
Creation of qbs modules for Qt is now done on demand during project resolving. The qmake executable(s) are looked up via PATH or taken from the Qt.qmakeFilePaths provider property. As a result, Qt projects can now be built without a profile. The qtprofilesetup library is gone; its code is now in the module provider. I kept the C++ -> JavaScript conversion as straightforward as possible and mostly resisted the temptation to "optimize". The setup-qt tool still exists and mainly sets Qt.qmakeFilePaths. [ChangeLog] It is no longer required to call setup-qt before building Qt projects. Change-Id: I5b7e4711ec47b996911c499f29d8129d90e4731e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'share/qbs/module-providers/Qt/templates/QtModule.qbs')
-rw-r--r--share/qbs/module-providers/Qt/templates/QtModule.qbs86
1 files changed, 86 insertions, 0 deletions
diff --git a/share/qbs/module-providers/Qt/templates/QtModule.qbs b/share/qbs/module-providers/Qt/templates/QtModule.qbs
new file mode 100644
index 000000000..aa7c1d15a
--- /dev/null
+++ b/share/qbs/module-providers/Qt/templates/QtModule.qbs
@@ -0,0 +1,86 @@
+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
+ }
+}