| 20 | using namespace KDevelop; |
| 21 | |
| 22 | bool QMakeUtils::checkForNeedingConfigure(IProject* project) |
| 23 | { |
| 24 | Q_ASSERT(project); |
| 25 | |
| 26 | qCDebug(KDEV_QMAKE) << "Checking whether" << project->name() << "needs a configure run"; |
| 27 | |
| 28 | const auto buildDir = QMakeConfig::buildDirFromSrc(project, project->path()); |
| 29 | if (!buildDir.isValid()) { |
| 30 | QPointer<QMakeBuildDirChooserDialog> chooser = new QMakeBuildDirChooserDialog(project); |
| 31 | if (chooser->exec() == QDialog::Rejected) { |
| 32 | delete chooser; |
| 33 | return false; // cancelled, can't configure => false |
| 34 | } |
| 35 | delete chooser; |
| 36 | } |
| 37 | |
| 38 | qCDebug(KDEV_QMAKE) << "Build directory for" << project->name() << "is" << buildDir; |
| 39 | |
| 40 | if (!QMakeConfig::isConfigured(project)) { |
| 41 | return true; |
| 42 | } |
| 43 | const QString qmakeExecutable = QMakeConfig::qmakeExecutable(project); |
| 44 | if (qmakeExecutable.isEmpty()) { |
| 45 | return true; |
| 46 | } |
| 47 | const QHash<QString, QString> vars = queryQMake(project); |
| 48 | if (vars.isEmpty()) { |
| 49 | return true; |
| 50 | } |
| 51 | if (QMakeConfig::findBasicMkSpec(vars).isEmpty()) { |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | if (!QFile::exists(buildDir.toLocalFile())) { |
| 56 | qCDebug(KDEV_QMAKE) << "build dir" << buildDir << "configured, but does not exist yet"; |
| 57 | return true; |
| 58 | } |
| 59 | |
| 60 | qCDebug(KDEV_QMAKE) << "No configure needed for project" << project->name(); |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | QHash<QString, QString> QMakeUtils::queryQMake(IProject* project) |
| 65 | { |