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 <christian.kandeler@theqtcompany.com>
This commit is contained in:
Jake Petroules
2015-08-21 04:03:59 -07:00
parent 46910b46c3
commit d60e3010e8
5 changed files with 10 additions and 10 deletions

View File

@@ -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"]
}

View File

@@ -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 <lib/header.h>
cpp.includePaths: [libIncludeBase]

View File

@@ -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;

View File

@@ -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",

View File

@@ -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"] : [])
}