forked from qt-creator/qt-creator
Move most of the BuildConfiguration specific functions
Note: I didn't fix all the connects and there are a few missing things. This compiles, more work is coming.
This commit is contained in:
@@ -29,19 +29,132 @@
|
||||
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakeproject.h"
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace Internal;
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *pro)
|
||||
: BuildConfiguration(pro)
|
||||
: BuildConfiguration(pro), m_toolChain(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(BuildConfiguration *source)
|
||||
: BuildConfiguration(source)
|
||||
: BuildConfiguration(source), m_toolChain(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
||||
{
|
||||
delete m_toolChain;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeBuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
ProjectExplorer::Environment env = useSystemEnvironment() ?
|
||||
ProjectExplorer::Environment(QProcess::systemEnvironment()) :
|
||||
ProjectExplorer::Environment();
|
||||
return env;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeBuildConfiguration::environment() const
|
||||
{
|
||||
ProjectExplorer::Environment env = baseEnvironment();
|
||||
env.modify(userEnvironmentChanges());
|
||||
return env;
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setUseSystemEnvironment(bool b)
|
||||
{
|
||||
if (b == useSystemEnvironment())
|
||||
return;
|
||||
setValue("clearSystemEnvironment", !b);
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
bool CMakeBuildConfiguration::useSystemEnvironment() const
|
||||
{
|
||||
bool b = !(value("clearSystemEnvironment").isValid() &&
|
||||
value("clearSystemEnvironment").toBool());
|
||||
return b;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::EnvironmentItem> CMakeBuildConfiguration::userEnvironmentChanges() const
|
||||
{
|
||||
return ProjectExplorer::EnvironmentItem::fromStringList(value("userEnvironmentChanges").toStringList());
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||
{
|
||||
QStringList list = ProjectExplorer::EnvironmentItem::toStringList(diff);
|
||||
if (list == value("userEnvironmentChanges"))
|
||||
return;
|
||||
setValue("userEnvironmentChanges", list);
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::buildDirectory() const
|
||||
{
|
||||
QString buildDirectory = value("buildDirectory").toString();
|
||||
if (buildDirectory.isEmpty())
|
||||
buildDirectory = static_cast<CMakeProject *>(project())->sourceDirectory() + "/qtcreator-build";
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::buildParser() const
|
||||
{
|
||||
// TODO this is actually slightly wrong, but do i care?
|
||||
// this should call toolchain(configuration)
|
||||
if (!m_toolChain)
|
||||
return QString::null;
|
||||
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|
||||
//|| m_toolChain->type() == ProjectExplorer::ToolChain::LinuxICC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::MinGW) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_GCC;
|
||||
} else if (m_toolChain->type() == ProjectExplorer::ToolChain::MSVC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::WINCE) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_MSVC;
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeBuildConfiguration::toolChainType() const
|
||||
{
|
||||
if (m_toolChain)
|
||||
return m_toolChain->type();
|
||||
return ProjectExplorer::ToolChain::UNKNOWN;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *CMakeBuildConfiguration::toolChain() const
|
||||
{
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::updateToolChain(const QString &compiler)
|
||||
{
|
||||
//qDebug()<<"CodeBlocks Compilername"<<compiler
|
||||
ProjectExplorer::ToolChain *newToolChain = 0;
|
||||
if (compiler == "gcc") {
|
||||
#ifdef Q_OS_WIN
|
||||
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
|
||||
#else
|
||||
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||
#endif
|
||||
} else if (compiler == "msvc8") {
|
||||
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(value("msvcVersion").toString(), false);
|
||||
} else {
|
||||
}
|
||||
|
||||
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
||||
delete newToolChain;
|
||||
newToolChain = 0;
|
||||
} else {
|
||||
delete m_toolChain;
|
||||
m_toolChain = newToolChain;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define CMAKEBUILDCONFIGURATION_H
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
@@ -43,6 +44,24 @@ class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
public:
|
||||
CMakeBuildConfiguration(CMakeProject *pro);
|
||||
CMakeBuildConfiguration(BuildConfiguration *source);
|
||||
~CMakeBuildConfiguration();
|
||||
|
||||
ProjectExplorer::Environment environment() const;
|
||||
ProjectExplorer::Environment baseEnvironment() const;
|
||||
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff);
|
||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const;
|
||||
bool useSystemEnvironment() const;
|
||||
void setUseSystemEnvironment(bool b);
|
||||
|
||||
virtual QString buildDirectory() const;
|
||||
QString buildParser() const;
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
ProjectExplorer::ToolChain *toolChain() const;
|
||||
|
||||
void updateToolChain(const QString &compiler);
|
||||
private:
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "cmakebuildenvironmentwidget.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include <projectexplorer/environmenteditmodel.h>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QCheckBox>
|
||||
@@ -68,21 +69,21 @@ void CMakeBuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
||||
if (debug)
|
||||
qDebug() << "Qt4BuildConfigWidget::init()";
|
||||
|
||||
m_buildConfiguration = bc;
|
||||
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||
|
||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(m_buildConfiguration));
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(m_buildConfiguration));
|
||||
m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(m_buildConfiguration));
|
||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||
m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
|
||||
m_buildEnvironmentWidget->updateButtons();
|
||||
}
|
||||
|
||||
void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
|
||||
{
|
||||
m_pro->setUserEnvironmentChanges(m_buildConfiguration, m_buildEnvironmentWidget->userChanges());
|
||||
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
||||
}
|
||||
|
||||
void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
||||
{
|
||||
m_pro->setUseSystemEnvironment(m_buildConfiguration, !checked);
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(m_buildConfiguration));
|
||||
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ class EnvironmentWidget;
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
class CMakeProject;
|
||||
class CMakeBuildConfiguration;
|
||||
|
||||
class CMakeBuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
|
||||
{
|
||||
@@ -61,7 +62,7 @@ private:
|
||||
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
||||
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
||||
CMakeProject *m_pro;
|
||||
ProjectExplorer::BuildConfiguration *m_buildConfiguration;
|
||||
CMakeBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -116,8 +116,8 @@ BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type)
|
||||
|
||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||
m_project->sourceDirectory(),
|
||||
m_project->buildDirectory(bc),
|
||||
m_project->environment(bc));
|
||||
bc->buildDirectory(),
|
||||
bc->environment());
|
||||
if (copw.exec() != QDialog::Accepted) {
|
||||
delete bc;
|
||||
return false;
|
||||
@@ -156,7 +156,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
m_fileName(fileName),
|
||||
m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this)),
|
||||
m_rootNode(new CMakeProjectNode(m_fileName)),
|
||||
m_toolChain(0),
|
||||
m_insideFileChanged(false)
|
||||
{
|
||||
m_file = new CMakeFile(this, fileName);
|
||||
@@ -165,7 +164,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
CMakeProject::~CMakeProject()
|
||||
{
|
||||
delete m_rootNode;
|
||||
delete m_toolChain;
|
||||
}
|
||||
|
||||
IBuildConfigurationFactory *CMakeProject::buildConfigurationFactory() const
|
||||
@@ -179,7 +177,7 @@ void CMakeProject::slotActiveBuildConfiguration()
|
||||
// Pop up a dialog asking the user to rerun cmake
|
||||
QFileInfo sourceFileInfo(m_fileName);
|
||||
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC)));
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||
if (!cbpFileFi.exists()) {
|
||||
@@ -196,9 +194,9 @@ void CMakeProject::slotActiveBuildConfiguration()
|
||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||
CMakeOpenProjectWizard copw(m_manager,
|
||||
sourceFileInfo.absolutePath(),
|
||||
buildDirectory(activeBC),
|
||||
activeBC->buildDirectory(),
|
||||
mode,
|
||||
environment(activeBC));
|
||||
activeBC->environment());
|
||||
copw.exec();
|
||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||
}
|
||||
@@ -216,39 +214,6 @@ void CMakeProject::fileChanged(const QString &fileName)
|
||||
m_insideFileChanged = false;
|
||||
}
|
||||
|
||||
void CMakeProject::updateToolChain(const QString &compiler)
|
||||
{
|
||||
//qDebug()<<"CodeBlocks Compilername"<<compiler
|
||||
ProjectExplorer::ToolChain *newToolChain = 0;
|
||||
if (compiler == "gcc") {
|
||||
#ifdef Q_OS_WIN
|
||||
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
|
||||
#else
|
||||
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||
#endif
|
||||
} else if (compiler == "msvc8") {
|
||||
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(activeBuildConfiguration()->value("msvcVersion").toString(), false);
|
||||
} else {
|
||||
// TODO other toolchains
|
||||
qDebug()<<"Not implemented yet!!! Qt Creator doesn't know which toolchain to use for"<<compiler;
|
||||
}
|
||||
|
||||
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
||||
delete newToolChain;
|
||||
newToolChain = 0;
|
||||
} else {
|
||||
delete m_toolChain;
|
||||
m_toolChain = newToolChain;
|
||||
}
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *CMakeProject::toolChain(BuildConfiguration *configuration) const
|
||||
{
|
||||
if (configuration != activeBuildConfiguration())
|
||||
qWarning()<<"CMakeProject asked for toolchain of a not active buildconfiguration";
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
void CMakeProject::changeBuildDirectory(BuildConfiguration *configuration, const QString &newBuildDirectory)
|
||||
{
|
||||
configuration->setValue("buildDirectory", newBuildDirectory);
|
||||
@@ -263,7 +228,8 @@ QString CMakeProject::sourceDirectory() const
|
||||
bool CMakeProject::parseCMakeLists()
|
||||
{
|
||||
// Find cbp file
|
||||
QString cbpFile = CMakeManager::findCbpFile(buildDirectory(activeBuildConfiguration()));
|
||||
CMakeBuildConfiguration *activeCmakeBuildConfiguration = static_cast<CMakeBuildConfiguration *>(activeBuildConfiguration());
|
||||
QString cbpFile = CMakeManager::findCbpFile(activeCmakeBuildConfiguration->buildDirectory());
|
||||
|
||||
// setFolderName
|
||||
m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName());
|
||||
@@ -272,7 +238,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
//qDebug()<<"Parsing file "<<cbpFile;
|
||||
if (cbpparser.parseCbpFile(cbpFile)) {
|
||||
// ToolChain
|
||||
updateToolChain(cbpparser.compilerName());
|
||||
activeCmakeBuildConfiguration->updateToolChain(cbpparser.compilerName());
|
||||
|
||||
m_projectName = cbpparser.projectName();
|
||||
m_rootNode->setFolderName(cbpparser.projectName());
|
||||
@@ -325,7 +291,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
QStringList allIncludePaths;
|
||||
QStringList allFrameworkPaths;
|
||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths = m_toolChain->systemHeaderPaths();
|
||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths = activeCmakeBuildConfiguration->toolChain()->systemHeaderPaths();
|
||||
foreach (ProjectExplorer::HeaderPath headerPath, allHeaderPaths) {
|
||||
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
||||
allFrameworkPaths.append(headerPath.path());
|
||||
@@ -341,12 +307,12 @@ bool CMakeProject::parseCMakeLists()
|
||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||
if (pinfo.includePaths != allIncludePaths
|
||||
|| pinfo.sourceFiles != m_files
|
||||
|| pinfo.defines != m_toolChain->predefinedMacros()
|
||||
|| pinfo.defines != activeCmakeBuildConfiguration->toolChain()->predefinedMacros()
|
||||
|| pinfo.frameworkPaths != allFrameworkPaths) {
|
||||
pinfo.includePaths = allIncludePaths;
|
||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||
pinfo.sourceFiles = m_files;
|
||||
pinfo.defines = m_toolChain->predefinedMacros(); // TODO this is to simplistic
|
||||
pinfo.defines = activeCmakeBuildConfiguration->toolChain()->predefinedMacros(); // TODO this is to simplistic
|
||||
pinfo.frameworkPaths = allFrameworkPaths;
|
||||
modelmanager->updateProjectInfo(pinfo);
|
||||
modelmanager->updateSourceFiles(pinfo.sourceFiles);
|
||||
@@ -404,31 +370,12 @@ bool CMakeProject::parseCMakeLists()
|
||||
} else {
|
||||
// TODO report error
|
||||
qDebug()<<"Parsing failed";
|
||||
delete m_toolChain;
|
||||
m_toolChain = 0;
|
||||
activeCmakeBuildConfiguration->updateToolChain(QString::null);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString CMakeProject::buildParser(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
// TODO this is actually slightly wrong, but do i care?
|
||||
// this should call toolchain(configuration)
|
||||
if (!m_toolChain)
|
||||
return QString::null;
|
||||
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|
||||
//|| m_toolChain->type() == ProjectExplorer::ToolChain::LinuxICC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::MinGW) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_GCC;
|
||||
} else if (m_toolChain->type() == ProjectExplorer::ToolChain::MSVC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::WINCE) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_MSVC;
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
QStringList CMakeProject::targets() const
|
||||
{
|
||||
QStringList results;
|
||||
@@ -551,8 +498,6 @@ QString CMakeProject::name() const
|
||||
return m_projectName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Core::IFile *CMakeProject::file() const
|
||||
{
|
||||
return m_file;
|
||||
@@ -573,56 +518,6 @@ bool CMakeProject::isApplication() const
|
||||
return true;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeProject::baseEnvironment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Environment env = useSystemEnvironment(configuration) ? Environment(QProcess::systemEnvironment()) : Environment();
|
||||
return env;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeProject::environment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Environment env = baseEnvironment(configuration);
|
||||
env.modify(userEnvironmentChanges(configuration));
|
||||
return env;
|
||||
}
|
||||
|
||||
void CMakeProject::setUseSystemEnvironment(BuildConfiguration *configuration, bool b)
|
||||
{
|
||||
if (b == useSystemEnvironment(configuration))
|
||||
return;
|
||||
configuration->setValue("clearSystemEnvironment", !b);
|
||||
emit environmentChanged(configuration);
|
||||
}
|
||||
|
||||
bool CMakeProject::useSystemEnvironment(BuildConfiguration *configuration) const
|
||||
{
|
||||
bool b = !(configuration->value("clearSystemEnvironment").isValid() &&
|
||||
configuration->value("clearSystemEnvironment").toBool());
|
||||
return b;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::EnvironmentItem> CMakeProject::userEnvironmentChanges(BuildConfiguration *configuration) const
|
||||
{
|
||||
return EnvironmentItem::fromStringList(configuration->value("userEnvironmentChanges").toStringList());
|
||||
}
|
||||
|
||||
void CMakeProject::setUserEnvironmentChanges(BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||
{
|
||||
QStringList list = EnvironmentItem::toStringList(diff);
|
||||
if (list == configuration->value("userEnvironmentChanges"))
|
||||
return;
|
||||
configuration->setValue("userEnvironmentChanges", list);
|
||||
emit environmentChanged(configuration);
|
||||
}
|
||||
|
||||
QString CMakeProject::buildDirectory(BuildConfiguration *configuration) const
|
||||
{
|
||||
QString buildDirectory = configuration->value("buildDirectory").toString();
|
||||
if (buildDirectory.isEmpty())
|
||||
buildDirectory = sourceDirectory() + "/qtcreator-build";
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *CMakeProject::createConfigWidget()
|
||||
{
|
||||
return new CMakeBuildSettingsWidget(this);
|
||||
@@ -686,7 +581,7 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
// or simply run createXml with the saved settings
|
||||
QFileInfo sourceFileInfo(m_fileName);
|
||||
BuildConfiguration *activeBC = activeBuildConfiguration();
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC)));
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
|
||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||
@@ -698,9 +593,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||
CMakeOpenProjectWizard copw(m_manager,
|
||||
sourceFileInfo.absolutePath(),
|
||||
buildDirectory(activeBC),
|
||||
activeBC->buildDirectory(),
|
||||
mode,
|
||||
environment(activeBC));
|
||||
activeBC->environment());
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||
@@ -729,13 +624,6 @@ CMakeTarget CMakeProject::targetForTitle(const QString &title)
|
||||
return CMakeTarget();
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeProject::toolChainType() const
|
||||
{
|
||||
if (m_toolChain)
|
||||
return m_toolChain->type();
|
||||
return ProjectExplorer::ToolChain::UNKNOWN;
|
||||
}
|
||||
|
||||
// CMakeFile
|
||||
|
||||
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
|
||||
@@ -825,9 +713,9 @@ QString CMakeBuildSettingsWidget::displayName() const
|
||||
|
||||
void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = bc;
|
||||
m_pathLineEdit->setText(m_project->buildDirectory(bc));
|
||||
if (m_project->buildDirectory(bc) == m_project->sourceDirectory())
|
||||
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||
if (m_buildConfiguration->buildDirectory() == m_project->sourceDirectory())
|
||||
m_changeButton->setEnabled(false);
|
||||
else
|
||||
m_changeButton->setEnabled(true);
|
||||
@@ -837,11 +725,11 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
||||
{
|
||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||
m_project->sourceDirectory(),
|
||||
m_project->buildDirectory(m_buildConfiguration),
|
||||
m_project->environment(m_buildConfiguration));
|
||||
m_buildConfiguration->buildDirectory(),
|
||||
m_buildConfiguration->environment());
|
||||
if (copw.exec() == QDialog::Accepted) {
|
||||
m_project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
|
||||
m_pathLineEdit->setText(m_project->buildDirectory(m_buildConfiguration));
|
||||
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "cmakeprojectmanager.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "makestep.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -99,16 +100,6 @@ public:
|
||||
|
||||
virtual bool isApplication() const;
|
||||
|
||||
//building environment
|
||||
ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
ProjectExplorer::Environment baseEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setUserEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff);
|
||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
bool useSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setUseSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration, bool b);
|
||||
|
||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
@@ -116,12 +107,10 @@ public:
|
||||
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
QStringList targets() const;
|
||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
CMakeTarget targetForTitle(const QString &title);
|
||||
|
||||
QString sourceDirectory() const;
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
protected:
|
||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||
@@ -136,7 +125,6 @@ private slots:
|
||||
|
||||
private:
|
||||
bool parseCMakeLists();
|
||||
void updateToolChain(const QString &compiler);
|
||||
|
||||
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
||||
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
|
||||
@@ -152,7 +140,6 @@ private:
|
||||
CMakeProjectNode *m_rootNode;
|
||||
QStringList m_files;
|
||||
QList<CMakeTarget> m_targets;
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
ProjectExplorer::FileWatcher *m_watcher;
|
||||
bool m_insideFileChanged;
|
||||
QSet<QString> m_watchedFiles;
|
||||
@@ -239,7 +226,7 @@ private:
|
||||
CMakeProject *m_project;
|
||||
QLineEdit *m_pathLineEdit;
|
||||
QPushButton *m_changeButton;
|
||||
ProjectExplorer::BuildConfiguration *m_buildConfiguration;
|
||||
CMakeBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "cmakerunconfiguration.h"
|
||||
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/environment.h>
|
||||
@@ -58,6 +59,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &t
|
||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
|
||||
// TODO
|
||||
connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
}
|
||||
@@ -186,7 +188,7 @@ ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const
|
||||
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) {
|
||||
env = ProjectExplorer::Environment::systemEnvironment();
|
||||
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) {
|
||||
env = project()->environment(project()->activeBuildConfiguration());
|
||||
env = environment();
|
||||
}
|
||||
return env;
|
||||
}
|
||||
@@ -226,8 +228,8 @@ void CMakeRunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplore
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeRunConfiguration::toolChainType() const
|
||||
{
|
||||
CMakeProject *pro = static_cast<CMakeProject *>(project());
|
||||
return pro->toolChainType();
|
||||
CMakeBuildConfiguration *bc = static_cast<CMakeBuildConfiguration *>(project()->activeBuildConfiguration());
|
||||
return bc->toolChainType();
|
||||
}
|
||||
|
||||
// Configuration widget
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "makestep.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
@@ -95,20 +96,20 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
|
||||
bool MakeStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
CMakeBuildConfiguration *bc = static_cast<CMakeBuildConfiguration *>(buildConfiguration());
|
||||
// TODO, we should probably have a member cmakeBuildConfiguration();
|
||||
CMakeProject *pro = static_cast<CMakeProject *>(buildConfiguration()->project());
|
||||
setBuildParser(pro->buildParser(bc));
|
||||
|
||||
setBuildParser(bc->buildParser());
|
||||
|
||||
setEnabled(true);
|
||||
setWorkingDirectory(pro->buildDirectory(bc));
|
||||
setWorkingDirectory(bc->buildDirectory());
|
||||
|
||||
setCommand(pro->toolChain(bc)->makeCommand());
|
||||
setCommand(bc->toolChain()->makeCommand());
|
||||
|
||||
QStringList arguments = m_buildTargets;
|
||||
arguments << additionalArguments();
|
||||
setArguments(arguments);
|
||||
setEnvironment(pro->environment(bc));
|
||||
setEnvironment(bc->environment());
|
||||
setIgnoreReturnValue(m_clean);
|
||||
|
||||
return AbstractMakeStep::init();
|
||||
@@ -253,9 +254,8 @@ void MakeStepConfigWidget::updateDetails()
|
||||
QStringList arguments = m_makeStep->m_buildTargets;
|
||||
arguments << m_makeStep->additionalArguments();
|
||||
|
||||
BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
||||
CMakeProject *pro = static_cast<CMakeProject *>(bc->project());
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2").arg(pro->toolChain(bc)->makeCommand(), arguments.join(" "));
|
||||
CMakeBuildConfiguration *bc = static_cast<CMakeBuildConfiguration *>(m_makeStep->buildConfiguration());
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2").arg(bc->toolChain()->makeCommand(), arguments.join(" "));
|
||||
emit updateSummary();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user