forked from qt-creator/qt-creator
CMake: Do not default to CodeBlocks extra generator
Now that CMake without server-mode or file-api are no longer supported in Qt Creator, there is no more need to push for the CodeBlocks extra generator which was required for the "tealeaf" reader only. Change-Id: Iec280d960b9f50ee6f9b954ecc532745a62213f5 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -466,7 +466,20 @@ private:
|
||||
|
||||
namespace {
|
||||
|
||||
struct GeneratorInfo {
|
||||
class GeneratorInfo
|
||||
{
|
||||
public:
|
||||
GeneratorInfo() = default;
|
||||
GeneratorInfo(const QString &generator_,
|
||||
const QString &extraGenerator_ = QString(),
|
||||
const QString &platform_ = QString(),
|
||||
const QString &toolset_ = QString())
|
||||
: generator(generator_)
|
||||
, extraGenerator(extraGenerator_)
|
||||
, platform(platform_)
|
||||
, toolset(toolset_)
|
||||
{}
|
||||
|
||||
QVariant toVariant() const {
|
||||
QVariantMap result;
|
||||
result.insert(GENERATOR_KEY, generator);
|
||||
@@ -568,10 +581,12 @@ void CMakeGeneratorKitAspect::setToolset(Kit *k, const QString &toolset)
|
||||
}
|
||||
|
||||
void CMakeGeneratorKitAspect::set(Kit *k,
|
||||
const QString &generator, const QString &extraGenerator,
|
||||
const QString &platform, const QString &toolset)
|
||||
const QString &generator,
|
||||
const QString &extraGenerator,
|
||||
const QString &platform,
|
||||
const QString &toolset)
|
||||
{
|
||||
GeneratorInfo info = {generator, extraGenerator, platform, toolset};
|
||||
GeneratorInfo info(generator, extraGenerator, platform, toolset);
|
||||
setGeneratorInfo(k, info);
|
||||
}
|
||||
|
||||
@@ -605,12 +620,9 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
|
||||
if (!tool)
|
||||
return QVariant();
|
||||
|
||||
const QString extraGenerator = "CodeBlocks";
|
||||
|
||||
QList<CMakeTool::Generator> known = tool->supportedGenerators();
|
||||
auto it = std::find_if(known.constBegin(), known.constEnd(),
|
||||
[extraGenerator](const CMakeTool::Generator &g) {
|
||||
return g.matches("Ninja", extraGenerator);
|
||||
const QList<CMakeTool::Generator> known = tool->supportedGenerators();
|
||||
auto it = std::find_if(known.constBegin(), known.constEnd(), [](const CMakeTool::Generator &g) {
|
||||
return g.matches("Ninja");
|
||||
});
|
||||
if (it != known.constEnd()) {
|
||||
const bool hasNinja = [k]() {
|
||||
@@ -626,29 +638,30 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
|
||||
}();
|
||||
|
||||
if (hasNinja)
|
||||
return GeneratorInfo({QString("Ninja"), extraGenerator, QString(), QString()}).toVariant();
|
||||
return GeneratorInfo("Ninja").toVariant();
|
||||
}
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
// *sigh* Windows with its zoo of incompatible stuff again...
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(k);
|
||||
if (tc && tc->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID) {
|
||||
it = std::find_if(known.constBegin(), known.constEnd(),
|
||||
[extraGenerator](const CMakeTool::Generator &g) {
|
||||
return g.matches("MinGW Makefiles", extraGenerator);
|
||||
it = std::find_if(known.constBegin(),
|
||||
known.constEnd(),
|
||||
[](const CMakeTool::Generator &g) {
|
||||
return g.matches("MinGW Makefiles");
|
||||
});
|
||||
} else {
|
||||
it = std::find_if(known.constBegin(), known.constEnd(),
|
||||
[extraGenerator](const CMakeTool::Generator &g) {
|
||||
return g.matches("NMake Makefiles", extraGenerator)
|
||||
|| g.matches("NMake Makefiles JOM", extraGenerator);
|
||||
it = std::find_if(known.constBegin(),
|
||||
known.constEnd(),
|
||||
[](const CMakeTool::Generator &g) {
|
||||
return g.matches("NMake Makefiles")
|
||||
|| g.matches("NMake Makefiles JOM");
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Unix-oid OSes:
|
||||
it = std::find_if(known.constBegin(), known.constEnd(),
|
||||
[extraGenerator](const CMakeTool::Generator &g) {
|
||||
return g.matches("Unix Makefiles", extraGenerator);
|
||||
it = std::find_if(known.constBegin(), known.constEnd(), [](const CMakeTool::Generator &g) {
|
||||
return g.matches("Unix Makefiles");
|
||||
});
|
||||
}
|
||||
if (it == known.constEnd())
|
||||
@@ -656,7 +669,7 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
|
||||
if (it == known.constEnd())
|
||||
return QVariant();
|
||||
|
||||
return GeneratorInfo({it->name, extraGenerator, QString(), QString()}).toVariant();
|
||||
return GeneratorInfo(it->name).toVariant();
|
||||
}
|
||||
|
||||
Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
|
||||
@@ -723,9 +736,10 @@ void CMakeGeneratorKitAspect::fix(Kit *k)
|
||||
dv.fromVariant(defaultValue(k));
|
||||
setGeneratorInfo(k, dv);
|
||||
} else {
|
||||
const GeneratorInfo dv = {info.generator, info.extraGenerator,
|
||||
const GeneratorInfo dv(info.generator,
|
||||
info.extraGenerator,
|
||||
it->supportsPlatform ? info.platform : QString(),
|
||||
it->supportsToolset ? info.toolset : QString()};
|
||||
it->supportsToolset ? info.toolset : QString());
|
||||
setGeneratorInfo(k, dv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
bool supportsPlatform = true;
|
||||
bool supportsToolset = true;
|
||||
|
||||
bool matches(const QString &n, const QString &ex) const;
|
||||
bool matches(const QString &n, const QString &ex = QString()) const;
|
||||
};
|
||||
|
||||
using PathMapper = std::function<Utils::FilePath (const Utils::FilePath &)>;
|
||||
|
||||
Reference in New Issue
Block a user