aboutsummaryrefslogtreecommitdiffstats
path: root/qbs-resources/imports
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-12-01 00:36:06 -0800
committerJake Petroules <jake.petroules@qt.io>2017-12-08 17:35:00 +0000
commit5a1bb1db8e10d3964d72d7a15855bd8796d97ec7 (patch)
tree6aeb792e112af27cb0878875783b6e9139edc316 /qbs-resources/imports
parent06250a36a471a151dfe238d7bbf1b1efbca91aac (diff)
Rewrite rpath handling for binaries that are a part of Qbs itself
Exporting a list of rpaths from a target is completely bogus as-is, because a target cannot know a dependee's install location relative to itself. This patch instead has each target category (executables in bin, libraries in lib, libexec binaries in libexec/qbs, and plugins in lib/qbs/plugins) set its relative installation directory at the product level, and then an appropriate rpath is created for the target by calculating a relative path from the target to the lib directory in the context of an installed build. This also has the advantage that rpaths are now calculated dynamically at build time rather than hardcoded, so if a user changes the directory depth of pluginsInstallDir, for example, everything will be adjusted automatically. Each target also therefore now has an rpath pointing exactly to its immediate dependencies, instead of relying on the parent process to inherit the rpath entries. Among simply being correct, this also has the advantage that any target can now be loaded correctly by another process which itself sets no rpath happening to point to the qbs lib directory. Change-Id: I8fdf24b74ef60426cea0930b7941479919226fd2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'qbs-resources/imports')
-rw-r--r--qbs-resources/imports/QbsApp.qbs3
-rw-r--r--qbs-resources/imports/QbsLibrary.qbs4
-rw-r--r--qbs-resources/imports/QbsProduct.qbs2
3 files changed, 6 insertions, 3 deletions
diff --git a/qbs-resources/imports/QbsApp.qbs b/qbs-resources/imports/QbsApp.qbs
index a81efca6a..8e671764d 100644
--- a/qbs-resources/imports/QbsApp.qbs
+++ b/qbs-resources/imports/QbsApp.qbs
@@ -17,9 +17,10 @@ QbsProduct {
fileTagsFilter: product.type
.concat(qbs.buildVariant === "debug" ? ["debuginfo_app"] : [])
qbs.install: true
- qbs.installDir: qbsbuildconfig.appInstallDir
qbs.installSourceBase: destinationDirectory
+ qbs.installDir: targetInstallDir
}
+ targetInstallDir: qbsbuildconfig.appInstallDir
Group {
name: "logging"
prefix: FileInfo.joinPaths(product.sourceDirectory, "../shared/logging") + '/'
diff --git a/qbs-resources/imports/QbsLibrary.qbs b/qbs-resources/imports/QbsLibrary.qbs
index 8757b790c..a6bc7366d 100644
--- a/qbs-resources/imports/QbsLibrary.qbs
+++ b/qbs-resources/imports/QbsLibrary.qbs
@@ -22,9 +22,10 @@ QbsProduct {
fileTagsFilter: product.type.concat("dynamiclibrary_symlink")
.concat(qbs.buildVariant === "debug" ? ["debuginfo_dll"] : [])
qbs.install: install
- qbs.installDir: qbsbuildconfig.libInstallDir
qbs.installSourceBase: destinationDirectory
+ qbs.installDir: targetInstallDir
}
+ targetInstallDir: qbsbuildconfig.libInstallDir
Group {
fileTagsFilter: ["dynamiclibrary_import"]
qbs.install: install
@@ -42,7 +43,6 @@ QbsProduct {
Depends { name: "Qt"; submodules: ["core"] }
Depends { name: "qbsbuildconfig" }
- cpp.rpaths: qbsbuildconfig.libRPaths
cpp.includePaths: [product.sourceDirectory]
cpp.defines: product.visibilityType === "static" ? ["QBS_STATIC_LIB"] : []
}
diff --git a/qbs-resources/imports/QbsProduct.qbs b/qbs-resources/imports/QbsProduct.qbs
index a90037bc6..ff5915d00 100644
--- a/qbs-resources/imports/QbsProduct.qbs
+++ b/qbs-resources/imports/QbsProduct.qbs
@@ -6,6 +6,7 @@ Product {
Depends { name: "Qt.core"; versionAtLeast: minimumQtVersion }
property string minimumQtVersion: "5.6.0"
property bool install: true
+ property string targetInstallDir
cpp.defines: {
var res = ["QT_NO_CAST_FROM_ASCII", "QT_NO_PROCESS_COMBINED_ARGUMENT_START"];
if (qbs.toolchain.contains("msvc"))
@@ -15,4 +16,5 @@ Product {
return res;
}
cpp.enableExceptions: true
+ cpp.rpaths: qbsbuildconfig.libRPaths
}