fix/hack deployment of qt examples

qt assumes that it is being installed (possibly into an install root),
not deployed, and leaves the translation of host paths to device paths
to the deploying agent - which is qt creator.

Task-number: QTCREATORBUG-17466
Change-Id: If9065b1079df607732e0f81132f29dbaf18ff602
Started-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Oswald Buddenhagen
2017-01-25 21:04:56 +01:00
parent 99714239b6
commit 0909426420

View File

@@ -2372,10 +2372,18 @@ InstallsList QmakeProFileNode::installsList(const QtSupport::ProFileReader *read
if (!reader) if (!reader)
return result; return result;
const QStringList &itemList = reader->values(QLatin1String("INSTALLS")); const QStringList &itemList = reader->values(QLatin1String("INSTALLS"));
if (itemList.isEmpty())
return result;
const QString installPrefix
= reader->propertyValue(QLatin1String("QT_INSTALL_PREFIX"));
const QString devInstallPrefix
= reader->propertyValue(QLatin1String("QT_INSTALL_PREFIX/dev"));
bool fixInstallPrefix = (installPrefix != devInstallPrefix);
foreach (const QString &item, itemList) { foreach (const QString &item, itemList) {
bool active = !reader->values(item + QLatin1String(".CONFIG")) bool active = !reader->values(item + QLatin1String(".CONFIG"))
.contains(QLatin1String("no_default_install")); .contains(QLatin1String("no_default_install"));
QString itemPath;
const QString pathVar = item + QLatin1String(".path"); const QString pathVar = item + QLatin1String(".path");
const QStringList &itemPaths = reader->values(pathVar); const QStringList &itemPaths = reader->values(pathVar);
if (itemPaths.count() != 1) { if (itemPaths.count() != 1) {
@@ -2387,8 +2395,16 @@ InstallsList QmakeProFileNode::installsList(const QtSupport::ProFileReader *read
continue; continue;
} }
} }
itemPath = itemPaths.last();
QString itemPath = itemPaths.last();
if (fixInstallPrefix && itemPath.startsWith(installPrefix)) {
// This is a hack for projects which install into $$[QT_INSTALL_*],
// in particular Qt itself, examples being most relevant.
// Projects which implement their own install path policy must
// parametrize their INSTALLS themselves depending on the intended
// installation/deployment mode.
itemPath.replace(0, installPrefix.length(), devInstallPrefix);
}
if (item == QLatin1String("target")) { if (item == QLatin1String("target")) {
if (active) if (active)
result.targetPath = itemPath; result.targetPath = itemPath;