summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/mac/default_post.prf
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2014-08-07 13:04:48 +0200
committerJake Petroules <jake.petroules@petroules.com>2014-11-01 19:26:12 +0100
commite0676a954c3a8375b30e6eb76450e2222de12079 (patch)
treea9c764d84329720ac57468c4c4bd8b4df79389e2 /mkspecs/features/mac/default_post.prf
parente8d6d4f81c9aa34524938448c63b6e4beb7b1630 (diff)
Add rpath pointing to Qt libraries in OS X and iOS
This is triggered only when app is using Qt and Qt was built with "rpath" configuration and project does not specify QMAKE_RPATHDIR explicitly. Added rpath is made relative to app binary location if target path lies inside Qt SDK, so all SDK bundled tools and examples will work automatically without any changes. Tests are an exception here, since they are being run from their build location by CI, we may not use relative rpath that work only in install location. Task-number: QTBUG-31814 Change-Id: I3690f29d2b5396a19c1dbc92ad05e6c028f8515b Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Diffstat (limited to 'mkspecs/features/mac/default_post.prf')
-rw-r--r--mkspecs/features/mac/default_post.prf24
1 files changed, 24 insertions, 0 deletions
diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
index 530683552b..246c9c60e6 100644
--- a/mkspecs/features/mac/default_post.prf
+++ b/mkspecs/features/mac/default_post.prf
@@ -35,6 +35,30 @@ qt:!isEmpty(QT_CONFIG) {
QMAKE_LFLAGS += -stdlib=libstdc++
}
}
+ # If Qt was built with shared libraries with rpath support and project does
+ # not specify own rpaths (including empty list) add one pointing to Qt
+ # libraries. This applies only to apps, since all loaded libraries inherit
+ # rpaths from current process executable.
+ else:!if(host_build:force_bootstrap):equals(TEMPLATE, app):!defined(QMAKE_RPATHDIR, var):contains(QT_CONFIG, rpath) {
+ # If app is outside of Qt SDK prefix use absolute path to Qt libraries,
+ # otherwise make it relative, so all SDK tools and examples work when
+ # relocated.
+ # Tests are an exception, since they are launched in their build not
+ # install location by CI, so we cannot use relative rpaths there.
+ if(!contains(target.path, "$$re_escape($$[QT_INSTALL_PREFIX])/.*")|\
+ contains(target.path, "$$re_escape($$[QT_INSTALL_TESTS])/.*")) {
+ QMAKE_RPATHDIR = $$[QT_INSTALL_LIBS]
+ } else {
+ app_bundle {
+ ios: binpath = $$target.path/$${TARGET}.app
+ else: binpath = $$target.path/$${TARGET}.app/Contents/MacOS
+ } else {
+ binpath = $$target.path
+ }
+ QMAKE_RPATHDIR = @loader_path/$$relative_path($$[QT_INSTALL_LIBS], $$binpath)
+ unset(binpath)
+ }
+ }
}
macx-xcode:!isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {