forked from qt-creator/qt-creator
Cmake: Add a "Reconfigure project" to the Project Page
This commit is contained in:
@@ -105,10 +105,15 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
|
|||||||
m_creatingCbpFiles(true),
|
m_creatingCbpFiles(true),
|
||||||
m_environment(env)
|
m_environment(env)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CMakeRunPage::Mode rmode;
|
||||||
if (mode == CMakeOpenProjectWizard::NeedToCreate)
|
if (mode == CMakeOpenProjectWizard::NeedToCreate)
|
||||||
addPage(new CMakeRunPage(this, CMakeRunPage::Recreate, buildDirectory));
|
rmode = CMakeRunPage::Recreate;
|
||||||
|
else if (mode == CMakeOpenProjectWizard::WantToUpdate)
|
||||||
|
rmode = CMakeRunPage::WantToUpdate;
|
||||||
else
|
else
|
||||||
addPage(new CMakeRunPage(this, CMakeRunPage::Update, buildDirectory));
|
rmode = CMakeRunPage::NeedToUpdate;
|
||||||
|
addPage(new CMakeRunPage(this, rmode, buildDirectory));
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +127,7 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
|
|||||||
{
|
{
|
||||||
m_buildDirectory = oldBuildDirectory;
|
m_buildDirectory = oldBuildDirectory;
|
||||||
addPage(new ShadowBuildPage(this, true));
|
addPage(new ShadowBuildPage(this, true));
|
||||||
addPage(new CMakeRunPage(this, CMakeRunPage::Change));
|
addPage(new CMakeRunPage(this, CMakeRunPage::ChangeDirectory));
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +347,7 @@ void CMakeRunPage::initializePage()
|
|||||||
tr("The directory %1 does not contain a cbp file. Qt Creator needs to create this file by running cmake. "
|
tr("The directory %1 does not contain a cbp file. Qt Creator needs to create this file by running cmake. "
|
||||||
"Some projects require command line arguments to the initial cmake call.").arg(m_buildDirectory));
|
"Some projects require command line arguments to the initial cmake call.").arg(m_buildDirectory));
|
||||||
}
|
}
|
||||||
} else if (m_mode == CMakeRunPage::Update) {
|
} else if (m_mode == CMakeRunPage::NeedToUpdate) {
|
||||||
m_descriptionLabel->setText(tr("The directory %1 contains an outdated .cbp file. Qt "
|
m_descriptionLabel->setText(tr("The directory %1 contains an outdated .cbp file. Qt "
|
||||||
"Creator needs to update this file by running cmake. "
|
"Creator needs to update this file by running cmake. "
|
||||||
"If you want to add additional command line arguments, "
|
"If you want to add additional command line arguments, "
|
||||||
@@ -355,11 +360,13 @@ void CMakeRunPage::initializePage()
|
|||||||
"Some projects require command line arguments to "
|
"Some projects require command line arguments to "
|
||||||
"the initial cmake call. Note that cmake remembers command "
|
"the initial cmake call. Note that cmake remembers command "
|
||||||
"line arguments from the previous runs.").arg(m_buildDirectory));
|
"line arguments from the previous runs.").arg(m_buildDirectory));
|
||||||
} else if(m_mode == CMakeRunPage::Change) {
|
} else if(m_mode == CMakeRunPage::ChangeDirectory) {
|
||||||
m_buildDirectory = m_cmakeWizard->buildDirectory();
|
m_buildDirectory = m_cmakeWizard->buildDirectory();
|
||||||
m_descriptionLabel->setText(tr("Qt Creator needs to run cmake in the new build directory. "
|
m_descriptionLabel->setText(tr("Qt Creator needs to run cmake in the new build directory. "
|
||||||
"Some projects require command line arguments to the "
|
"Some projects require command line arguments to the "
|
||||||
"initial cmake call."));
|
"initial cmake call."));
|
||||||
|
} else if (m_mode == CMakeRunPage::WantToUpdate) {
|
||||||
|
m_descriptionLabel->setText(tr("Refreshing cbp file in %1.").arg(m_buildDirectory));
|
||||||
}
|
}
|
||||||
if (m_cmakeWizard->cmakeManager()->hasCodeBlocksMsvcGenerator()) {
|
if (m_cmakeWizard->cmakeManager()->hasCodeBlocksMsvcGenerator()) {
|
||||||
m_generatorComboBox->setVisible(true);
|
m_generatorComboBox->setVisible(true);
|
||||||
|
@@ -62,14 +62,18 @@ public:
|
|||||||
enum Mode {
|
enum Mode {
|
||||||
Nothing,
|
Nothing,
|
||||||
NeedToCreate,
|
NeedToCreate,
|
||||||
NeedToUpdate
|
NeedToUpdate,
|
||||||
|
WantToUpdate
|
||||||
};
|
};
|
||||||
|
|
||||||
// used at importing a project without a .user file
|
// used at importing a project without a .user file
|
||||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const ProjectExplorer::Environment &env);
|
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const ProjectExplorer::Environment &env);
|
||||||
// used to update if we have already a .user file
|
/// used to update if we have already a .user file
|
||||||
|
/// recreates or updates the cbp file
|
||||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &buildDirectory, Mode mode, const ProjectExplorer::Environment &env);
|
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &buildDirectory, Mode mode, const ProjectExplorer::Environment &env);
|
||||||
// used to change the build directory of one buildconfiguration
|
/// used to change the build directory of one buildconfiguration
|
||||||
|
/// shows a page for selecting a directory
|
||||||
|
/// then the run cmake page
|
||||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory, const ProjectExplorer::Environment &env);
|
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory, const ProjectExplorer::Environment &env);
|
||||||
|
|
||||||
virtual int nextId() const;
|
virtual int nextId() const;
|
||||||
@@ -120,7 +124,7 @@ class CMakeRunPage : public QWizardPage
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum Mode { Initial, Update, Recreate, Change };
|
enum Mode { Initial, NeedToUpdate, Recreate, ChangeDirectory, WantToUpdate };
|
||||||
explicit CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, Mode mode = Initial, const QString &buildDirectory = QString());
|
explicit CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, Mode mode = Initial, const QString &buildDirectory = QString());
|
||||||
|
|
||||||
virtual void initializePage();
|
virtual void initializePage();
|
||||||
|
@@ -623,6 +623,13 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeProject *project)
|
|||||||
fl->setContentsMargins(20, -1, 0, -1);
|
fl->setContentsMargins(20, -1, 0, -1);
|
||||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
setLayout(fl);
|
setLayout(fl);
|
||||||
|
|
||||||
|
// TODO add action to Build menu?
|
||||||
|
QPushButton *runCmakeButton = new QPushButton("Run cmake");
|
||||||
|
connect(runCmakeButton, SIGNAL(clicked()),
|
||||||
|
this, SLOT(runCMake()));
|
||||||
|
fl->addRow(tr("Reconfigure project:"), runCmakeButton);
|
||||||
|
|
||||||
m_pathLineEdit = new QLineEdit(this);
|
m_pathLineEdit = new QLineEdit(this);
|
||||||
m_pathLineEdit->setReadOnly(true);
|
m_pathLineEdit->setReadOnly(true);
|
||||||
|
|
||||||
@@ -664,6 +671,19 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeBuildSettingsWidget::runCMake()
|
||||||
|
{
|
||||||
|
// TODO skip build directory
|
||||||
|
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||||
|
m_project->projectDirectory(),
|
||||||
|
m_buildConfiguration->buildDirectory(),
|
||||||
|
CMakeOpenProjectWizard::WantToUpdate,
|
||||||
|
m_buildConfiguration->environment());
|
||||||
|
if (copw.exec() == QDialog::Accepted) {
|
||||||
|
m_project->parseCMakeLists();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/////
|
/////
|
||||||
// CMakeCbpParser
|
// CMakeCbpParser
|
||||||
////
|
////
|
||||||
|
@@ -215,6 +215,7 @@ public:
|
|||||||
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||||
private slots:
|
private slots:
|
||||||
void openChangeBuildDirectoryDialog();
|
void openChangeBuildDirectoryDialog();
|
||||||
|
void runCMake();
|
||||||
private:
|
private:
|
||||||
CMakeProject *m_project;
|
CMakeProject *m_project;
|
||||||
QLineEdit *m_pathLineEdit;
|
QLineEdit *m_pathLineEdit;
|
||||||
|
Reference in New Issue
Block a user