summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog
diff options
context:
space:
mode:
Diffstat (limited to 'Source/QtDialog')
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx1
-rw-r--r--Source/QtDialog/FirstConfigure.cxx70
-rw-r--r--Source/QtDialog/FirstConfigure.h15
-rw-r--r--Source/QtDialog/QCMake.cxx36
-rw-r--r--Source/QtDialog/QCMake.h13
5 files changed, 117 insertions, 18 deletions
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 03417f3..748dd7d 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -734,6 +734,7 @@ bool CMakeSetupDialog::setupFirstConfigure()
{
dialog.saveToSettings();
this->CMakeThread->cmakeInstance()->setGenerator(dialog.getGenerator());
+ this->CMakeThread->cmakeInstance()->setToolset(dialog.getToolset());
QCMakeCacheModel* m = this->CacheValues->cacheModel();
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx
index 6de9f00..61aad72 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -15,6 +15,11 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p)
l->addWidget(new QLabel(tr("Specify the generator for this project")));
this->GeneratorOptions = new QComboBox(this);
l->addWidget(this->GeneratorOptions);
+
+ // Add the ability to specify toolset (-T parameter)
+ ToolsetFrame = CreateToolsetWidgets();
+ l->addWidget(ToolsetFrame);
+
l->addSpacing(6);
this->CompilerSetupOptions[0] = new QRadioButton(tr("Use default native compilers"), this);
@@ -36,17 +41,51 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p)
this, SLOT(onSelectionChanged(bool)));
QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)),
this, SLOT(onSelectionChanged(bool)));
+ QObject::connect(GeneratorOptions,
+ SIGNAL(currentIndexChanged(QString const&)),
+ this, SLOT(onGeneratorChanged(QString const&)));
+}
+
+QFrame* StartCompilerSetup::CreateToolsetWidgets()
+{
+ QFrame* frame = new QFrame(this);
+ QVBoxLayout* l = new QVBoxLayout(frame);
+ l->setContentsMargins(0, 0, 0, 0);
+
+ ToolsetLabel = new QLabel(tr("Optional toolset to use (-T parameter)"));
+ l->addWidget(ToolsetLabel);
+
+ Toolset = new QLineEdit(frame);
+ l->addWidget(Toolset);
+
+ return frame;
}
StartCompilerSetup::~StartCompilerSetup()
{
}
-void StartCompilerSetup::setGenerators(const QStringList& gens)
+void StartCompilerSetup::setGenerators(
+ std::vector<cmake::GeneratorInfo> const& gens)
{
this->GeneratorOptions->clear();
- this->GeneratorOptions->addItems(gens);
-};
+
+ QStringList generator_list;
+
+ std::vector<cmake::GeneratorInfo>::const_iterator it;
+ for (it = gens.begin(); it != gens.end(); ++it)
+ {
+ generator_list.append(QString::fromLocal8Bit(it->name.c_str()));
+
+ if (it->supportsToolset)
+ {
+ this->GeneratorsSupportingToolset.append(
+ QString::fromLocal8Bit(it->name.c_str()));
+ }
+ }
+
+ this->GeneratorOptions->addItems(generator_list);
+}
void StartCompilerSetup::setCurrentGenerator(const QString& gen)
{
@@ -62,6 +101,11 @@ QString StartCompilerSetup::getGenerator() const
return this->GeneratorOptions->currentText();
};
+QString StartCompilerSetup::getToolset() const
+{
+ return this->Toolset->text();
+};
+
bool StartCompilerSetup::defaultSetup() const
{
return this->CompilerSetupOptions[0]->isChecked();
@@ -88,6 +132,18 @@ void StartCompilerSetup::onSelectionChanged(bool on)
selectionChanged();
}
+void StartCompilerSetup::onGeneratorChanged(QString const& name)
+{
+ if (GeneratorsSupportingToolset.contains(name))
+ {
+ ToolsetFrame->show();
+ }
+ else
+ {
+ ToolsetFrame->hide();
+ }
+}
+
int StartCompilerSetup::nextId() const
{
if(compilerSetup())
@@ -325,7 +381,8 @@ FirstConfigure::~FirstConfigure()
{
}
-void FirstConfigure::setGenerators(const QStringList& gens)
+void FirstConfigure::setGenerators(
+ std::vector<cmake::GeneratorInfo> const& gens)
{
this->mStartCompilerSetupPage->setGenerators(gens);
}
@@ -335,6 +392,11 @@ QString FirstConfigure::getGenerator() const
return this->mStartCompilerSetupPage->getGenerator();
}
+QString FirstConfigure::getToolset() const
+{
+ return this->mStartCompilerSetupPage->getToolset();
+}
+
void FirstConfigure::loadFromSettings()
{
QSettings settings;
diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h
index be390b0..09952b6 100644
--- a/Source/QtDialog/FirstConfigure.h
+++ b/Source/QtDialog/FirstConfigure.h
@@ -4,6 +4,7 @@
#include <QWizard>
#include <QWizardPage>
+#include "cmake.h"
#include "ui_Compilers.h"
#include "ui_CrossCompiler.h"
@@ -27,9 +28,10 @@ class StartCompilerSetup : public QWizardPage
public:
StartCompilerSetup(QWidget* p);
~StartCompilerSetup();
- void setGenerators(const QStringList& gens);
+ void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
void setCurrentGenerator(const QString& gen);
QString getGenerator() const;
+ QString getToolset() const;
bool defaultSetup() const;
bool compilerSetup() const;
@@ -43,10 +45,18 @@ class StartCompilerSetup : public QWizardPage
protected slots:
void onSelectionChanged(bool);
+ void onGeneratorChanged(QString const& name);
protected:
QComboBox* GeneratorOptions;
QRadioButton* CompilerSetupOptions[4];
+ QFrame* ToolsetFrame;
+ QLineEdit* Toolset;
+ QLabel* ToolsetLabel;
+ QStringList GeneratorsSupportingToolset;
+
+ private:
+ QFrame* CreateToolsetWidgets();
};
//! the page that gives basic options for native compilers
@@ -140,8 +150,9 @@ public:
FirstConfigure();
~FirstConfigure();
- void setGenerators(const QStringList& gens);
+ void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
QString getGenerator() const;
+ QString getToolset() const;
bool defaultSetup() const;
bool compilerSetup() const;
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 9edbb20..1fcb676 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -15,7 +15,6 @@
#include <QDir>
#include <QCoreApplication>
-#include "cmake.h"
#include "cmState.h"
#include "cmSystemTools.h"
#include "cmExternalMakefileProjectGenerator.h"
@@ -46,21 +45,23 @@ QCMake::QCMake(QObject* p)
cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this);
- std::vector<std::string> generators;
+ std::vector<cmake::GeneratorInfo> generators;
this->CMakeInstance->GetRegisteredGenerators(generators);
- std::vector<std::string>::iterator iter;
- for(iter = generators.begin(); iter != generators.end(); ++iter)
+
+ std::vector<cmake::GeneratorInfo>::const_iterator it;
+ for(it = generators.begin(); it != generators.end(); ++it)
{
// Skip the generator "KDevelop3", since there is also
// "KDevelop3 - Unix Makefiles", which is the full and official name.
// The short name is actually only still there since this was the name
// in CMake 2.4, to keep "command line argument compatibility", but
// this is not necessary in the GUI.
- if (*iter == "KDevelop3")
+ if (it->name == "KDevelop3")
{
continue;
}
- this->AvailableGenerators.append(QString::fromLocal8Bit(iter->c_str()));
+
+ this->AvailableGenerators.push_back(*it);
}
}
@@ -96,6 +97,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
emit this->binaryDirChanged(this->BinaryDirectory);
cmState* state = this->CMakeInstance->GetState();
this->setGenerator(QString());
+ this->setToolset(QString());
if(!this->CMakeInstance->LoadCache(
this->BinaryDirectory.toLocal8Bit().data()))
{
@@ -124,6 +126,12 @@ void QCMake::setBinaryDirectory(const QString& _dir)
CreateFullGeneratorName(gen, extraGen? extraGen : "");
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
}
+
+ const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
+ if (toolset)
+ {
+ this->setToolset(QString::fromLocal8Bit(toolset));
+ }
}
}
@@ -137,6 +145,15 @@ void QCMake::setGenerator(const QString& gen)
}
}
+void QCMake::setToolset(const QString& toolset)
+{
+ if(this->Toolset != toolset)
+ {
+ this->Toolset = toolset;
+ emit this->toolsetChanged(this->Toolset);
+ }
+}
+
void QCMake::configure()
{
#ifdef Q_OS_WIN
@@ -148,7 +165,7 @@ void QCMake::configure()
this->CMakeInstance->SetGlobalGenerator(
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data()));
this->CMakeInstance->SetGeneratorPlatform("");
- this->CMakeInstance->SetGeneratorToolset("");
+ this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data());
this->CMakeInstance->LoadCache();
this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
@@ -396,9 +413,9 @@ QString QCMake::generator() const
return this->Generator;
}
-QStringList QCMake::availableGenerators() const
+std::vector<cmake::GeneratorInfo> const& QCMake::availableGenerators() const
{
- return this->AvailableGenerators;
+ return AvailableGenerators;
}
void QCMake::deleteCache()
@@ -409,6 +426,7 @@ void QCMake::deleteCache()
this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
// emit no generator and no properties
this->setGenerator(QString());
+ this->setToolset(QString());
QCMakePropertyList props = this->properties();
emit this->propertiesChanged(props);
}
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index d910eb7..2d45da9 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -17,6 +17,8 @@
#pragma warning ( disable : 4512 )
#endif
+#include <vector>
+
#include <QObject>
#include <QString>
#include <QVariant>
@@ -25,7 +27,7 @@
#include <QMetaType>
#include <QAtomicInt>
-class cmake;
+#include "cmake.h"
/// struct to represent cmake properties in Qt
/// Value is of type String or Bool
@@ -73,6 +75,8 @@ public slots:
void setBinaryDirectory(const QString& dir);
/// set the desired generator to use
void setGenerator(const QString& generator);
+ /// set the desired generator to use
+ void setToolset(const QString& toolset);
/// do the configure step
void configure();
/// generate the files
@@ -104,7 +108,7 @@ public:
/// get the current generator
QString generator() const;
/// get the available generators
- QStringList availableGenerators() const;
+ std::vector<cmake::GeneratorInfo> const& availableGenerators() const;
/// get whether to do debug output
bool getDebugOutput() const;
@@ -130,6 +134,8 @@ signals:
void errorMessage(const QString& msg);
/// signal when debug output changes
void debugOutputChanged(bool);
+ /// signal when the toolset changes
+ void toolsetChanged(const QString& toolset);
protected:
cmake* CMakeInstance;
@@ -147,7 +153,8 @@ protected:
QString SourceDirectory;
QString BinaryDirectory;
QString Generator;
- QStringList AvailableGenerators;
+ QString Toolset;
+ std::vector<cmake::GeneratorInfo> AvailableGenerators;
QString CMakeExecutable;
QAtomicInt InterruptFlag;
};