Detect qt sub projects and special case their build directory

Check every project's path against the source paths of all existing qts.
If we find a match, make it build in the right place by default.
Works for both in source and shadow builds.

Note: There's a quadratic algorithm since foreach kit we check against
all qt versions. That's unlikely to be a problem and non trivial to
fix.

Change-Id: I9f3456f3e835ee6adc35c26fe5c328c01387a8aa
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Daniel Teske
2014-10-20 17:23:07 +02:00
parent 880b7625ec
commit b9a7cfcaa1
5 changed files with 55 additions and 3 deletions

View File

@@ -648,8 +648,22 @@ QmakeBuildInfo *QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
// Leave info->buildDirectory unset;
info->kitId = k->id();
info->supportsShadowBuild = (version && version->supportsShadowBuilds());
info->buildDirectory
= defaultBuildDirectory(info->supportsShadowBuild, projectPath, k, suffix);
// check if this project is in the source directory:
Utils::FileName projectFilePath = Utils::FileName::fromString(projectPath);
if (version->isInSourceDirectory(projectFilePath)) {
// assemble build directory
QString projectDirectory = projectFilePath.toFileInfo().absolutePath();
QDir qtSourceDir = QDir(version->sourcePath().toString());
QString relativeProjectPath = qtSourceDir.relativeFilePath(projectDirectory);
QString qtBuildDir = version->versionInfo().value(QStringLiteral("QT_INSTALL_PREFIX"));
QString absoluteBuildPath = QDir::cleanPath(qtBuildDir + QLatin1Char('/') + relativeProjectPath);
info->buildDirectory = Utils::FileName::fromString(absoluteBuildPath);
} else {
info->buildDirectory
= defaultBuildDirectory(info->supportsShadowBuild, projectPath, k, suffix);
}
info->type = type;
return info;
}
@@ -682,7 +696,6 @@ QList<BuildInfo *> QmakeBuildConfigurationFactory::availableSetups(const Kit *k,
QList<ProjectExplorer::BuildInfo *> result;
result << createBuildInfo(k, projectPath, ProjectExplorer::BuildConfiguration::Debug);
result << createBuildInfo(k, projectPath, ProjectExplorer::BuildConfiguration::Release);
return result;
}