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

@@ -57,6 +57,7 @@
#include <proparser/qmakevfs.h>
#include <qtsupport/profilereader.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <qtsupport/uicodemodelsupport.h>
#include <resourceeditor/resourcenode.h>
@@ -362,6 +363,10 @@ QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
connect(BuildManager::instance(), SIGNAL(buildQueueFinished(bool)),
SLOT(buildFinished(bool)));
setPreferredKitMatcher(KitMatcher([this](const Kit *kit) -> bool {
return matchesKit(kit);
}));
}
QmakeProject::~QmakeProject()
@@ -1605,6 +1610,21 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa
}
}
bool QmakeProject::matchesKit(const Kit *kit)
{
QList<QtSupport::BaseQtVersion *> parentQts;
Utils::FileName filePath = projectFilePath();
foreach (QtSupport::BaseQtVersion *version, QtSupport::QtVersionManager::validVersions()) {
if (version->isInSourceDirectory(filePath))
parentQts.append(version);
}
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
if (!parentQts.isEmpty())
return parentQts.contains(version);
return true;
}
QString QmakeProject::executableFor(const QmakeProFileNode *node)
{
const ProjectExplorer::Kit * const kit = activeTarget()->kit();