forked from qt-creator/qt-creator
RemoteLinux: Allow adding Qt to LD_LIBRARY_PATH
When running on the remote build device. And make it work with CMake. Change-Id: If25bef8ab836c1d59a586116b3c3447a29c4e7e8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -264,18 +264,18 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|
||||
continue;
|
||||
|
||||
const FilePath buildDir = haveLibrariesRelativeToBuildDirectory ? buildDirectory : currentBuildDir;
|
||||
FilePath tmp = buildDir.resolvePath(FilePath::fromUserInput(part));
|
||||
FilePath tmp = buildDir.resolvePath(FilePath::fromUserInput(part).onDevice(buildDir));
|
||||
|
||||
if (f.role == "libraries")
|
||||
tmp = tmp.parentDir();
|
||||
|
||||
if (!tmp.isEmpty() && tmp.isDir()) {
|
||||
// f.role is libraryPath or frameworkPath
|
||||
// On Linux, exclude sub-paths from "/lib(64)", "/usr/lib(64)" and
|
||||
// On *nix, exclude sub-paths from "/lib(64)", "/usr/lib(64)" and
|
||||
// "/usr/local/lib" since these are usually in the standard search
|
||||
// paths. There probably are more, but the naming schemes are arbitrary
|
||||
// so we'd need to ask the linker ("ld --verbose | grep SEARCH_DIR").
|
||||
if (!HostOsInfo::isLinuxHost()
|
||||
if (buildDir.osType() == OsTypeWindows
|
||||
|| !isChildOf(tmp,
|
||||
{"/lib",
|
||||
"/lib64",
|
||||
@@ -285,9 +285,8 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|
||||
librarySeachPaths.append(tmp);
|
||||
// Libraries often have their import libs in ../lib and the
|
||||
// actual dll files in ../bin on windows. Qt is one example of that.
|
||||
if (tmp.fileName() == "lib" && HostOsInfo::isWindowsHost()) {
|
||||
if (tmp.fileName() == "lib" && buildDir.osType() == OsTypeWindows) {
|
||||
const FilePath path = tmp.parentDir().pathAppended("bin");
|
||||
|
||||
if (path.isDir())
|
||||
librarySeachPaths.append(path);
|
||||
}
|
||||
|
@@ -53,13 +53,22 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
|
||||
if (HostOsInfo::isAnyUnixHost())
|
||||
addAspect<X11ForwardingAspect>(macroExpander());
|
||||
|
||||
setUpdater([this, target, exeAspect, symbolsAspect] {
|
||||
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
||||
libAspect->setValue(false);
|
||||
connect(libAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
|
||||
setUpdater([this, target, exeAspect, symbolsAspect, libAspect] {
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
const FilePath localExecutable = bti.targetFilePath;
|
||||
DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable);
|
||||
|
||||
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||
symbolsAspect->setFilePath(localExecutable);
|
||||
|
||||
const IDeviceConstPtr buildDevice = BuildDeviceKitAspect::device(target->kit());
|
||||
const IDeviceConstPtr runDevice = DeviceKitAspect::device(target->kit());
|
||||
libAspect->setEnabled(buildDevice == runDevice);
|
||||
});
|
||||
|
||||
setRunnableModifier([this](Runnable &r) {
|
||||
@@ -67,6 +76,12 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
|
||||
r.extraData.insert("Ssh.X11ForwardToDisplay", forwardingAspect->display());
|
||||
});
|
||||
|
||||
envAspect->addModifier([this, libAspect](Environment &env) {
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
if (bti.runEnvModifier)
|
||||
bti.runEnvModifier(env, libAspect->value());
|
||||
});
|
||||
|
||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||
connect(target, &Target::deploymentDataChanged, this, &RunConfiguration::update);
|
||||
connect(target, &Target::kitChanged, this, &RunConfiguration::update);
|
||||
|
Reference in New Issue
Block a user