forked from qt-creator/qt-creator
Docker: Re-do auto-detection of Qt
This now properly iterates into subdirectories when selecting the "Search in selected directories" option for the auto-detection so it works with Boot2Qt images that don't put Qt in PATH, but somewhere under /opt Change-Id: Ifc337c0169d4b98b4e894a5d7e8286f171e0c569 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -709,20 +709,26 @@ QtVersions KitDetectorPrivate::autoDetectQtVersions() const
|
|||||||
QtVersions qtVersions;
|
QtVersions qtVersions;
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
|
|
||||||
|
const auto handleQmake = [this, &qtVersions, &error](const FilePath &qmake) {
|
||||||
|
if (QtVersion *qtVersion = QtVersionFactory::createQtVersionFromQMakePath(qmake, false, m_sharedId, &error)) {
|
||||||
|
qtVersions.append(qtVersion);
|
||||||
|
QtVersionManager::addVersion(qtVersion);
|
||||||
|
emit q->logOutput(tr("Found \"%1\"").arg(qtVersion->qmakeFilePath().toUserOutput()));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
emit q->logOutput(tr("Searching for qmake executables..."));
|
||||||
|
|
||||||
const QStringList candidates = {"qmake-qt6", "qmake-qt5", "qmake"};
|
const QStringList candidates = {"qmake-qt6", "qmake-qt5", "qmake"};
|
||||||
emit q->logOutput('\n' + tr("Searching Qt installations..."));
|
for (const FilePath &searchPath : m_searchPaths) {
|
||||||
for (const QString &candidate : candidates) {
|
searchPath.iterateDirectory(handleQmake, {candidates, QDir::Files | QDir::Executable,
|
||||||
emit q->logOutput(tr("Searching for %1 executable...").arg(candidate));
|
QDirIterator::Subdirectories});
|
||||||
const FilePath qmake = m_device->searchExecutable(candidate, m_searchPaths);
|
|
||||||
if (qmake.isEmpty())
|
|
||||||
continue;
|
|
||||||
QtVersion *qtVersion = QtVersionFactory::createQtVersionFromQMakePath(qmake, false, m_sharedId, &error);
|
|
||||||
if (!qtVersion)
|
|
||||||
continue;
|
|
||||||
qtVersions.append(qtVersion);
|
|
||||||
QtVersionManager::addVersion(qtVersion);
|
|
||||||
emit q->logOutput(tr("Found \"%1\"").arg(qtVersion->qmakeFilePath().toUserOutput()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!error.isEmpty())
|
||||||
|
emit q->logOutput(tr("Error: %1.").arg(error));
|
||||||
if (qtVersions.isEmpty())
|
if (qtVersions.isEmpty())
|
||||||
emit q->logOutput(tr("No Qt installation found."));
|
emit q->logOutput(tr("No Qt installation found."));
|
||||||
return qtVersions;
|
return qtVersions;
|
||||||
@@ -793,19 +799,20 @@ void KitDetectorPrivate::autoDetect()
|
|||||||
|
|
||||||
emit q->logOutput(tr("Starting auto-detection. This will take a while..."));
|
emit q->logOutput(tr("Starting auto-detection. This will take a while..."));
|
||||||
|
|
||||||
QList<ToolChain *> toolChains = autoDetectToolChains();
|
const Toolchains toolchains = autoDetectToolChains();
|
||||||
QtVersions qtVersions = autoDetectQtVersions();
|
const QtVersions qtVersions = autoDetectQtVersions();
|
||||||
|
|
||||||
autoDetectCMake();
|
autoDetectCMake();
|
||||||
autoDetectDebugger();
|
autoDetectDebugger();
|
||||||
|
|
||||||
const auto initializeKit = [this, toolChains, qtVersions](Kit *k) {
|
const auto initializeKit = [this, toolchains, qtVersions](Kit *k) {
|
||||||
k->setAutoDetected(false);
|
k->setAutoDetected(false);
|
||||||
k->setAutoDetectionSource(m_sharedId);
|
k->setAutoDetectionSource(m_sharedId);
|
||||||
k->setUnexpandedDisplayName("%{Device:Name}");
|
k->setUnexpandedDisplayName("%{Device:Name}");
|
||||||
|
|
||||||
DeviceTypeKitAspect::setDeviceTypeId(k, Constants::DOCKER_DEVICE_TYPE);
|
DeviceTypeKitAspect::setDeviceTypeId(k, Constants::DOCKER_DEVICE_TYPE);
|
||||||
DeviceKitAspect::setDevice(k, m_device);
|
DeviceKitAspect::setDevice(k, m_device);
|
||||||
|
|
||||||
QtVersion *qt = nullptr;
|
QtVersion *qt = nullptr;
|
||||||
if (!qtVersions.isEmpty()) {
|
if (!qtVersions.isEmpty()) {
|
||||||
qt = qtVersions.at(0);
|
qt = qtVersions.at(0);
|
||||||
|
Reference in New Issue
Block a user