forked from qt-creator/qt-creator
Cmake: Let the generator determine the toolchain
Otherwise we need to parse the cbp file, which happens only if the buildconfiguration gets active. Also try to decouple a few internals a little bit by using signals. The CMakeProject still handles a few things directly instead of via signals, more to come eventually.
This commit is contained in:
@@ -110,8 +110,6 @@ QString CMakeBuildConfiguration::buildDirectory() const
|
|||||||
|
|
||||||
QString CMakeBuildConfiguration::buildParser() const
|
QString CMakeBuildConfiguration::buildParser() const
|
||||||
{
|
{
|
||||||
// TODO this is actually slightly wrong, but do i care?
|
|
||||||
// this should call toolchain(configuration)
|
|
||||||
if (!m_toolChain)
|
if (!m_toolChain)
|
||||||
return QString::null;
|
return QString::null;
|
||||||
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|
||||||
@@ -134,22 +132,21 @@ ProjectExplorer::ToolChain::ToolChainType CMakeBuildConfiguration::toolChainType
|
|||||||
|
|
||||||
ProjectExplorer::ToolChain *CMakeBuildConfiguration::toolChain() const
|
ProjectExplorer::ToolChain *CMakeBuildConfiguration::toolChain() const
|
||||||
{
|
{
|
||||||
|
updateToolChain();
|
||||||
return m_toolChain;
|
return m_toolChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildConfiguration::updateToolChain(const QString &compiler)
|
void CMakeBuildConfiguration::updateToolChain() const
|
||||||
{
|
{
|
||||||
//qDebug()<<"CodeBlocks Compilername"<<compiler
|
|
||||||
ProjectExplorer::ToolChain *newToolChain = 0;
|
ProjectExplorer::ToolChain *newToolChain = 0;
|
||||||
if (compiler == "gcc") {
|
if (msvcVersion().isEmpty()) {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
|
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
|
||||||
#else
|
#else
|
||||||
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||||
#endif
|
#endif
|
||||||
} else if (compiler == "msvc8") {
|
} else { // msvc
|
||||||
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(value("msvcVersion").toString(), false);
|
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(value("msvcVersion").toString(), false);
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
||||||
@@ -161,5 +158,26 @@ void CMakeBuildConfiguration::updateToolChain(const QString &compiler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeBuildConfiguration::setBuildDirectory(const QString &buildDirectory)
|
||||||
|
{
|
||||||
|
if (value("buildDirectory") == buildDirectory)
|
||||||
|
return;
|
||||||
|
setValue("buildDirectory", buildDirectory);
|
||||||
|
emit buildDirectoryChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeBuildConfiguration::msvcVersion() const
|
||||||
|
{
|
||||||
|
return value("msvcVersion").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildConfiguration::setMsvcVersion(const QString &msvcVersion)
|
||||||
|
{
|
||||||
|
if (value("msvcVersion").toString() == msvcVersion)
|
||||||
|
return;
|
||||||
|
setValue("msvcVersion", msvcVersion);
|
||||||
|
updateToolChain();
|
||||||
|
|
||||||
|
emit msvcVersionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -61,9 +61,18 @@ public:
|
|||||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||||
ProjectExplorer::ToolChain *toolChain() const;
|
ProjectExplorer::ToolChain *toolChain() const;
|
||||||
|
|
||||||
void updateToolChain(const QString &compiler);
|
|
||||||
|
void setBuildDirectory(const QString &buildDirectory);
|
||||||
|
|
||||||
|
QString msvcVersion() const;
|
||||||
|
void setMsvcVersion(const QString &msvcVersion);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void msvcVersionChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorer::ToolChain *m_toolChain;
|
void updateToolChain() const;
|
||||||
|
mutable ProjectExplorer::ToolChain *m_toolChain;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -52,13 +52,12 @@ CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project)
|
|||||||
m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this, m_clearSystemEnvironmentCheckBox);
|
m_buildEnvironmentWidget = new ProjectExplorer::EnvironmentWidget(this, m_clearSystemEnvironmentCheckBox);
|
||||||
vbox->addWidget(m_buildEnvironmentWidget);
|
vbox->addWidget(m_buildEnvironmentWidget);
|
||||||
|
|
||||||
connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()),
|
connect(m_buildEnvironmentWidget, SIGNAL(userChangesChanged()),
|
||||||
this, SLOT(environmentModelUserChangesUpdated()));
|
this, SLOT(environmentModelUserChangesChanged()));
|
||||||
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
|
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
|
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString CMakeBuildEnvironmentWidget::displayName() const
|
QString CMakeBuildEnvironmentWidget::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Build Environment");
|
return tr("Build Environment");
|
||||||
@@ -77,7 +76,7 @@ void CMakeBuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
|||||||
m_buildEnvironmentWidget->updateButtons();
|
m_buildEnvironmentWidget->updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
|
void CMakeBuildEnvironmentWidget::environmentModelUserChangesChanged()
|
||||||
{
|
{
|
||||||
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,7 @@ public:
|
|||||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void environmentModelUserChangesUpdated();
|
void environmentModelUserChangesChanged();
|
||||||
void clearSystemEnvironmentCheckBoxClicked(bool checked);
|
void clearSystemEnvironmentCheckBoxClicked(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -213,7 +213,8 @@ InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard)
|
|||||||
label->setWordWrap(true);
|
label->setWordWrap(true);
|
||||||
label->setText(tr("Qt Creator has detected an <b>in-source-build in %1</b> "
|
label->setText(tr("Qt Creator has detected an <b>in-source-build in %1</b> "
|
||||||
"which prevents shadow builds. Qt Creator will not allow you to change the build directory. "
|
"which prevents shadow builds. Qt Creator will not allow you to change the build directory. "
|
||||||
"If you want a shadow build, clean your source directory and re-open the project.").arg(m_cmakeWizard->buildDirectory()));
|
"If you want a shadow build, clean your source directory and re-open the project.")
|
||||||
|
.arg(m_cmakeWizard->buildDirectory()));
|
||||||
layout()->addWidget(label);
|
layout()->addWidget(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,12 +382,16 @@ void CMakeRunPage::initializePage()
|
|||||||
m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(msvcVersion), msvcVersion);
|
m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(msvcVersion), msvcVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cachedGenerator == "NMake Makefiles" && !msvcVersions.isEmpty())
|
if (cachedGenerator == "NMake Makefiles" && !msvcVersions.isEmpty()) {
|
||||||
m_generatorComboBox->setCurrentIndex(0);
|
m_generatorComboBox->setCurrentIndex(0);
|
||||||
|
m_cmakeWizard->setMsvcVersion(msvcVersions.first());
|
||||||
|
}
|
||||||
|
|
||||||
m_generatorComboBox->addItem(tr("MinGW Generator"), "mingw");
|
m_generatorComboBox->addItem(tr("MinGW Generator"), "mingw");
|
||||||
if (cachedGenerator == "MinGW Makefiles")
|
if (cachedGenerator == "MinGW Makefiles") {
|
||||||
m_generatorComboBox->setCurrentIndex(m_generatorComboBox->count() - 1);
|
m_generatorComboBox->setCurrentIndex(m_generatorComboBox->count() - 1);
|
||||||
|
m_cmakeWizard->setMsvcVersion("");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// No new enough cmake, simply hide the combo box
|
// No new enough cmake, simply hide the combo box
|
||||||
m_generatorComboBox->setVisible(false);
|
m_generatorComboBox->setVisible(false);
|
||||||
@@ -411,6 +416,8 @@ void CMakeRunPage::runCMake()
|
|||||||
if (version != "mingw") {
|
if (version != "mingw") {
|
||||||
generator = "-GCodeBlocks - NMake Makefiles";
|
generator = "-GCodeBlocks - NMake Makefiles";
|
||||||
m_cmakeWizard->setMsvcVersion(version);
|
m_cmakeWizard->setMsvcVersion(version);
|
||||||
|
} else {
|
||||||
|
m_cmakeWizard->setMsvcVersion("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -104,7 +104,7 @@ BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type)
|
|||||||
&ok);
|
&ok);
|
||||||
if (!ok || buildConfigurationName.isEmpty())
|
if (!ok || buildConfigurationName.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
BuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
||||||
bc->setDisplayName(buildConfigurationName);
|
bc->setDisplayName(buildConfigurationName);
|
||||||
|
|
||||||
MakeStep *makeStep = new MakeStep(bc);
|
MakeStep *makeStep = new MakeStep(bc);
|
||||||
@@ -124,8 +124,8 @@ BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type)
|
|||||||
}
|
}
|
||||||
m_project->addBuildConfiguration(bc); // this also makes the name unique
|
m_project->addBuildConfiguration(bc); // this also makes the name unique
|
||||||
|
|
||||||
bc->setValue("buildDirectory", copw.buildDirectory());
|
bc->setBuildDirectory(copw.buildDirectory());
|
||||||
bc->setValue("msvcVersion", copw.msvcVersion());
|
bc->setMsvcVersion(copw.msvcVersion());
|
||||||
m_project->parseCMakeLists();
|
m_project->parseCMakeLists();
|
||||||
|
|
||||||
// Default to all
|
// Default to all
|
||||||
@@ -155,7 +155,8 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
|||||||
m_fileName(fileName),
|
m_fileName(fileName),
|
||||||
m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this)),
|
m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this)),
|
||||||
m_rootNode(new CMakeProjectNode(m_fileName)),
|
m_rootNode(new CMakeProjectNode(m_fileName)),
|
||||||
m_insideFileChanged(false)
|
m_insideFileChanged(false),
|
||||||
|
m_lastActiveBuildConfiguration(0)
|
||||||
{
|
{
|
||||||
m_file = new CMakeFile(this, fileName);
|
m_file = new CMakeFile(this, fileName);
|
||||||
}
|
}
|
||||||
@@ -177,7 +178,13 @@ IBuildConfigurationFactory *CMakeProject::buildConfigurationFactory() const
|
|||||||
|
|
||||||
void CMakeProject::slotActiveBuildConfiguration()
|
void CMakeProject::slotActiveBuildConfiguration()
|
||||||
{
|
{
|
||||||
BuildConfiguration *activeBC = activeBuildConfiguration();
|
if (m_lastActiveBuildConfiguration)
|
||||||
|
disconnect(m_lastActiveBuildConfiguration, SIGNAL(environmentChanged()),
|
||||||
|
this, SIGNAL(environmentChanged()));
|
||||||
|
|
||||||
|
CMakeBuildConfiguration *activeBC = activeCMakeBuildConfiguration();
|
||||||
|
connect(activeBC, SIGNAL(environmentChanged()),
|
||||||
|
this, SIGNAL(environmentChanged()));
|
||||||
// Pop up a dialog asking the user to rerun cmake
|
// Pop up a dialog asking the user to rerun cmake
|
||||||
QFileInfo sourceFileInfo(m_fileName);
|
QFileInfo sourceFileInfo(m_fileName);
|
||||||
|
|
||||||
@@ -202,10 +209,11 @@ void CMakeProject::slotActiveBuildConfiguration()
|
|||||||
mode,
|
mode,
|
||||||
activeBC->environment());
|
activeBC->environment());
|
||||||
copw.exec();
|
copw.exec();
|
||||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
activeBC->setMsvcVersion(copw.msvcVersion());
|
||||||
}
|
}
|
||||||
// reparse
|
// reparse
|
||||||
parseCMakeLists();
|
parseCMakeLists();
|
||||||
|
emit environmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeProject::fileChanged(const QString &fileName)
|
void CMakeProject::fileChanged(const QString &fileName)
|
||||||
@@ -218,9 +226,9 @@ void CMakeProject::fileChanged(const QString &fileName)
|
|||||||
m_insideFileChanged = false;
|
m_insideFileChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeProject::changeBuildDirectory(BuildConfiguration *configuration, const QString &newBuildDirectory)
|
void CMakeProject::changeBuildDirectory(CMakeBuildConfiguration *bc, const QString &newBuildDirectory)
|
||||||
{
|
{
|
||||||
configuration->setValue("buildDirectory", newBuildDirectory);
|
bc->setBuildDirectory(newBuildDirectory);
|
||||||
parseCMakeLists();
|
parseCMakeLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,16 +250,14 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
//qDebug()<<"Parsing file "<<cbpFile;
|
//qDebug()<<"Parsing file "<<cbpFile;
|
||||||
if (cbpparser.parseCbpFile(cbpFile)) {
|
if (cbpparser.parseCbpFile(cbpFile)) {
|
||||||
// ToolChain
|
// ToolChain
|
||||||
activeBC->updateToolChain(cbpparser.compilerName());
|
// activeBC->updateToolChain(cbpparser.compilerName());
|
||||||
|
|
||||||
m_projectName = cbpparser.projectName();
|
m_projectName = cbpparser.projectName();
|
||||||
m_rootNode->setFolderName(cbpparser.projectName());
|
m_rootNode->setFolderName(cbpparser.projectName());
|
||||||
|
|
||||||
//qDebug()<<"Building Tree";
|
//qDebug()<<"Building Tree";
|
||||||
|
|
||||||
|
|
||||||
QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList();
|
QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList();
|
||||||
|
|
||||||
QSet<QString> projectFiles;
|
QSet<QString> projectFiles;
|
||||||
if (cbpparser.hasCMakeFiles()) {
|
if (cbpparser.hasCMakeFiles()) {
|
||||||
fileList.append(cbpparser.cmakeFileList());
|
fileList.append(cbpparser.cmakeFileList());
|
||||||
@@ -264,7 +270,6 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
projectFiles.insert(cmakeListTxt);
|
projectFiles.insert(cmakeListTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QSet<QString> added = projectFiles;
|
QSet<QString> added = projectFiles;
|
||||||
added.subtract(m_watchedFiles);
|
added.subtract(m_watchedFiles);
|
||||||
foreach(const QString &add, added)
|
foreach(const QString &add, added)
|
||||||
@@ -280,7 +285,6 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
|
|
||||||
buildTree(m_rootNode, fileList);
|
buildTree(m_rootNode, fileList);
|
||||||
|
|
||||||
|
|
||||||
//qDebug()<<"Adding Targets";
|
//qDebug()<<"Adding Targets";
|
||||||
m_targets = cbpparser.targets();
|
m_targets = cbpparser.targets();
|
||||||
// qDebug()<<"Printing targets";
|
// qDebug()<<"Printing targets";
|
||||||
@@ -306,7 +310,8 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
allIncludePaths.append(sourceDirectory());
|
allIncludePaths.append(sourceDirectory());
|
||||||
|
|
||||||
allIncludePaths.append(cbpparser.includeFiles());
|
allIncludePaths.append(cbpparser.includeFiles());
|
||||||
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
CppTools::CppModelManagerInterface *modelmanager =
|
||||||
|
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
||||||
if (modelmanager) {
|
if (modelmanager) {
|
||||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
if (pinfo.includePaths != allIncludePaths
|
if (pinfo.includePaths != allIncludePaths
|
||||||
@@ -374,9 +379,11 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
} else {
|
} else {
|
||||||
// TODO report error
|
// TODO report error
|
||||||
qDebug()<<"Parsing failed";
|
qDebug()<<"Parsing failed";
|
||||||
activeBC->updateToolChain(QString::null);
|
// activeBC->updateToolChain(QString::null);
|
||||||
|
emit targetsChanged();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
emit targetsChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,6 +622,11 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
|||||||
if (!hasUserFile && targets().contains("all"))
|
if (!hasUserFile && targets().contains("all"))
|
||||||
makeStep->setBuildTarget("all", true);
|
makeStep->setBuildTarget("all", true);
|
||||||
|
|
||||||
|
m_lastActiveBuildConfiguration = activeCMakeBuildConfiguration();
|
||||||
|
if (m_lastActiveBuildConfiguration)
|
||||||
|
connect(m_lastActiveBuildConfiguration, SIGNAL(environmentChanged()),
|
||||||
|
this, SIGNAL(environmentChanged()));
|
||||||
|
|
||||||
connect(this, SIGNAL(activeBuildConfigurationChanged()),
|
connect(this, SIGNAL(activeBuildConfigurationChanged()),
|
||||||
this, SLOT(slotActiveBuildConfiguration()));
|
this, SLOT(slotActiveBuildConfiguration()));
|
||||||
return true;
|
return true;
|
||||||
@@ -694,10 +706,6 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeProject *project)
|
|||||||
setLayout(fl);
|
setLayout(fl);
|
||||||
m_pathLineEdit = new QLineEdit(this);
|
m_pathLineEdit = new QLineEdit(this);
|
||||||
m_pathLineEdit->setReadOnly(true);
|
m_pathLineEdit->setReadOnly(true);
|
||||||
// TODO currently doesn't work
|
|
||||||
// since creating the cbp file also creates makefiles
|
|
||||||
// and then cmake builds in that directory instead of shadow building
|
|
||||||
// We need our own generator for that to work
|
|
||||||
|
|
||||||
QHBoxLayout *hbox = new QHBoxLayout();
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
hbox->addWidget(m_pathLineEdit);
|
hbox->addWidget(m_pathLineEdit);
|
||||||
|
@@ -114,12 +114,19 @@ public:
|
|||||||
|
|
||||||
QString sourceDirectory() const;
|
QString sourceDirectory() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/// convenience signal emitted if the activeBuildConfiguration emits environmentChanged
|
||||||
|
/// or if the activeBuildConfiguration changes
|
||||||
|
void environmentChanged();
|
||||||
|
/// emitted after parsing
|
||||||
|
void targetsChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||||
virtual bool restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader);
|
virtual bool restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader);
|
||||||
|
|
||||||
// called by CMakeBuildSettingsWidget
|
// called by CMakeBuildSettingsWidget
|
||||||
void changeBuildDirectory(ProjectExplorer::BuildConfiguration *configuration, const QString &newBuildDirectory);
|
void changeBuildDirectory(CMakeBuildConfiguration *bc, const QString &newBuildDirectory);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fileChanged(const QString &fileName);
|
void fileChanged(const QString &fileName);
|
||||||
@@ -145,6 +152,7 @@ private:
|
|||||||
ProjectExplorer::FileWatcher *m_watcher;
|
ProjectExplorer::FileWatcher *m_watcher;
|
||||||
bool m_insideFileChanged;
|
bool m_insideFileChanged;
|
||||||
QSet<QString> m_watchedFiles;
|
QSet<QString> m_watchedFiles;
|
||||||
|
CMakeBuildConfiguration *m_lastActiveBuildConfiguration;
|
||||||
|
|
||||||
friend class CMakeBuildConfigurationFactory; // for parseCMakeLists
|
friend class CMakeBuildConfigurationFactory; // for parseCMakeLists
|
||||||
};
|
};
|
||||||
|
@@ -56,12 +56,8 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &t
|
|||||||
{
|
{
|
||||||
setName(title);
|
setName(title);
|
||||||
|
|
||||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
connect(pro, SIGNAL(environmentChanged()),
|
||||||
this, SIGNAL(baseEnvironmentChanged()));
|
this, SIGNAL(baseEnvironmentChanged()));
|
||||||
|
|
||||||
// TODO
|
|
||||||
// connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
|
||||||
// this, SIGNAL(baseEnvironmentChanged()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeRunConfiguration::~CMakeRunConfiguration()
|
CMakeRunConfiguration::~CMakeRunConfiguration()
|
||||||
@@ -317,8 +313,8 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
|
|||||||
connect(resetButton, SIGNAL(clicked()),
|
connect(resetButton, SIGNAL(clicked()),
|
||||||
this, SLOT(resetWorkingDirectory()));
|
this, SLOT(resetWorkingDirectory()));
|
||||||
|
|
||||||
connect(m_environmentWidget, SIGNAL(userChangesUpdated()),
|
connect(m_environmentWidget, SIGNAL(userChangesChanged()),
|
||||||
this, SLOT(userChangesUpdated()));
|
this, SLOT(userChangesChanged()));
|
||||||
|
|
||||||
connect(m_cmakeRunConfiguration, SIGNAL(workingDirectoryChanged(QString)),
|
connect(m_cmakeRunConfiguration, SIGNAL(workingDirectoryChanged(QString)),
|
||||||
this, SLOT(workingDirectoryChanged(QString)));
|
this, SLOT(workingDirectoryChanged(QString)));
|
||||||
@@ -351,7 +347,7 @@ void CMakeRunConfigurationWidget::resetWorkingDirectory()
|
|||||||
m_cmakeRunConfiguration->setUserWorkingDirectory("");
|
m_cmakeRunConfiguration->setUserWorkingDirectory("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeRunConfigurationWidget::userChangesUpdated()
|
void CMakeRunConfigurationWidget::userChangesChanged()
|
||||||
{
|
{
|
||||||
m_cmakeRunConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
|
m_cmakeRunConfiguration->setUserEnvironmentChanges(m_environmentWidget->userChanges());
|
||||||
}
|
}
|
||||||
|
@@ -112,7 +112,7 @@ private slots:
|
|||||||
void setArguments(const QString &args);
|
void setArguments(const QString &args);
|
||||||
void baseEnvironmentChanged();
|
void baseEnvironmentChanged();
|
||||||
void userEnvironmentChangesChanged();
|
void userEnvironmentChangesChanged();
|
||||||
void userChangesUpdated();
|
void userChangesChanged();
|
||||||
void setWorkingDirectory();
|
void setWorkingDirectory();
|
||||||
void resetWorkingDirectory();
|
void resetWorkingDirectory();
|
||||||
private slots:
|
private slots:
|
||||||
|
@@ -217,6 +217,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
|||||||
connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
||||||
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
||||||
this, SLOT(updateDetails()));
|
this, SLOT(updateDetails()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeStepConfigWidget::additionalArgumentsEdited()
|
void MakeStepConfigWidget::additionalArgumentsEdited()
|
||||||
@@ -250,6 +251,24 @@ void MakeStepConfigWidget::init()
|
|||||||
|
|
||||||
m_additionalArguments->setText(Environment::joinArgumentList(m_makeStep->additionalArguments()));
|
m_additionalArguments->setText(Environment::joinArgumentList(m_makeStep->additionalArguments()));
|
||||||
updateDetails();
|
updateDetails();
|
||||||
|
|
||||||
|
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeProject();
|
||||||
|
connect(pro, SIGNAL(targetsChanged()),
|
||||||
|
this, SLOT(targetsChanged()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeStepConfigWidget::targetsChanged()
|
||||||
|
{
|
||||||
|
disconnect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
||||||
|
m_targetsList->clear();
|
||||||
|
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeProject();
|
||||||
|
foreach(const QString& target, pro->targets()) {
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(target, m_targetsList);
|
||||||
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||||
|
item->setCheckState(m_makeStep->buildsTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
}
|
||||||
|
connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
||||||
|
updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeStepConfigWidget::updateDetails()
|
void MakeStepConfigWidget::updateDetails()
|
||||||
|
@@ -98,6 +98,7 @@ private slots:
|
|||||||
void itemChanged(QListWidgetItem*);
|
void itemChanged(QListWidgetItem*);
|
||||||
void additionalArgumentsEdited();
|
void additionalArgumentsEdited();
|
||||||
void updateDetails();
|
void updateDetails();
|
||||||
|
void targetsChanged();
|
||||||
private:
|
private:
|
||||||
MakeStep *m_makeStep;
|
MakeStep *m_makeStep;
|
||||||
QListWidget *m_targetsList;
|
QListWidget *m_targetsList;
|
||||||
|
Reference in New Issue
Block a user