Commit 4756fbbf authored by Tobias Hunger's avatar Tobias Hunger

CMake: Do not bother to remember ninja support status

Do not bother to remember ninja support status now that it is no longer
used.

Change-Id: Ief24af8e39ad5e39633ccb6d31858fa003de5ce8
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent 870cfdf0
......@@ -58,7 +58,6 @@ using namespace Utils;
namespace CMakeProjectManager {
namespace Internal {
const char USE_NINJA_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.UseNinja";
const char INITIAL_ARGUMENTS[] = "CMakeProjectManager.CMakeBuildConfiguration.InitialArgument";
static FileName shadowBuildDirectory(const FileName &projectFilePath, const Kit *k,
......@@ -75,7 +74,7 @@ static FileName shadowBuildDirectory(const FileName &projectFilePath, const Kit
}
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID)), m_useNinja(false)
BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID))
{
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
......@@ -87,7 +86,6 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent
CMakeBuildConfiguration *source) :
BuildConfiguration(parent, source),
m_msvcVersion(source->m_msvcVersion),
m_useNinja(source->m_useNinja),
m_initialArguments(source->m_initialArguments)
{
Q_ASSERT(parent);
......@@ -97,7 +95,6 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent
QVariantMap CMakeBuildConfiguration::toMap() const
{
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
map.insert(QLatin1String(USE_NINJA_KEY), m_useNinja);
map.insert(QLatin1String(INITIAL_ARGUMENTS), m_initialArguments);
return map;
}
......@@ -107,25 +104,11 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
if (!BuildConfiguration::fromMap(map))
return false;
m_useNinja = map.value(QLatin1String(USE_NINJA_KEY), false).toBool();
m_initialArguments = map.value(QLatin1String(INITIAL_ARGUMENTS)).toString();
return true;
}
bool CMakeBuildConfiguration::useNinja() const
{
return m_useNinja;
}
void CMakeBuildConfiguration::setUseNinja(bool useNninja)
{
if (m_useNinja != useNninja) {
m_useNinja = useNninja;
emit useNinjaChanged(m_useNinja);
}
}
void CMakeBuildConfiguration::emitBuildTypeChanged()
{
emit buildTypeChanged();
......@@ -298,7 +281,6 @@ CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExp
info->kitId = k->id();
info->environment = Environment::systemEnvironment();
k->addToEnvironment(info->environment);
info->useNinja = false;
info->sourceDirectory = sourceDir;
switch (buildType) {
case BuildTypeNone:
......
......@@ -59,24 +59,17 @@ public:
BuildType buildType() const;
bool useNinja() const;
void setUseNinja(bool);
void emitBuildTypeChanged();
void setInitialArguments(const QString &arguments);
QString initialArguments() const;
signals:
void useNinjaChanged(bool);
protected:
CMakeBuildConfiguration(ProjectExplorer::Target *parent, CMakeBuildConfiguration *source);
bool fromMap(const QVariantMap &map);
private:
QString m_msvcVersion;
bool m_useNinja;
QString m_initialArguments;
friend class CMakeProjectManager::CMakeProject;
......
......@@ -45,8 +45,8 @@ namespace CMakeProjectManager {
class CMakeBuildInfo : public ProjectExplorer::BuildInfo
{
public:
CMakeBuildInfo(const ProjectExplorer::IBuildConfigurationFactory *f) :
ProjectExplorer::BuildInfo(f), useNinja(false) { }
CMakeBuildInfo(const ProjectExplorer::IBuildConfigurationFactory *f) : ProjectExplorer::BuildInfo(f)
{ }
CMakeBuildInfo(const Internal::CMakeBuildConfiguration *bc) :
ProjectExplorer::BuildInfo(ProjectExplorer::IBuildConfigurationFactory::find(bc->target()))
......@@ -55,7 +55,6 @@ public:
buildDirectory = bc->buildDirectory();
kitId = bc->target()->kit()->id();
environment = bc->environment();
useNinja = bc->useNinja();
QTC_ASSERT(bc->target()->project(), return);
sourceDirectory = bc->target()->project()->projectDirectory().toString();
......@@ -65,7 +64,6 @@ public:
Utils::Environment environment;
QString sourceDirectory;
QString arguments;
bool useNinja;
};
} // namespace CMakeProjectManager
......
......@@ -91,7 +91,6 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
project->activeTarget()->activeBuildConfiguration()->displayName());
if (copw.exec() == QDialog::Accepted) {
project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
m_buildConfiguration->setUseNinja(copw.useNinja());
m_pathLineEdit->setText(m_buildConfiguration->rawBuildDirectory().toString());
}
}
......@@ -103,8 +102,7 @@ void CMakeBuildSettingsWidget::runCMake()
CMakeProject *project = static_cast<CMakeProject *>(m_buildConfiguration->target()->project());
CMakeManager *manager = static_cast<CMakeManager *>(project->projectManager());
CMakeBuildInfo info(m_buildConfiguration);
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(),
manager,
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), manager,
CMakeOpenProjectWizard::WantToUpdate, &info,
project->activeTarget()->displayName(),
project->activeTarget()->activeBuildConfiguration()->displayName());
......
......@@ -91,7 +91,6 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(QWidget *parent, CMakeManager *cm
m_cmakeManager(cmakeManager),
m_sourceDirectory(info->sourceDirectory),
m_environment(info->environment),
m_useNinja(info->useNinja),
m_kit(0)
{
m_kit = KitManager::find(info->kitId);
......@@ -150,8 +149,7 @@ bool CMakeOpenProjectWizard::compatibleKitExist() const
// OfferNinja and ForceNinja differ in what they return
// but not whether the list is empty or not, which is what we
// are interested in here
QList<GeneratorInfo> infos = GeneratorInfo::generatorInfosFor(k,
hasNinjaGenerator ? GeneratorInfo::OfferNinja : GeneratorInfo::NoNinja,
QList<GeneratorInfo> infos = GeneratorInfo::generatorInfosFor(k, hasNinjaGenerator,
preferNinja,
hasCodeBlocksGenerator);
if (!infos.isEmpty())
......@@ -189,16 +187,6 @@ void CMakeOpenProjectWizard::setBuildDirectory(const QString &directory)
m_buildDirectory = directory;
}
bool CMakeOpenProjectWizard::useNinja() const
{
return m_useNinja;
}
void CMakeOpenProjectWizard::setUseNinja(bool b)
{
m_useNinja = b;
}
QString CMakeOpenProjectWizard::arguments() const
{
return m_arguments;
......@@ -529,20 +517,7 @@ void CMakeRunPage::initializePage()
if (cmake) {
// Note: We don't compare the actually cached generator to what is set in the buildconfiguration
// We assume that the buildconfiguration is correct
GeneratorInfo::Ninja ninja;
if (m_mode == CMakeRunPage::NeedToUpdate || m_mode == CMakeRunPage::WantToUpdate) {
ninja = m_cmakeWizard->useNinja() ? GeneratorInfo::ForceNinja : GeneratorInfo::NoNinja;
} else { // Recreate, ChangeDirectory
// Note: ReCreate is technically just a removed .cbp file, we assume the cache
// got removed too. If the cache still exists the error message from cmake should
// be a good hint to change the generator
ninja = cmake->hasCodeBlocksNinjaGenerator() ? GeneratorInfo::OfferNinja : GeneratorInfo::NoNinja;
}
infos = GeneratorInfo::generatorInfosFor(m_cmakeWizard->kit(),
ninja,
preferNinja,
true);
infos = GeneratorInfo::generatorInfosFor(m_cmakeWizard->kit(), true, preferNinja, true);
}
foreach (const GeneratorInfo &info, infos)
m_generatorComboBox->addItem(info.displayName(), qVariantFromValue(info));
......@@ -556,7 +531,6 @@ bool CMakeRunPage::validatePage()
return false;
GeneratorInfo generatorInfo = m_generatorComboBox->itemData(index).value<GeneratorInfo>();
m_cmakeWizard->setKit(generatorInfo.kit());
m_cmakeWizard->setUseNinja(generatorInfo.isNinja());
return QWizardPage::validatePage();
}
......@@ -573,7 +547,6 @@ void CMakeRunPage::runCMake()
}
GeneratorInfo generatorInfo = m_generatorComboBox->itemData(index).value<GeneratorInfo>();
m_cmakeWizard->setKit(generatorInfo.kit());
m_cmakeWizard->setUseNinja(generatorInfo.isNinja());
m_runCMake->setEnabled(false);
m_argumentsLineEdit->setEnabled(false);
......
......@@ -86,8 +86,6 @@ public:
QString buildDirectory() const;
QString sourceDirectory() const;
void setBuildDirectory(const QString &directory);
bool useNinja() const;
void setUseNinja(bool b);
CMakeManager *cmakeManager() const;
QString arguments() const;
void setArguments(const QString &args);
......@@ -105,7 +103,6 @@ private:
QString m_sourceDirectory;
QString m_arguments;
Utils::Environment m_environment;
bool m_useNinja;
ProjectExplorer::Kit *m_kit;
};
......
......@@ -146,11 +146,9 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur
CMakeBuildInfo info(cmakebc);
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), m_manager, mode, &info,
bc->target()->displayName(), bc->displayName());
if (copw.exec() == QDialog::Accepted) {
cmakebc->setUseNinja(copw.useNinja()); // NeedToCreate can change the Ninja setting
if (copw.exec() == QDialog::Accepted)
cmakebc->setInitialArguments(QString());
}
}
// reparse
parseCMakeLists();
......@@ -559,14 +557,12 @@ Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *er
CMakeBuildInfo info(activeBC);
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), m_manager, mode, &info,
activeBC->target()->displayName(), activeBC->displayName());
if (copw.exec() != QDialog::Accepted) {
if (copw.exec() != QDialog::Accepted)
return RestoreResult::UserAbort;
} else {
activeBC->setUseNinja(copw.useNinja());
else
activeBC->setInitialArguments(QString());
}
}
}
parseCMakeLists();
......
......@@ -70,10 +70,6 @@ ProjectExplorer::Kit *GeneratorInfo::kit() const
return m_kit;
}
bool GeneratorInfo::isNinja() const {
return m_isNinja;
}
QByteArray GeneratorInfo::generator() const
{
if (!m_kit)
......@@ -133,7 +129,8 @@ QString GeneratorInfo::displayName() const
return QString();
}
QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool preferNinja, bool hasCodeBlocks)
QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, bool hasNinja,
bool preferNinja, bool hasCodeBlocks)
{
QList<GeneratorInfo> results;
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
......@@ -146,7 +143,6 @@ QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, N
&& deviceType != Qnx::Constants::QNX_QNX_OS_TYPE)
return results;
ProjectExplorer::Abi targetAbi = tc->targetAbi();
if (n != ForceNinja) {
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
if (isMsvcFlavor(targetAbi)) {
if (hasCodeBlocks)
......@@ -158,13 +154,14 @@ QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, N
// Non windows
results << GeneratorInfo(k);
}
}
if (n != NoNinja) {
if (hasNinja) {
if (preferNinja)
results.prepend(GeneratorInfo(k, true));
else
results.append(GeneratorInfo(k, true));
}
return results;
}
......
......@@ -44,8 +44,8 @@ class GeneratorInfo
{
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::GeneratorInfo)
public:
enum Ninja { NoNinja, OfferNinja, ForceNinja };
static QList<GeneratorInfo> generatorInfosFor(ProjectExplorer::Kit *k, Ninja n, bool preferNinja, bool hasCodeBlocks);
static QList<GeneratorInfo> generatorInfosFor(ProjectExplorer::Kit *k, bool hasNinja,
bool preferNinja, bool hasCodeBlocks);
GeneratorInfo();
explicit GeneratorInfo(ProjectExplorer::Kit *kit, bool ninja = false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment