From d60e3010e8253bfd68bd670fcccd1ebe97c137e8 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Fri, 21 Aug 2015 04:03:59 -0700 Subject: [PATCH] Qbs: Adapt rpath handling to how it is normally implemented on OS X. When using rpaths on OS X, the install name prefix should always be set to "@rpath" and the rpaths should be appropriately set to the locations in which that binary looks for its dependencies. While this change is behaviorally identical, it brings the project setup in line with how developers expect these properties to be set, and thus reduces confusion. As an aside, it now correctly follows the principle of relocatability (install name prefixes like @rpath/Frameworks are only partially relocatable as opposed to @rpath alone which is fully relocatable). Change-Id: I7b5cc7a316d2608037ea9ab087029baa85aee2ba Reviewed-by: Christian Kandeler --- qbs/imports/QtcAutotest.qbs | 3 +-- qbs/imports/QtcLibrary.qbs | 4 ++-- qbs/imports/QtcPlugin.qbs | 4 ++-- src/app/app.qbs | 2 +- src/tools/buildoutputparser/buildoutputparser.qbs | 7 ++++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qbs/imports/QtcAutotest.qbs b/qbs/imports/QtcAutotest.qbs index 103aa3b3f0e..9eeebb9bc47 100644 --- a/qbs/imports/QtcAutotest.qbs +++ b/qbs/imports/QtcAutotest.qbs @@ -13,7 +13,6 @@ QtcProduct { cpp.rpaths: [ project.buildDirectory + '/' + project.ide_library_path, - project.buildDirectory + '/' + project.ide_library_path + "/..", // OSX project.buildDirectory + '/' + project.ide_plugin_path ] cpp.minimumOsxVersion: "10.7" @@ -28,7 +27,7 @@ QtcProduct { // (e.g. extensionsystem) do not work when installed, because they want hardcoded // absolute paths to resources in the build directory. // cpp.rpaths: qbs.targetOS.contains("osx") - // ? ["@executable_path/.."] + // ? ["@loader_path/../Frameworks", "@loader_path/../PlugIns"] // : ["$ORIGIN/../" + project.libDirName + "/qtcreator", // "$ORIGIN/../" project.libDirName + "/qtcreator/plugins"] } diff --git a/qbs/imports/QtcLibrary.qbs b/qbs/imports/QtcLibrary.qbs index 93b60110582..42ab738f7d9 100644 --- a/qbs/imports/QtcLibrary.qbs +++ b/qbs/imports/QtcLibrary.qbs @@ -18,9 +18,9 @@ QtcProduct { flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb return flags; } - cpp.installNamePrefix: "@rpath/Frameworks/" + cpp.installNamePrefix: "@rpath" cpp.rpaths: qbs.targetOS.contains("osx") - ? ["@loader_path/..", "@executable_path/.."] + ? ["@loader_path/../Frameworks"] : ["$ORIGIN", "$ORIGIN/.."] property string libIncludeBase: ".." // #include cpp.includePaths: [libIncludeBase] diff --git a/qbs/imports/QtcPlugin.qbs b/qbs/imports/QtcPlugin.qbs index 6bbe1efcaa3..8433566589d 100644 --- a/qbs/imports/QtcPlugin.qbs +++ b/qbs/imports/QtcPlugin.qbs @@ -24,9 +24,9 @@ QtcProduct { } cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"]) - cpp.installNamePrefix: "@rpath/PlugIns/" + cpp.installNamePrefix: "@rpath" cpp.rpaths: qbs.targetOS.contains("osx") - ? ["@loader_path/..", "@loader_path/", "@executable_path/.."] + ? ["@loader_path/../Frameworks", "@loader_path/../PlugIns"] : ["$ORIGIN", "$ORIGIN/.."] cpp.linkerFlags: { var flags = base; diff --git a/src/app/app.qbs b/src/app/app.qbs index 6f585d6ce61..59034b7191c 100644 --- a/src/app/app.qbs +++ b/src/app/app.qbs @@ -5,7 +5,7 @@ QtcProduct { name: project.ide_app_target consoleApplication: qbs.debugInformation - cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/.."] + cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/../Frameworks"] : ["$ORIGIN/../" + project.libDirName + "/qtcreator"] cpp.includePaths: [ project.sharedSourcesDir + "/qtsingleapplication", diff --git a/src/tools/buildoutputparser/buildoutputparser.qbs b/src/tools/buildoutputparser/buildoutputparser.qbs index cbed1bfe636..2a116ef06c9 100644 --- a/src/tools/buildoutputparser/buildoutputparser.qbs +++ b/src/tools/buildoutputparser/buildoutputparser.qbs @@ -11,9 +11,10 @@ QtcTool { "main.cpp", "outputprocessor.cpp", "outputprocessor.h", ] - cpp.rpaths: base.concat(qbs.targetOS.contains("osx") - ? ["@executable_path/../"] - : ["$ORIGIN/../" + project.ide_plugin_path]) + Properties { + condition: qbs.targetOS.contains("unix") && !qbs.targetOS.contains("darwin") + cpp.rpaths: base.concat(["$ORIGIN/../" + project.ide_plugin_path]) + } cpp.defines: base.concat(qbs.targetOS.contains("windows") || project.testsEnabled ? ["HAS_MSVC_PARSER"] : []) }