aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-12-01 00:20:35 -0800
committerJake Petroules <jake.petroules@qt.io>2018-01-08 18:23:27 +0000
commit2a9683dc918b6a560774e5f7fe48e2c122301f53 (patch)
tree7086c2caafc9404a2d973a976d3ed11b01a7f1e0 /src/shared
parent18469dc468b488562557b0fa77037c2a555962db (diff)
Move the Qt library installation out of the archive product
This allows Qt to be installed as part of Qbs by default instead of only when the archive package is built. Currently, this is enabled by default only for installations of Qt on macOS which are relocatable (have rpath in QT_CONFIG). This way it will not interfere with package managers like Homebrew/MacPorts which do not use rpath - for example, when building against a version of Qt installed by a package manager (which is typically built with absolute sonames), you're assumed to be building software to be packaged by that package manager, and therefore you want to rely on Qt as a "system" package and not copy it locally. It can also be explicitly switched off on the command line using products.qbsqt.deployQt:false This also refactors the logic a bit. Change-Id: I70b46d8fac08d34520ceab18405fa8a672158711 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bundledqt/bundledqt.qbs77
-rw-r--r--src/shared/bundledqt/qt.conf2
2 files changed, 79 insertions, 0 deletions
diff --git a/src/shared/bundledqt/bundledqt.qbs b/src/shared/bundledqt/bundledqt.qbs
new file mode 100644
index 000000000..65d85ffc6
--- /dev/null
+++ b/src/shared/bundledqt/bundledqt.qbs
@@ -0,0 +1,77 @@
+import qbs
+import qbs.FileInfo
+
+Product {
+ Depends { name: "qbsbuildconfig" }
+ Depends { name: "Qt"; submodules:
+ ["core", "gui", "network", "printsupport", "script", "widgets", "xml"] }
+
+ property bool deployQt: qbs.targetOS.contains("macos") && Qt.core.qtConfig.contains("rpath")
+ property bool deployDebugLibraries: qbs.buildVariants.contains("debug")
+
+ readonly property string qtDebugLibrarySuffix: {
+ if (qbs.targetOS.contains("windows"))
+ return "d";
+ if (qbs.targetOS.contains("darwin"))
+ return "_debug";
+ return "";
+ }
+
+ Group {
+ condition: deployQt && !Qt.core.staticBuild
+ name: "qt.conf"
+ files: ["qt.conf"]
+ qbs.install: true
+ qbs.installDir: qbsbuildconfig.appInstallDir
+ }
+
+ Group {
+ condition: deployQt
+ name: "Qt libraries"
+ files: !Qt.core.staticBuild ? Array.prototype.concat.apply(
+ [], Object.getOwnPropertyNames(Qt).map(function(mod) {
+ var fp = Qt[mod].libFilePathRelease;
+ var fpd = Qt.core.frameworkBuild ? fp + qtDebugLibrarySuffix : Qt[mod].libFilePathDebug;
+
+ var list = [fp];
+ if (deployDebugLibraries && qtDebugLibrarySuffix)
+ list.push(fpd);
+
+ if (Qt.core.frameworkBuild) {
+ var suffix = ".framework/";
+ var frameworkPath = fp.substr(0, fp.lastIndexOf(suffix) + suffix.length - 1);
+ var versionsPath = frameworkPath + "/Versions";
+ var versionPath = versionsPath + "/" + Qt.core.versionMajor;
+ list.push(frameworkPath + "/Resources");
+ list.push(versionPath + "/Resources/Info.plist");
+ list.push(versionPath + "/" + FileInfo.fileName(fp));
+ if (deployDebugLibraries && qtDebugLibrarySuffix)
+ list.push(versionPath + "/" + FileInfo.fileName(fpd));
+ if (qbsbuildconfig.installApiHeaders) {
+ list.push(frameworkPath + "/Headers");
+ list.push(versionPath + "/Headers/**");
+ }
+ }
+
+ return list;
+ })) : []
+ qbs.install: true
+ qbs.installDir: qbsbuildconfig.libInstallDir
+ qbs.installSourceBase: Qt.core.libPath
+ }
+
+ Group {
+ condition: deployQt
+ prefix: Qt.core.pluginPath + "/"
+ name: "QPA plugin"
+ files: !Qt.core.staticBuild ? Array.prototype.concat.apply([], [""].concat(
+ deployDebugLibraries && qtDebugLibrarySuffix ? [qtDebugLibrarySuffix] : []).map(
+ function(suffix) {
+ return ["platforms/" + cpp.dynamicLibraryPrefix + (Qt.gui.defaultQpaPlugin || "qcocoa")
+ + suffix + cpp.dynamicLibrarySuffix];
+ })) : []
+ qbs.install: true
+ qbs.installDir: "plugins"
+ qbs.installSourceBase: prefix
+ }
+}
diff --git a/src/shared/bundledqt/qt.conf b/src/shared/bundledqt/qt.conf
new file mode 100644
index 000000000..7963d6644
--- /dev/null
+++ b/src/shared/bundledqt/qt.conf
@@ -0,0 +1,2 @@
+[Paths]
+Prefix = ..