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:
dt
2009-11-25 18:50:20 +01:00
parent 7949d93a1a
commit a312206306
39 changed files with 714 additions and 695 deletions

View File

@@ -29,19 +29,132 @@
#include "cmakebuildconfiguration.h" #include "cmakebuildconfiguration.h"
#include "cmakeproject.h" #include "cmakeproject.h"
#include <projectexplorer/projectexplorerconstants.h>
using namespace CMakeProjectManager; using namespace CMakeProjectManager;
using namespace Internal; using namespace Internal;
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *pro) CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *pro)
: BuildConfiguration(pro) : BuildConfiguration(pro), m_toolChain(0)
{ {
} }
CMakeBuildConfiguration::CMakeBuildConfiguration(BuildConfiguration *source) 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;
}
}

View File

@@ -31,6 +31,7 @@
#define CMAKEBUILDCONFIGURATION_H #define CMAKEBUILDCONFIGURATION_H
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/toolchain.h>
namespace CMakeProjectManager { namespace CMakeProjectManager {
namespace Internal { namespace Internal {
@@ -43,6 +44,24 @@ class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
public: public:
CMakeBuildConfiguration(CMakeProject *pro); CMakeBuildConfiguration(CMakeProject *pro);
CMakeBuildConfiguration(BuildConfiguration *source); 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;
}; };

View File

@@ -29,6 +29,7 @@
#include "cmakebuildenvironmentwidget.h" #include "cmakebuildenvironmentwidget.h"
#include "cmakeproject.h" #include "cmakeproject.h"
#include "cmakebuildconfiguration.h"
#include <projectexplorer/environmenteditmodel.h> #include <projectexplorer/environmenteditmodel.h>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QCheckBox> #include <QtGui/QCheckBox>
@@ -68,21 +69,21 @@ void CMakeBuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
if (debug) if (debug)
qDebug() << "Qt4BuildConfigWidget::init()"; qDebug() << "Qt4BuildConfigWidget::init()";
m_buildConfiguration = bc; m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(m_buildConfiguration)); m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(m_buildConfiguration)); m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(m_buildConfiguration)); m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
m_buildEnvironmentWidget->updateButtons(); m_buildEnvironmentWidget->updateButtons();
} }
void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated() void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
{ {
m_pro->setUserEnvironmentChanges(m_buildConfiguration, m_buildEnvironmentWidget->userChanges()); m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
} }
void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked) void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
{ {
m_pro->setUseSystemEnvironment(m_buildConfiguration, !checked); m_buildConfiguration->setUseSystemEnvironment(!checked);
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(m_buildConfiguration)); m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
} }

View File

@@ -42,6 +42,7 @@ class EnvironmentWidget;
namespace CMakeProjectManager { namespace CMakeProjectManager {
namespace Internal { namespace Internal {
class CMakeProject; class CMakeProject;
class CMakeBuildConfiguration;
class CMakeBuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget class CMakeBuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
{ {
@@ -61,7 +62,7 @@ private:
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget; ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
QCheckBox *m_clearSystemEnvironmentCheckBox; QCheckBox *m_clearSystemEnvironmentCheckBox;
CMakeProject *m_pro; CMakeProject *m_pro;
ProjectExplorer::BuildConfiguration *m_buildConfiguration; CMakeBuildConfiguration *m_buildConfiguration;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -116,8 +116,8 @@ BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type)
CMakeOpenProjectWizard copw(m_project->projectManager(), CMakeOpenProjectWizard copw(m_project->projectManager(),
m_project->sourceDirectory(), m_project->sourceDirectory(),
m_project->buildDirectory(bc), bc->buildDirectory(),
m_project->environment(bc)); bc->environment());
if (copw.exec() != QDialog::Accepted) { if (copw.exec() != QDialog::Accepted) {
delete bc; delete bc;
return false; return false;
@@ -156,7 +156,6 @@ 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_toolChain(0),
m_insideFileChanged(false) m_insideFileChanged(false)
{ {
m_file = new CMakeFile(this, fileName); m_file = new CMakeFile(this, fileName);
@@ -165,7 +164,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
CMakeProject::~CMakeProject() CMakeProject::~CMakeProject()
{ {
delete m_rootNode; delete m_rootNode;
delete m_toolChain;
} }
IBuildConfigurationFactory *CMakeProject::buildConfigurationFactory() const IBuildConfigurationFactory *CMakeProject::buildConfigurationFactory() const
@@ -179,7 +177,7 @@ void CMakeProject::slotActiveBuildConfiguration()
// 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);
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC))); QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
QFileInfo cbpFileFi(cbpFile); QFileInfo cbpFileFi(cbpFile);
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing; CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
if (!cbpFileFi.exists()) { if (!cbpFileFi.exists()) {
@@ -196,9 +194,9 @@ void CMakeProject::slotActiveBuildConfiguration()
if (mode != CMakeOpenProjectWizard::Nothing) { if (mode != CMakeOpenProjectWizard::Nothing) {
CMakeOpenProjectWizard copw(m_manager, CMakeOpenProjectWizard copw(m_manager,
sourceFileInfo.absolutePath(), sourceFileInfo.absolutePath(),
buildDirectory(activeBC), activeBC->buildDirectory(),
mode, mode,
environment(activeBC)); activeBC->environment());
copw.exec(); copw.exec();
activeBC->setValue("msvcVersion", copw.msvcVersion()); activeBC->setValue("msvcVersion", copw.msvcVersion());
} }
@@ -216,39 +214,6 @@ void CMakeProject::fileChanged(const QString &fileName)
m_insideFileChanged = false; 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) void CMakeProject::changeBuildDirectory(BuildConfiguration *configuration, const QString &newBuildDirectory)
{ {
configuration->setValue("buildDirectory", newBuildDirectory); configuration->setValue("buildDirectory", newBuildDirectory);
@@ -263,7 +228,8 @@ QString CMakeProject::sourceDirectory() const
bool CMakeProject::parseCMakeLists() bool CMakeProject::parseCMakeLists()
{ {
// Find cbp file // Find cbp file
QString cbpFile = CMakeManager::findCbpFile(buildDirectory(activeBuildConfiguration())); CMakeBuildConfiguration *activeCmakeBuildConfiguration = static_cast<CMakeBuildConfiguration *>(activeBuildConfiguration());
QString cbpFile = CMakeManager::findCbpFile(activeCmakeBuildConfiguration->buildDirectory());
// setFolderName // setFolderName
m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName()); m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName());
@@ -272,7 +238,7 @@ bool CMakeProject::parseCMakeLists()
//qDebug()<<"Parsing file "<<cbpFile; //qDebug()<<"Parsing file "<<cbpFile;
if (cbpparser.parseCbpFile(cbpFile)) { if (cbpparser.parseCbpFile(cbpFile)) {
// ToolChain // ToolChain
updateToolChain(cbpparser.compilerName()); activeCmakeBuildConfiguration->updateToolChain(cbpparser.compilerName());
m_projectName = cbpparser.projectName(); m_projectName = cbpparser.projectName();
m_rootNode->setFolderName(cbpparser.projectName()); m_rootNode->setFolderName(cbpparser.projectName());
@@ -325,7 +291,7 @@ bool CMakeProject::parseCMakeLists()
QStringList allIncludePaths; QStringList allIncludePaths;
QStringList allFrameworkPaths; QStringList allFrameworkPaths;
QList<ProjectExplorer::HeaderPath> allHeaderPaths = m_toolChain->systemHeaderPaths(); QList<ProjectExplorer::HeaderPath> allHeaderPaths = activeCmakeBuildConfiguration->toolChain()->systemHeaderPaths();
foreach (ProjectExplorer::HeaderPath headerPath, allHeaderPaths) { foreach (ProjectExplorer::HeaderPath headerPath, allHeaderPaths) {
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath) if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
allFrameworkPaths.append(headerPath.path()); allFrameworkPaths.append(headerPath.path());
@@ -341,12 +307,12 @@ bool CMakeProject::parseCMakeLists()
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this); CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
if (pinfo.includePaths != allIncludePaths if (pinfo.includePaths != allIncludePaths
|| pinfo.sourceFiles != m_files || pinfo.sourceFiles != m_files
|| pinfo.defines != m_toolChain->predefinedMacros() || pinfo.defines != activeCmakeBuildConfiguration->toolChain()->predefinedMacros()
|| pinfo.frameworkPaths != allFrameworkPaths) { || pinfo.frameworkPaths != allFrameworkPaths) {
pinfo.includePaths = allIncludePaths; pinfo.includePaths = allIncludePaths;
// TODO we only want C++ files, not all other stuff that might be in the project // TODO we only want C++ files, not all other stuff that might be in the project
pinfo.sourceFiles = m_files; 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; pinfo.frameworkPaths = allFrameworkPaths;
modelmanager->updateProjectInfo(pinfo); modelmanager->updateProjectInfo(pinfo);
modelmanager->updateSourceFiles(pinfo.sourceFiles); modelmanager->updateSourceFiles(pinfo.sourceFiles);
@@ -404,31 +370,12 @@ bool CMakeProject::parseCMakeLists()
} else { } else {
// TODO report error // TODO report error
qDebug()<<"Parsing failed"; qDebug()<<"Parsing failed";
delete m_toolChain; activeCmakeBuildConfiguration->updateToolChain(QString::null);
m_toolChain = 0;
return false; return false;
} }
return true; 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 CMakeProject::targets() const
{ {
QStringList results; QStringList results;
@@ -551,8 +498,6 @@ QString CMakeProject::name() const
return m_projectName; return m_projectName;
} }
Core::IFile *CMakeProject::file() const Core::IFile *CMakeProject::file() const
{ {
return m_file; return m_file;
@@ -573,56 +518,6 @@ bool CMakeProject::isApplication() const
return true; 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() ProjectExplorer::BuildConfigWidget *CMakeProject::createConfigWidget()
{ {
return new CMakeBuildSettingsWidget(this); return new CMakeBuildSettingsWidget(this);
@@ -686,7 +581,7 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
// or simply run createXml with the saved settings // or simply run createXml with the saved settings
QFileInfo sourceFileInfo(m_fileName); QFileInfo sourceFileInfo(m_fileName);
BuildConfiguration *activeBC = activeBuildConfiguration(); BuildConfiguration *activeBC = activeBuildConfiguration();
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC))); QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
QFileInfo cbpFileFi(cbpFile); QFileInfo cbpFileFi(cbpFile);
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing; CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
@@ -698,9 +593,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
if (mode != CMakeOpenProjectWizard::Nothing) { if (mode != CMakeOpenProjectWizard::Nothing) {
CMakeOpenProjectWizard copw(m_manager, CMakeOpenProjectWizard copw(m_manager,
sourceFileInfo.absolutePath(), sourceFileInfo.absolutePath(),
buildDirectory(activeBC), activeBC->buildDirectory(),
mode, mode,
environment(activeBC)); activeBC->environment());
if (copw.exec() != QDialog::Accepted) if (copw.exec() != QDialog::Accepted)
return false; return false;
activeBC->setValue("msvcVersion", copw.msvcVersion()); activeBC->setValue("msvcVersion", copw.msvcVersion());
@@ -729,13 +624,6 @@ CMakeTarget CMakeProject::targetForTitle(const QString &title)
return CMakeTarget(); return CMakeTarget();
} }
ProjectExplorer::ToolChain::ToolChainType CMakeProject::toolChainType() const
{
if (m_toolChain)
return m_toolChain->type();
return ProjectExplorer::ToolChain::UNKNOWN;
}
// CMakeFile // CMakeFile
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName) CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
@@ -825,9 +713,9 @@ QString CMakeBuildSettingsWidget::displayName() const
void CMakeBuildSettingsWidget::init(BuildConfiguration *bc) void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
{ {
m_buildConfiguration = bc; m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
m_pathLineEdit->setText(m_project->buildDirectory(bc)); m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
if (m_project->buildDirectory(bc) == m_project->sourceDirectory()) if (m_buildConfiguration->buildDirectory() == m_project->sourceDirectory())
m_changeButton->setEnabled(false); m_changeButton->setEnabled(false);
else else
m_changeButton->setEnabled(true); m_changeButton->setEnabled(true);
@@ -837,11 +725,11 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
{ {
CMakeOpenProjectWizard copw(m_project->projectManager(), CMakeOpenProjectWizard copw(m_project->projectManager(),
m_project->sourceDirectory(), m_project->sourceDirectory(),
m_project->buildDirectory(m_buildConfiguration), m_buildConfiguration->buildDirectory(),
m_project->environment(m_buildConfiguration)); m_buildConfiguration->environment());
if (copw.exec() == QDialog::Accepted) { if (copw.exec() == QDialog::Accepted) {
m_project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory()); m_project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
m_pathLineEdit->setText(m_project->buildDirectory(m_buildConfiguration)); m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
} }
} }

View File

@@ -32,6 +32,7 @@
#include "cmakeprojectmanager.h" #include "cmakeprojectmanager.h"
#include "cmakeprojectnodes.h" #include "cmakeprojectnodes.h"
#include "cmakebuildconfiguration.h"
#include "makestep.h" #include "makestep.h"
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
@@ -99,16 +100,6 @@ public:
virtual bool isApplication() const; 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 ProjectExplorer::BuildConfigWidget *createConfigWidget();
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets(); virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
@@ -116,12 +107,10 @@ public:
virtual QStringList files(FilesMode fileMode) const; virtual QStringList files(FilesMode fileMode) const;
QStringList targets() const; QStringList targets() const;
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
CMakeTarget targetForTitle(const QString &title); CMakeTarget targetForTitle(const QString &title);
QString sourceDirectory() const; QString sourceDirectory() const;
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::BuildConfiguration *configuration) const;
protected: protected:
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer); virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
@@ -136,7 +125,6 @@ private slots:
private: private:
bool parseCMakeLists(); bool parseCMakeLists();
void updateToolChain(const QString &compiler);
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list); void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list); void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
@@ -152,7 +140,6 @@ private:
CMakeProjectNode *m_rootNode; CMakeProjectNode *m_rootNode;
QStringList m_files; QStringList m_files;
QList<CMakeTarget> m_targets; QList<CMakeTarget> m_targets;
ProjectExplorer::ToolChain *m_toolChain;
ProjectExplorer::FileWatcher *m_watcher; ProjectExplorer::FileWatcher *m_watcher;
bool m_insideFileChanged; bool m_insideFileChanged;
QSet<QString> m_watchedFiles; QSet<QString> m_watchedFiles;
@@ -239,7 +226,7 @@ private:
CMakeProject *m_project; CMakeProject *m_project;
QLineEdit *m_pathLineEdit; QLineEdit *m_pathLineEdit;
QPushButton *m_changeButton; QPushButton *m_changeButton;
ProjectExplorer::BuildConfiguration *m_buildConfiguration; CMakeBuildConfiguration *m_buildConfiguration;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -30,6 +30,7 @@
#include "cmakerunconfiguration.h" #include "cmakerunconfiguration.h"
#include "cmakeproject.h" #include "cmakeproject.h"
#include "cmakebuildconfiguration.h"
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include <projectexplorer/environment.h> #include <projectexplorer/environment.h>
@@ -58,6 +59,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &t
connect(pro, SIGNAL(activeBuildConfigurationChanged()), connect(pro, SIGNAL(activeBuildConfigurationChanged()),
this, SIGNAL(baseEnvironmentChanged())); this, SIGNAL(baseEnvironmentChanged()));
// TODO
connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)), connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
this, SIGNAL(baseEnvironmentChanged())); this, SIGNAL(baseEnvironmentChanged()));
} }
@@ -186,7 +188,7 @@ ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) { } else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) {
env = ProjectExplorer::Environment::systemEnvironment(); env = ProjectExplorer::Environment::systemEnvironment();
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) { } else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) {
env = project()->environment(project()->activeBuildConfiguration()); env = environment();
} }
return env; return env;
} }
@@ -226,8 +228,8 @@ void CMakeRunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplore
ProjectExplorer::ToolChain::ToolChainType CMakeRunConfiguration::toolChainType() const ProjectExplorer::ToolChain::ToolChainType CMakeRunConfiguration::toolChainType() const
{ {
CMakeProject *pro = static_cast<CMakeProject *>(project()); CMakeBuildConfiguration *bc = static_cast<CMakeBuildConfiguration *>(project()->activeBuildConfiguration());
return pro->toolChainType(); return bc->toolChainType();
} }
// Configuration widget // Configuration widget

View File

@@ -29,6 +29,7 @@
#include "makestep.h" #include "makestep.h"
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include "cmakeproject.h" #include "cmakeproject.h"
#include "cmakebuildconfiguration.h"
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
@@ -95,20 +96,20 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
bool MakeStep::init() bool MakeStep::init()
{ {
BuildConfiguration *bc = buildConfiguration(); CMakeBuildConfiguration *bc = static_cast<CMakeBuildConfiguration *>(buildConfiguration());
// TODO, we should probably have a member cmakeBuildConfiguration(); // TODO, we should probably have a member cmakeBuildConfiguration();
CMakeProject *pro = static_cast<CMakeProject *>(buildConfiguration()->project());
setBuildParser(pro->buildParser(bc)); setBuildParser(bc->buildParser());
setEnabled(true); setEnabled(true);
setWorkingDirectory(pro->buildDirectory(bc)); setWorkingDirectory(bc->buildDirectory());
setCommand(pro->toolChain(bc)->makeCommand()); setCommand(bc->toolChain()->makeCommand());
QStringList arguments = m_buildTargets; QStringList arguments = m_buildTargets;
arguments << additionalArguments(); arguments << additionalArguments();
setArguments(arguments); setArguments(arguments);
setEnvironment(pro->environment(bc)); setEnvironment(bc->environment());
setIgnoreReturnValue(m_clean); setIgnoreReturnValue(m_clean);
return AbstractMakeStep::init(); return AbstractMakeStep::init();
@@ -253,9 +254,8 @@ void MakeStepConfigWidget::updateDetails()
QStringList arguments = m_makeStep->m_buildTargets; QStringList arguments = m_makeStep->m_buildTargets;
arguments << m_makeStep->additionalArguments(); arguments << m_makeStep->additionalArguments();
BuildConfiguration *bc = m_makeStep->buildConfiguration(); CMakeBuildConfiguration *bc = static_cast<CMakeBuildConfiguration *>(m_makeStep->buildConfiguration());
CMakeProject *pro = static_cast<CMakeProject *>(bc->project()); m_summaryText = tr("<b>Make:</b> %1 %2").arg(bc->toolChain()->makeCommand(), arguments.join(" "));
m_summaryText = tr("<b>Make:</b> %1 %2").arg(pro->toolChain(bc)->makeCommand(), arguments.join(" "));
emit updateSummary(); emit updateSummary();
} }

View File

@@ -35,6 +35,7 @@
#include <projectexplorer/environment.h> #include <projectexplorer/environment.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/buildconfiguration.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -131,7 +132,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
} }
if (const ProjectExplorer::Project *project = runConfiguration->project()) { if (const ProjectExplorer::Project *project = runConfiguration->project()) {
m_startParameters->buildDir = m_startParameters->buildDir =
project->buildDirectory(project->activeBuildConfiguration()); project->activeBuildConfiguration()->buildDirectory();
} }
m_startParameters->useTerminal = m_startParameters->useTerminal =
runConfiguration->runMode() == LocalApplicationRunConfiguration::Console; runConfiguration->runMode() == LocalApplicationRunConfiguration::Console;

View File

@@ -45,3 +45,22 @@ GenericBuildConfiguration::GenericBuildConfiguration(GenericBuildConfiguration *
{ {
} }
ProjectExplorer::Environment GenericBuildConfiguration::environment() const
{
return ProjectExplorer::Environment::systemEnvironment();
}
QString GenericBuildConfiguration::buildDirectory() const
{
QString buildDirectory = value("buildDirectory").toString();
if (buildDirectory.isEmpty()) {
QFileInfo fileInfo(project()->file()->fileName());
buildDirectory = fileInfo.absolutePath();
}
return buildDirectory;
}

View File

@@ -44,6 +44,9 @@ class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
public: public:
GenericBuildConfiguration(GenericProject *pro); GenericBuildConfiguration(GenericProject *pro);
GenericBuildConfiguration(GenericBuildConfiguration *source); GenericBuildConfiguration(GenericBuildConfiguration *source);
virtual ProjectExplorer::Environment environment() const;
virtual QString buildDirectory() const;
}; };
} // namespace GenericProjectManager } // namespace GenericProjectManager

View File

@@ -31,6 +31,7 @@
#include "genericprojectconstants.h" #include "genericprojectconstants.h"
#include "genericproject.h" #include "genericproject.h"
#include "ui_genericmakestep.h" #include "ui_genericmakestep.h"
#include "genericbuildconfiguration.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
@@ -66,22 +67,21 @@ GenericMakeStep::~GenericMakeStep()
bool GenericMakeStep::init() bool GenericMakeStep::init()
{ {
ProjectExplorer::BuildConfiguration *bc = buildConfiguration(); GenericBuildConfiguration *bc = static_cast<GenericBuildConfiguration *>(buildConfiguration());
//TODO //TODO
GenericProject *pro = static_cast<GenericProject *>(buildConfiguration()->project()); const QString buildParser = static_cast<GenericProject *>(bc->project())->buildParser(bc);
const QString buildParser = pro->buildParser(bc);
setBuildParser(buildParser); setBuildParser(buildParser);
setEnabled(true); setEnabled(true);
Core::VariableManager *vm = Core::VariableManager::instance(); Core::VariableManager *vm = Core::VariableManager::instance();
const QString rawBuildDir = buildConfiguration()->project()->buildDirectory(bc); const QString rawBuildDir = bc->buildDirectory();
const QString buildDir = vm->resolve(rawBuildDir); const QString buildDir = vm->resolve(rawBuildDir);
setWorkingDirectory(buildDir); setWorkingDirectory(buildDir);
setCommand(makeCommand()); setCommand(makeCommand());
setArguments(replacedArguments()); setArguments(replacedArguments());
setEnvironment(buildConfiguration()->project()->environment(bc)); setEnvironment(bc->environment());
return AbstractMakeStep::init(); return AbstractMakeStep::init();
} }

View File

@@ -481,25 +481,6 @@ bool GenericProject::isApplication() const
return true; return true;
} }
ProjectExplorer::Environment GenericProject::environment(BuildConfiguration *configuration) const
{
Q_UNUSED(configuration)
return ProjectExplorer::Environment::systemEnvironment();
}
QString GenericProject::buildDirectory(BuildConfiguration *configuration) const
{
QString buildDirectory = configuration->value("buildDirectory").toString();
if (buildDirectory.isEmpty()) {
QFileInfo fileInfo(m_fileName);
buildDirectory = fileInfo.absolutePath();
}
return buildDirectory;
}
ProjectExplorer::BuildConfigWidget *GenericProject::createConfigWidget() ProjectExplorer::BuildConfigWidget *GenericProject::createConfigWidget()
{ {
return new GenericBuildSettingsWidget(this); return new GenericBuildSettingsWidget(this);
@@ -629,8 +610,8 @@ QString GenericBuildSettingsWidget::displayName() const
void GenericBuildSettingsWidget::init(BuildConfiguration *bc) void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
{ {
m_buildConfiguration = bc; m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
m_pathChooser->setPath(m_project->buildDirectory(bc)); m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
} }
void GenericBuildSettingsWidget::buildDirectoryChanged() void GenericBuildSettingsWidget::buildDirectoryChanged()

View File

@@ -54,6 +54,7 @@ namespace Internal {
class GenericProject; class GenericProject;
class GenericMakeStep; class GenericMakeStep;
class GenericProjectFile; class GenericProjectFile;
class GenericBuildConfiguration;
class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
{ {
@@ -95,9 +96,6 @@ public:
virtual bool isApplication() const; virtual bool isApplication() const;
virtual ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget(); virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets(); virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
@@ -204,7 +202,7 @@ private Q_SLOTS:
private: private:
GenericProject *m_project; GenericProject *m_project;
Utils::PathChooser *m_pathChooser; Utils::PathChooser *m_pathChooser;
ProjectExplorer::BuildConfiguration *m_buildConfiguration; GenericBuildConfiguration *m_buildConfiguration;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -167,6 +167,7 @@ Project *BuildConfiguration::project() const
return m_project; return m_project;
} }
/// ///
// IBuildConfigurationFactory // IBuildConfigurationFactory
/// ///

View File

@@ -31,6 +31,7 @@
#define BUILDCONFIGURATION_H #define BUILDCONFIGURATION_H
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "environment.h"
#include <QtCore/QHash> #include <QtCore/QHash>
#include <QtCore/QString> #include <QtCore/QString>
@@ -75,6 +76,13 @@ public:
Project *project() const; Project *project() const;
virtual Environment environment() const = 0;
virtual QString buildDirectory() const = 0;
signals:
void environmentChanged();
void buildDirectoryChanged();
protected: protected:
BuildConfiguration(Project * project); BuildConfiguration(Project * project);
BuildConfiguration(BuildConfiguration *source); BuildConfiguration(BuildConfiguration *source);
@@ -111,8 +119,8 @@ public:
virtual BuildConfiguration *restore() const = 0; virtual BuildConfiguration *restore() const = 0;
// TODO All those methods make the internal name (and display name) unique, // TODO display name unique, in different ways
// but in different ways
signals: signals:
void availableCreationTypesChanged(); void availableCreationTypesChanged();

View File

@@ -35,6 +35,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/debugginghelper.h> #include <projectexplorer/debugginghelper.h>
#include <projectexplorer/buildconfiguration.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
@@ -279,7 +280,7 @@ QString CustomExecutableRunConfiguration::executable() const
{ {
QString exec; QString exec;
if (QDir::isRelativePath(m_executable)) { if (QDir::isRelativePath(m_executable)) {
Environment env = project()->environment(project()->activeBuildConfiguration()); Environment env = project()->activeBuildConfiguration()->environment();
exec = env.searchInPath(m_executable); exec = env.searchInPath(m_executable);
} else { } else {
exec = m_executable; exec = m_executable;
@@ -328,7 +329,7 @@ QString CustomExecutableRunConfiguration::baseWorkingDirectory() const
QString CustomExecutableRunConfiguration::workingDirectory() const QString CustomExecutableRunConfiguration::workingDirectory() const
{ {
QString wd = m_workingDirectory; QString wd = m_workingDirectory;
QString bd = project()->buildDirectory(project()->activeBuildConfiguration()); QString bd = project()->activeBuildConfiguration()->buildDirectory();
return wd.replace("$BUILDDIR", QDir::cleanPath(bd)); return wd.replace("$BUILDDIR", QDir::cleanPath(bd));
} }
@@ -345,7 +346,7 @@ ProjectExplorer::Environment CustomExecutableRunConfiguration::baseEnvironment()
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::SystemEnvironmentBase) { } else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::SystemEnvironmentBase) {
env = ProjectExplorer::Environment::systemEnvironment(); env = ProjectExplorer::Environment::systemEnvironment();
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) { } else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) {
env = project()->environment(project()->activeBuildConfiguration()); env = project()->activeBuildConfiguration()->environment();
} }
return env; return env;
} }

View File

@@ -65,12 +65,12 @@ ProcessStep::ProcessStep(ProcessStep *bs, BuildConfiguration *bc)
bool ProcessStep::init() bool ProcessStep::init()
{ {
setEnvironment(buildConfiguration()->project()->environment(buildConfiguration())); setEnvironment(buildConfiguration()->environment());
QString wd = workingDirectory(); QString wd = workingDirectory();
if (wd.isEmpty()) if (wd.isEmpty())
wd = "$BUILDDIR"; wd = "$BUILDDIR";
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", buildConfiguration()->project()->buildDirectory(buildConfiguration()))); AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", buildConfiguration()->buildDirectory()));
AbstractProcessStep::setCommand(m_command); AbstractProcessStep::setCommand(m_command);
AbstractProcessStep::setEnabled(m_enabled); AbstractProcessStep::setEnabled(m_enabled);
AbstractProcessStep::setArguments(m_arguments); AbstractProcessStep::setArguments(m_arguments);

View File

@@ -88,7 +88,9 @@ public:
void removeBuildConfiguration(BuildConfiguration *configuration); void removeBuildConfiguration(BuildConfiguration *configuration);
QList<BuildConfiguration *> buildConfigurations() const; QList<BuildConfiguration *> buildConfigurations() const;
// remove and add "QString uniqueConfigurationDisplayName(const QString &proposedName) const" instead // remove and add "QString uniqueConfigurationDisplayName(const QString &proposedName) const" instead
// move into BuildConfiguration *
void setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName); void setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName);
BuildConfiguration *activeBuildConfiguration() const; BuildConfiguration *activeBuildConfiguration() const;
void setActiveBuildConfiguration(BuildConfiguration *configuration); void setActiveBuildConfiguration(BuildConfiguration *configuration);
@@ -108,9 +110,6 @@ public:
EditorConfiguration *editorConfiguration() const; EditorConfiguration *editorConfiguration() const;
virtual Environment environment(BuildConfiguration *configuration) const = 0;
virtual QString buildDirectory(BuildConfiguration *configuration) const = 0;
void saveSettings(); void saveSettings();
bool restoreSettings(); bool restoreSettings();
@@ -131,7 +130,6 @@ public:
static QString makeUnique(const QString &preferedName, const QStringList &usedNames); static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
signals: signals:
void fileListChanged(); void fileListChanged();
void buildDirectoryChanged();
// TODO clean up signal names // TODO clean up signal names
// might be better to also have // might be better to also have
@@ -150,7 +148,7 @@ signals:
// This signal is jut there for updating the tree list in the buildsettings wizard // This signal is jut there for updating the tree list in the buildsettings wizard
void buildConfigurationDisplayNameChanged(BuildConfiguration *bc); void buildConfigurationDisplayNameChanged(BuildConfiguration *bc);
void environmentChanged(BuildConfiguration *bc);
protected: protected:
/* This method is called when the project .user file is saved. Simply call /* This method is called when the project .user file is saved. Simply call

View File

@@ -162,12 +162,6 @@ QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
QStringList QmlProject::files() const QStringList QmlProject::files() const
{ return m_files; } { return m_files; }
QString QmlProject::buildParser(BuildConfiguration *configuration) const
{
Q_UNUSED(configuration)
return QString();
}
QString QmlProject::name() const QString QmlProject::name() const
{ {
return m_projectName; return m_projectName;
@@ -198,18 +192,6 @@ bool QmlProject::hasBuildSettings() const
return false; return false;
} }
ProjectExplorer::Environment QmlProject::environment(BuildConfiguration *configuration) const
{
Q_UNUSED(configuration)
return ProjectExplorer::Environment::systemEnvironment();
}
QString QmlProject::buildDirectory(BuildConfiguration *configuration) const
{
Q_UNUSED(configuration)
return QString();
}
ProjectExplorer::BuildConfigWidget *QmlProject::createConfigWidget() ProjectExplorer::BuildConfigWidget *QmlProject::createConfigWidget()
{ {
return 0; return 0;

View File

@@ -71,9 +71,6 @@ public:
virtual bool isApplication() const; virtual bool isApplication() const;
virtual bool hasBuildSettings() const; virtual bool hasBuildSettings() const;
virtual ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget(); virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets(); virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
@@ -81,7 +78,6 @@ public:
virtual QStringList files(FilesMode fileMode) const; virtual QStringList files(FilesMode fileMode) const;
QStringList targets() const; QStringList targets() const;
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
enum RefreshOptions { enum RefreshOptions {
Files = 0x01, Files = 0x01,

View File

@@ -2,6 +2,7 @@
#include "qt4project.h" #include "qt4project.h"
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include "qtversionmanager.h" #include "qtversionmanager.h"
#include "qt4buildconfiguration.h"
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
@@ -99,7 +100,8 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
const Qt4Project *project = qt4ProjectFor(fileName); const Qt4Project *project = qt4ProjectFor(fileName);
// Get the binary either from the current Qt version of the project or Path // Get the binary either from the current Qt version of the project or Path
if (project) { if (project) {
const QtVersion *qtVersion= project->qtVersion(project->activeBuildConfiguration()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project->activeBuildConfiguration());
const QtVersion *qtVersion= qt4bc->qtVersion();
data->binary = (qtVersion->*commandAccessor)(); data->binary = (qtVersion->*commandAccessor)();
data->workingDirectory = QFileInfo(project->file()->fileName()).absolutePath(); data->workingDirectory = QFileInfo(project->file()->fileName()).absolutePath();
} else { } else {

View File

@@ -30,6 +30,7 @@
#include "makestep.h" #include "makestep.h"
#include "qt4project.h" #include "qt4project.h"
#include "qt4buildconfiguration.h"
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -96,16 +97,15 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
bool MakeStep::init() bool MakeStep::init()
{ {
ProjectExplorer::BuildConfiguration *bc = buildConfiguration(); Qt4BuildConfiguration *bc = static_cast<Qt4BuildConfiguration *>(buildConfiguration());
Environment environment = buildConfiguration()->project()->environment(bc); Environment environment = bc->environment();
setEnvironment(environment); setEnvironment(environment);
//TODO //TODO
Qt4Project *qt4project = static_cast<Qt4Project *>(buildConfiguration()->project()); QString workingDirectory = bc->buildDirectory();
QString workingDirectory = qt4project->buildDirectory(bc);
setWorkingDirectory(workingDirectory); setWorkingDirectory(workingDirectory);
QString makeCmd = qt4project->makeCommand(bc); QString makeCmd = bc->makeCommand();
if (!m_makeCmd.isEmpty()) if (!m_makeCmd.isEmpty())
makeCmd = m_makeCmd; makeCmd = m_makeCmd;
if (!QFileInfo(makeCmd).isAbsolute()) { if (!QFileInfo(makeCmd).isAbsolute()) {
@@ -126,15 +126,15 @@ bool MakeStep::init()
setIgnoreReturnValue(m_clean); setIgnoreReturnValue(m_clean);
QStringList args = m_makeargs; QStringList args = m_makeargs;
if (!m_clean) { if (!m_clean) {
if (!qt4project->defaultMakeTarget(bc).isEmpty()) if (!bc->defaultMakeTarget().isEmpty())
args << qt4project->defaultMakeTarget(bc); args << bc->defaultMakeTarget();
} }
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the // -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
// absolute file path // absolute file path
// FIXME doing this without the user having a way to override this is rather bad // FIXME doing this without the user having a way to override this is rather bad
// so we only do it for unix and if the user didn't override the make command // so we only do it for unix and if the user didn't override the make command
// but for now this is the least invasive change // but for now this is the least invasive change
ProjectExplorer::ToolChain *toolchain = qt4project->toolChain(bc); ProjectExplorer::ToolChain *toolchain = bc->toolChain();
ProjectExplorer::ToolChain::ToolChainType type = ProjectExplorer::ToolChain::UNKNOWN; ProjectExplorer::ToolChain::ToolChainType type = ProjectExplorer::ToolChain::UNKNOWN;
if (toolchain) if (toolchain)
@@ -225,22 +225,20 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
void MakeStepConfigWidget::updateMakeOverrideLabel() void MakeStepConfigWidget::updateMakeOverrideLabel()
{ {
Qt4Project *qt4project = static_cast<Qt4Project *>(m_makeStep->buildConfiguration()->project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(m_makeStep->buildConfiguration());
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4project-> m_ui.makeLabel->setText(tr("Override %1:").arg(qt4bc->makeCommand()));
makeCommand(m_makeStep->buildConfiguration())));
} }
void MakeStepConfigWidget::updateDetails() void MakeStepConfigWidget::updateDetails()
{ {
Qt4Project *pro = static_cast<Qt4Project *>(m_makeStep->buildConfiguration()->project()); Qt4BuildConfiguration *bc = static_cast<Qt4BuildConfiguration *>(m_makeStep->buildConfiguration());
ProjectExplorer::BuildConfiguration *bc = m_makeStep->buildConfiguration(); QString workingDirectory = bc->buildDirectory();
QString workingDirectory = pro->buildDirectory(bc);
QString makeCmd = pro->makeCommand(bc); QString makeCmd = bc->makeCommand();
if (!m_makeStep->m_makeCmd.isEmpty()) if (!m_makeStep->m_makeCmd.isEmpty())
makeCmd = m_makeStep->m_makeCmd; makeCmd = m_makeStep->m_makeCmd;
if (!QFileInfo(makeCmd).isAbsolute()) { if (!QFileInfo(makeCmd).isAbsolute()) {
Environment environment = pro->environment(bc); Environment environment = bc->environment();
// Try to detect command in environment // Try to detect command in environment
QString tmp = environment.searchInPath(makeCmd); QString tmp = environment.searchInPath(makeCmd);
if (tmp == QString::null) { if (tmp == QString::null) {
@@ -257,7 +255,7 @@ void MakeStepConfigWidget::updateDetails()
// but for now this is the least invasive change // but for now this is the least invasive change
QStringList args = m_makeStep->makeArguments(); QStringList args = m_makeStep->makeArguments();
ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN; ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN;
ProjectExplorer::ToolChain *toolChain = pro->toolChain(bc); ProjectExplorer::ToolChain *toolChain = bc->toolChain();
if (toolChain) if (toolChain)
t = toolChain->type(); t = toolChain->type();
if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) { if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) {

View File

@@ -34,6 +34,7 @@
#include "qt4projectmanager.h" #include "qt4projectmanager.h"
#include "makestep.h" #include "makestep.h"
#include "qtversionmanager.h" #include "qtversionmanager.h"
#include "qt4buildconfiguration.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -69,15 +70,14 @@ QMakeStep::~QMakeStep()
QStringList QMakeStep::arguments() QStringList QMakeStep::arguments()
{ {
QStringList additonalArguments = m_qmakeArgs; QStringList additonalArguments = m_qmakeArgs;
ProjectExplorer::BuildConfiguration *bc = buildConfiguration(); Qt4BuildConfiguration *bc = static_cast<Qt4BuildConfiguration *>(buildConfiguration());
QStringList arguments; QStringList arguments;
arguments << buildConfiguration()->project()->file()->fileName(); arguments << buildConfiguration()->project()->file()->fileName();
arguments << "-r"; arguments << "-r";
// TODO // TODO
Qt4Project *pro = static_cast<Qt4Project *>(buildConfiguration()->project());
if (!additonalArguments.contains("-spec")) if (!additonalArguments.contains("-spec"))
arguments << "-spec" << pro->qtVersion(bc)->mkspec(); arguments << "-spec" << bc->qtVersion()->mkspec();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
ToolChain::ToolChainType type = pro->toolChainType(bc); ToolChain::ToolChainType type = pro->toolChainType(bc);
@@ -87,7 +87,7 @@ QStringList QMakeStep::arguments()
if (bc->value("buildConfiguration").isValid()) { if (bc->value("buildConfiguration").isValid()) {
QStringList configarguments; QStringList configarguments;
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = pro->qtVersion(bc)->defaultBuildConfig(); QtVersion::QmakeBuildConfigs defaultBuildConfiguration = bc->qtVersion()->defaultBuildConfig();
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt()); QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt());
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll)) if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll))
configarguments << "CONFIG-=debug_and_release"; configarguments << "CONFIG-=debug_and_release";
@@ -111,10 +111,9 @@ QStringList QMakeStep::arguments()
bool QMakeStep::init() bool QMakeStep::init()
{ {
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
// TODO // TODO
Qt4Project *pro = static_cast<Qt4Project *>(buildConfiguration()->project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(buildConfiguration());
const QtVersion *qtVersion = pro->qtVersion(bc); const QtVersion *qtVersion = qt4bc->qtVersion();
if (!qtVersion->isValid()) { if (!qtVersion->isValid()) {
#if defined(Q_WS_MAC) #if defined(Q_WS_MAC)
@@ -126,7 +125,7 @@ bool QMakeStep::init()
} }
QStringList args = arguments(); QStringList args = arguments();
QString workingDirectory = pro->buildDirectory(bc); QString workingDirectory = qt4bc->buildDirectory();
QString program = qtVersion->qmakeCommand(); QString program = qtVersion->qmakeCommand();
@@ -135,7 +134,7 @@ bool QMakeStep::init()
if (QDir(workingDirectory).exists(QLatin1String("Makefile"))) { if (QDir(workingDirectory).exists(QLatin1String("Makefile"))) {
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory); QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
if (qtVersion->qmakeCommand() == qmakePath) { if (qtVersion->qmakeCommand() == qmakePath) {
m_needToRunQMake = !pro->compareBuildConfigurationToImportFrom(bc, workingDirectory); m_needToRunQMake = !qt4bc->compareBuildConfigurationToImportFrom(workingDirectory);
} }
} }
@@ -148,7 +147,7 @@ bool QMakeStep::init()
setWorkingDirectory(workingDirectory); setWorkingDirectory(workingDirectory);
setCommand(program); setCommand(program);
setArguments(args); setArguments(args);
setEnvironment(pro->environment(bc)); setEnvironment(qt4bc->environment());
setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_QMAKE); setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_QMAKE);
return AbstractMakeStep::init(); return AbstractMakeStep::init();
@@ -266,8 +265,8 @@ void QMakeStepConfigWidget::qtVersionChanged(ProjectExplorer::BuildConfiguration
void QMakeStepConfigWidget::updateTitleLabel() void QMakeStepConfigWidget::updateTitleLabel()
{ {
Qt4Project *qt4project = static_cast<Qt4Project *>(m_step->buildConfiguration()->project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(m_step->buildConfiguration());
const QtVersion *qtVersion = qt4project->qtVersion(m_step->buildConfiguration()); const QtVersion *qtVersion = qt4bc->qtVersion();
if (!qtVersion) { if (!qtVersion) {
m_summaryText = tr("<b>QMake:</b> No Qt version set. QMake can not be run."); m_summaryText = tr("<b>QMake:</b> No Qt version set. QMake can not be run.");
emit updateSummary(); emit updateSummary();
@@ -340,8 +339,8 @@ void QMakeStepConfigWidget::init()
void QMakeStepConfigWidget::updateEffectiveQMakeCall() void QMakeStepConfigWidget::updateEffectiveQMakeCall()
{ {
Qt4Project *qt4project = static_cast<Qt4Project *>(m_step->buildConfiguration()->project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(m_step->buildConfiguration());
const QtVersion *qtVersion = qt4project->qtVersion(m_step->buildConfiguration()); const QtVersion *qtVersion = qt4bc->qtVersion();
if (qtVersion) { if (qtVersion) {
QString program = QFileInfo(qtVersion->qmakeCommand()).fileName(); QString program = QFileInfo(qtVersion->qmakeCommand()).fileName();
m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + ProjectExplorer::Environment::joinArgumentList(m_step->arguments())); m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + ProjectExplorer::Environment::joinArgumentList(m_step->arguments()));

View File

@@ -61,12 +61,9 @@ public:
class Qt4Project; class Qt4Project;
class QMakeStep : public ProjectExplorer::AbstractMakeStep class QMakeStep : public ProjectExplorer::AbstractMakeStep
{ {
Q_OBJECT Q_OBJECT
friend class Qt4Project; // TODO remove
// Currently used to access qmakeArgs
public: public:
QMakeStep(ProjectExplorer::BuildConfiguration *bc); QMakeStep(ProjectExplorer::BuildConfiguration *bc);
QMakeStep(QMakeStep *bs, ProjectExplorer::BuildConfiguration *bc); QMakeStep(QMakeStep *bs, ProjectExplorer::BuildConfiguration *bc);

View File

@@ -28,11 +28,11 @@
**************************************************************************/ **************************************************************************/
#include "maemorunconfiguration.h" #include "maemorunconfiguration.h"
#include "maemomanager.h" #include "maemomanager.h"
#include "maemotoolchain.h" #include "maemotoolchain.h"
#include "profilereader.h" #include "profilereader.h"
#include "qt4project.h" #include "qt4project.h"
#include "qt4buildconfiguration.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
@@ -322,10 +322,9 @@ Qt4Project *MaemoRunConfiguration::project() const
bool MaemoRunConfiguration::isEnabled() const bool MaemoRunConfiguration::isEnabled() const
{ {
Qt4Project *qt4Project = qobject_cast<Qt4Project*>(project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
QTC_ASSERT(qt4Project, return false); QTC_ASSERT(qt4bc, return false);
ToolChain::ToolChainType type = ToolChain::ToolChainType type = qt4bc->toolChainType();
qt4Project->toolChainType(qt4Project->activeBuildConfiguration());
return type == ToolChain::GCC_MAEMO; return type == ToolChain::GCC_MAEMO;
} }
@@ -412,8 +411,8 @@ void MaemoRunConfiguration::wasDeployed()
bool MaemoRunConfiguration::hasDebuggingHelpers() const bool MaemoRunConfiguration::hasDebuggingHelpers() const
{ {
return project()->qtVersion(project()->activeBuildConfiguration()) Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
->hasDebuggingHelper(); return qt4bc->qtVersion()->hasDebuggingHelper();
} }
bool MaemoRunConfiguration::debuggingHelpersNeedDeployment() const bool MaemoRunConfiguration::debuggingHelpersNeedDeployment() const
@@ -482,10 +481,10 @@ const QString MaemoRunConfiguration::cmd(const QString &cmdName) const
const MaemoToolChain *MaemoRunConfiguration::toolchain() const const MaemoToolChain *MaemoRunConfiguration::toolchain() const
{ {
Qt4Project *qt4Project = qobject_cast<Qt4Project *>(project()); Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
QTC_ASSERT(qt4Project != 0, return 0); QTC_ASSERT(qt4bc, return 0);
MaemoToolChain *tc = dynamic_cast<MaemoToolChain *>( MaemoToolChain *tc = dynamic_cast<MaemoToolChain *>(
qt4Project->toolChain(qt4Project->activeBuildConfiguration()) ); qt4bc->toolChain() );
QTC_ASSERT(tc != 0, return 0); QTC_ASSERT(tc != 0, return 0);
return tc; return tc;
} }
@@ -518,8 +517,8 @@ const QStringList MaemoRunConfiguration::arguments() const
const QString MaemoRunConfiguration::dumperLib() const const QString MaemoRunConfiguration::dumperLib() const
{ {
return project()->qtVersion(project()->activeBuildConfiguration())-> Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
debuggingHelperLibrary(); return qt4bc->qtVersion()->debuggingHelperLibrary();
} }
QString MaemoRunConfiguration::executable() const QString MaemoRunConfiguration::executable() const
@@ -668,6 +667,7 @@ void MaemoRunConfiguration::updateTarget()
m_cachedTargetInformationValid = true; m_cachedTargetInformationValid = true;
if (Qt4Project *qt4Project = static_cast<Qt4Project *>(project())) { if (Qt4Project *qt4Project = static_cast<Qt4Project *>(project())) {
Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
Qt4PriFileNode * priFileNode = qt4Project->rootProjectNode() Qt4PriFileNode * priFileNode = qt4Project->rootProjectNode()
->findProFileFor(m_proFilePath); ->findProFileFor(m_proFilePath);
if (!priFileNode) { if (!priFileNode) {
@@ -675,8 +675,7 @@ void MaemoRunConfiguration::updateTarget()
return; return;
} }
QtVersion *qtVersion = QtVersion *qtVersion = qt4bc->qtVersion();
qt4Project->qtVersion(qt4Project->activeBuildConfiguration());
ProFileReader *reader = priFileNode->createProFileReader(); ProFileReader *reader = priFileNode->createProFileReader();
reader->setCumulative(false); reader->setCumulative(false);
reader->setQtVersion(qtVersion); reader->setQtVersion(qtVersion);
@@ -724,8 +723,7 @@ void MaemoRunConfiguration::updateTarget()
QFileInfo(project()->file()->fileName()).absoluteDir(); QFileInfo(project()->file()->fileName()).absoluteDir();
QString relSubDir = QString relSubDir =
baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path()); baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path());
QDir baseBuildDirectory = QDir baseBuildDirectory = qt4bc->buildDirectory();
project()->buildDirectory(project()->activeBuildConfiguration());
QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir); QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir);
if (!reader->contains("DESTDIR")) { if (!reader->contains("DESTDIR")) {
@@ -1324,11 +1322,10 @@ const QString AbstractMaemoRunControl::targetCmdLinePrefix() const
bool AbstractMaemoRunControl::setProcessEnvironment(QProcess &process) bool AbstractMaemoRunControl::setProcessEnvironment(QProcess &process)
{ {
QTC_ASSERT(runConfig, return false); QTC_ASSERT(runConfig, return false);
Qt4Project *qt4Project = qobject_cast<Qt4Project *>(runConfig->project()); Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(runConfig->project()->activeBuildConfiguration());
QTC_ASSERT(qt4Project, return false); QTC_ASSERT(qt4bc, return false);
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
qt4Project->toolChain(qt4Project->activeBuildConfiguration()) qt4bc->toolChain()->addToEnvironment(env);
->addToEnvironment(env);
process.setEnvironment(env.toStringList()); process.setEnvironment(env.toStringList());
return true; return true;

View File

@@ -37,6 +37,7 @@
#include "s60runconfigbluetoothstarter.h" #include "s60runconfigbluetoothstarter.h"
#include "bluetoothlistener_gui.h" #include "bluetoothlistener_gui.h"
#include "serialdevicelister.h" #include "serialdevicelister.h"
#include "qt4buildconfiguration.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
@@ -106,21 +107,22 @@ QString S60DeviceRunConfiguration::type() const
ProjectExplorer::ToolChain::ToolChainType S60DeviceRunConfiguration::toolChainType( ProjectExplorer::ToolChain::ToolChainType S60DeviceRunConfiguration::toolChainType(
ProjectExplorer::BuildConfiguration *configuration) const ProjectExplorer::BuildConfiguration *configuration) const
{ {
if (const Qt4Project *pro = qobject_cast<const Qt4Project*>(project())) if (Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(configuration))
return pro->toolChainType(configuration); return bc->toolChainType();
return ProjectExplorer::ToolChain::INVALID; return ProjectExplorer::ToolChain::INVALID;
} }
ProjectExplorer::ToolChain::ToolChainType S60DeviceRunConfiguration::toolChainType() const ProjectExplorer::ToolChain::ToolChainType S60DeviceRunConfiguration::toolChainType() const
{ {
if (const Qt4Project *pro = qobject_cast<const Qt4Project*>(project())) if (Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration()))
return pro->toolChainType(pro->activeBuildConfiguration()); return bc->toolChainType();
return ProjectExplorer::ToolChain::INVALID; return ProjectExplorer::ToolChain::INVALID;
} }
bool S60DeviceRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const bool S60DeviceRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const
{ {
const ToolChain::ToolChainType type = toolChainType(configuration); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(configuration);
const ToolChain::ToolChainType type = qt4bc->toolChainType();
return type == ToolChain::GCCE || type == ToolChain::RVCT_ARMV5 || type == ToolChain::RVCT_ARMV6; return type == ToolChain::GCCE || type == ToolChain::RVCT_ARMV5 || type == ToolChain::RVCT_ARMV6;
} }
@@ -243,9 +245,8 @@ QString S60DeviceRunConfiguration::packageFileName() const
QString S60DeviceRunConfiguration::localExecutableFileName() const QString S60DeviceRunConfiguration::localExecutableFileName() const
{ {
Qt4Project *qt4project = qobject_cast<Qt4Project *>(project()); Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
S60Devices::Device device = S60Manager::instance()->deviceForQtVersion( S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(qt4bc->qtVersion());
qt4project->qtVersion(qt4project->activeBuildConfiguration()));
QString localExecutable = device.epocRoot; QString localExecutable = device.epocRoot;
localExecutable += QString::fromLatin1("/epoc32/release/%1/%2/%3.exe") localExecutable += QString::fromLatin1("/epoc32/release/%1/%2/%3.exe")
@@ -258,7 +259,7 @@ void S60DeviceRunConfiguration::updateTarget()
{ {
if (m_cachedTargetInformationValid) if (m_cachedTargetInformationValid)
return; return;
Qt4Project *pro = static_cast<Qt4Project *>(project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath); Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath);
if (!priFileNode) { if (!priFileNode) {
m_baseFileName = QString::null; m_baseFileName = QString::null;
@@ -266,7 +267,7 @@ void S60DeviceRunConfiguration::updateTarget()
emit targetInformationChanged(); emit targetInformationChanged();
return; return;
} }
QtVersion *qtVersion = pro->qtVersion(pro->activeBuildConfiguration()); QtVersion *qtVersion = qt4bc->qtVersion();
ProFileReader *reader = priFileNode->createProFileReader(); ProFileReader *reader = priFileNode->createProFileReader();
reader->setCumulative(false); reader->setCumulative(false);
reader->setQtVersion(qtVersion); reader->setQtVersion(qtVersion);
@@ -274,7 +275,7 @@ void S60DeviceRunConfiguration::updateTarget()
// Find out what flags we pass on to qmake, this code is duplicated in the qmake step // Find out what flags we pass on to qmake, this code is duplicated in the qmake step
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion->defaultBuildConfig(); QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion->defaultBuildConfig();
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfigs projectBuildConfiguration =
QtVersion::QmakeBuildConfigs(pro->activeBuildConfiguration()->value("buildConfiguration").toInt()); QtVersion::QmakeBuildConfigs(qt4bc->value("buildConfiguration").toInt());
QStringList addedUserConfigArguments; QStringList addedUserConfigArguments;
QStringList removedUserConfigArguments; QStringList removedUserConfigArguments;
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll)) if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll))
@@ -297,7 +298,7 @@ void S60DeviceRunConfiguration::updateTarget()
// Extract data // Extract data
const QDir baseProjectDirectory = QFileInfo(project()->file()->fileName()).absoluteDir(); const QDir baseProjectDirectory = QFileInfo(project()->file()->fileName()).absoluteDir();
const QString relSubDir = baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path()); const QString relSubDir = baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path());
const QDir baseBuildDirectory = project()->buildDirectory(project()->activeBuildConfiguration()); const QDir baseBuildDirectory = qt4bc->buildDirectory();
const QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir); const QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir);
// Directory // Directory
@@ -319,7 +320,7 @@ void S60DeviceRunConfiguration::updateTarget()
m_packageTemplateFileName = QDir::cleanPath( m_packageTemplateFileName = QDir::cleanPath(
m_workingDir + QLatin1Char('/') + m_targetName + QLatin1String("_template.pkg")); m_workingDir + QLatin1Char('/') + m_targetName + QLatin1String("_template.pkg"));
switch (pro->toolChainType(pro->activeBuildConfiguration())) { switch (qt4bc->toolChainType()) {
case ToolChain::GCCE: case ToolChain::GCCE:
case ToolChain::GCCE_GNUPOC: case ToolChain::GCCE_GNUPOC:
m_platform = QLatin1String("gcce"); m_platform = QLatin1String("gcce");
@@ -417,8 +418,8 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
connect(m_makesis, SIGNAL(finished(int,QProcess::ExitStatus)), connect(m_makesis, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(makesisProcessFinished())); this, SLOT(makesisProcessFinished()));
Qt4Project *project = qobject_cast<Qt4Project *>(runConfiguration->project()); Qt4BuildConfiguration *activeBuildConf =
QTC_ASSERT(project, return); static_cast<Qt4BuildConfiguration *>(runConfiguration->project()->activeBuildConfiguration());
S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration); S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
QTC_ASSERT(s60runConfig, return); QTC_ASSERT(s60runConfig, return);
@@ -432,18 +433,17 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
m_symbianTarget = s60runConfig->symbianTarget(); m_symbianTarget = s60runConfig->symbianTarget();
m_packageTemplateFile = s60runConfig->packageTemplateFileName(); m_packageTemplateFile = s60runConfig->packageTemplateFileName();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath(); m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
m_qtDir = project->qtVersion(project->activeBuildConfiguration())->versionInfo().value("QT_INSTALL_DATA"); m_qtDir = activeBuildConf->qtVersion()->versionInfo().value("QT_INSTALL_DATA");
m_useCustomSignature = (s60runConfig->signingMode() == S60DeviceRunConfiguration::SignCustom); m_useCustomSignature = (s60runConfig->signingMode() == S60DeviceRunConfiguration::SignCustom);
m_customSignaturePath = s60runConfig->customSignaturePath(); m_customSignaturePath = s60runConfig->customSignaturePath();
m_customKeyPath = s60runConfig->customKeyPath(); m_customKeyPath = s60runConfig->customKeyPath();
ProjectExplorer::BuildConfiguration *const activeBuildConf = project->activeBuildConfiguration(); const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(activeBuildConf->qtVersion());
const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(project->qtVersion(activeBuildConf));
switch (m_toolChain) { switch (m_toolChain) {
case ProjectExplorer::ToolChain::GCCE_GNUPOC: case ProjectExplorer::ToolChain::GCCE_GNUPOC:
case ProjectExplorer::ToolChain::RVCT_ARMV6_GNUPOC: { case ProjectExplorer::ToolChain::RVCT_ARMV6_GNUPOC: {
// 'sis' is a make target here. Set up with correct environment // 'sis' is a make target here. Set up with correct environment
ProjectExplorer::ToolChain *toolchain = project->toolChain(activeBuildConf); ProjectExplorer::ToolChain *toolchain = activeBuildConf->toolChain();
m_makesisTool = toolchain->makeCommand(); m_makesisTool = toolchain->makeCommand();
m_toolsDirectory = device.epocRoot + QLatin1String("/epoc32/tools"); m_toolsDirectory = device.epocRoot + QLatin1String("/epoc32/tools");
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();

View File

@@ -34,6 +34,7 @@
#include "profilereader.h" #include "profilereader.h"
#include "s60manager.h" #include "s60manager.h"
#include "s60devices.h" #include "s60devices.h"
#include "qt4buildconfiguration.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
@@ -78,9 +79,9 @@ QString S60EmulatorRunConfiguration::type() const
bool S60EmulatorRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const bool S60EmulatorRunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const
{ {
Qt4Project *pro = qobject_cast<Qt4Project*>(project()); Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(configuration);
QTC_ASSERT(pro, return false); QTC_ASSERT(qt4bc, return false);
ToolChain::ToolChainType type = pro->toolChainType(configuration); ToolChain::ToolChainType type = qt4bc->toolChainType();
return type == ToolChain::WINSCW; return type == ToolChain::WINSCW;
} }
@@ -113,7 +114,7 @@ void S60EmulatorRunConfiguration::updateTarget()
{ {
if (m_cachedTargetInformationValid) if (m_cachedTargetInformationValid)
return; return;
Qt4Project *pro = static_cast<Qt4Project *>(project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath); Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath);
if (!priFileNode) { if (!priFileNode) {
m_executable = QString::null; m_executable = QString::null;
@@ -121,15 +122,14 @@ void S60EmulatorRunConfiguration::updateTarget()
emit targetInformationChanged(); emit targetInformationChanged();
return; return;
} }
QtVersion *qtVersion = pro->qtVersion(pro->activeBuildConfiguration()); QtVersion *qtVersion = qt4bc->qtVersion();
ProFileReader *reader = priFileNode->createProFileReader(); ProFileReader *reader = priFileNode->createProFileReader();
reader->setCumulative(false); reader->setCumulative(false);
reader->setQtVersion(qtVersion); reader->setQtVersion(qtVersion);
// Find out what flags we pass on to qmake, this code is duplicated in the qmake step // Find out what flags we pass on to qmake, this code is duplicated in the qmake step
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion->defaultBuildConfig(); QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qtVersion->defaultBuildConfig();
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(pro->activeBuildConfiguration() QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(qt4bc->value("buildConfiguration").toInt());
->value("buildConfiguration").toInt());
QStringList addedUserConfigArguments; QStringList addedUserConfigArguments;
QStringList removedUserConfigArguments; QStringList removedUserConfigArguments;
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll)) if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll))
@@ -283,7 +283,7 @@ S60EmulatorRunControl::S60EmulatorRunControl(S60EmulatorRunConfiguration *runCon
// stuff like the EPOCROOT and EPOCDEVICE env variable // stuff like the EPOCROOT and EPOCDEVICE env variable
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
Project *project = runConfiguration->project(); Project *project = runConfiguration->project();
static_cast<Qt4Project *>(project)->toolChain(project->activeBuildConfiguration())->addToEnvironment(env); static_cast<Qt4BuildConfiguration *>(project->activeBuildConfiguration())->toolChain()->addToEnvironment(env);
m_applicationLauncher.setEnvironment(env.toStringList()); m_applicationLauncher.setEnvironment(env.toStringList());
m_executable = runConfiguration->executable(); m_executable = runConfiguration->executable();

View File

@@ -32,7 +32,15 @@
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::BuildConfiguration; using namespace ProjectExplorer;
namespace {
bool debug = false;
}
namespace {
const char * const KEY_QT_VERSION_ID = "QtVersionId";
}
Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Project *pro) Qt4BuildConfiguration::Qt4BuildConfiguration(Qt4Project *pro)
: BuildConfiguration(pro) : BuildConfiguration(pro)
@@ -50,3 +58,257 @@ Qt4BuildConfiguration::~Qt4BuildConfiguration()
{ {
} }
ProjectExplorer::Environment Qt4BuildConfiguration::baseEnvironment() const
{
Environment env = useSystemEnvironment() ? Environment::systemEnvironment() : Environment();
qtVersion()->addToEnvironment(env);
ToolChain *tc = toolChain();
if (tc)
tc->addToEnvironment(env);
return env;
}
ProjectExplorer::Environment Qt4BuildConfiguration::environment() const
{
Environment env = baseEnvironment();
env.modify(userEnvironmentChanges());
return env;
}
void Qt4BuildConfiguration::setUseSystemEnvironment(bool b)
{
if (useSystemEnvironment() == b)
return;
setValue("clearSystemEnvironment", !b);
emit environmentChanged();
}
bool Qt4BuildConfiguration::useSystemEnvironment() const
{
bool b = !(value("clearSystemEnvironment").isValid()
&& value("clearSystemEnvironment").toBool());
return b;
}
QList<ProjectExplorer::EnvironmentItem> Qt4BuildConfiguration::userEnvironmentChanges() const
{
return EnvironmentItem::fromStringList(value("userEnvironmentChanges").toStringList());
}
void Qt4BuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
{
QStringList list = EnvironmentItem::toStringList(diff);
if (list == value("userEnvironmentChanges").toStringList())
return;
setValue("userEnvironmentChanges", list);
emit environmentChanged();
}
QString Qt4BuildConfiguration::buildDirectory() const
{
QString workingDirectory;
if (value("useShadowBuild").toBool())
workingDirectory = value("buildDirectory").toString();
if (workingDirectory.isEmpty())
workingDirectory = QFileInfo(project()->file()->fileName()).absolutePath();
return workingDirectory;
}
ProjectExplorer::ToolChain *Qt4BuildConfiguration::toolChain() const
{
ToolChain::ToolChainType tct = toolChainType();
return qtVersion()->toolChain(tct);
}
QString Qt4BuildConfiguration::makeCommand() const
{
ToolChain *tc = toolChain();
return tc ? tc->makeCommand() : "make";
}
#ifdef QTCREATOR_WITH_S60
static inline QString symbianMakeTarget(QtVersion::QmakeBuildConfig buildConfig,
const QString &type)
{
QString rc = (buildConfig & QtVersion::DebugBuild) ?
QLatin1String("debug-") : QLatin1String("release-");
rc += type;
return rc;
}
#endif
QString Qt4BuildConfiguration::defaultMakeTarget() const
{
#ifdef QTCREATOR_WITH_S60
ToolChain *tc = toolChain();
if (!tc)
return QString::null;
const QtVersion::QmakeBuildConfig buildConfig
= QtVersion::QmakeBuildConfig(value("buildConfiguration").toInt());
switch (tc->type()) {
case ToolChain::GCCE:
case ToolChain::GCCE_GNUPOC:
return symbianMakeTarget(buildConfig, QLatin1String("gcce"));
case ToolChain::RVCT_ARMV5:
return symbianMakeTarget(buildConfig, QLatin1String("armv5"));
case ToolChain::RVCT_ARMV6:
case ToolChain::RVCT_ARMV6_GNUPOC:
return symbianMakeTarget(buildConfig, QLatin1String("armv6"));
default:
break;
}
#else
#endif
return QString::null;
}
QString Qt4BuildConfiguration::qtDir() const
{
QtVersion *version = qtVersion();
if (version)
return version->versionInfo().value("QT_INSTALL_DATA");
return QString::null;
}
QtVersion *Qt4BuildConfiguration::qtVersion() const
{
return QtVersionManager::instance()->version(qtVersionId());
}
int Qt4BuildConfiguration::qtVersionId() const
{
QtVersionManager *vm = QtVersionManager::instance();
if (debug)
qDebug()<<"Looking for qtVersion ID of "<<displayName();
int id = 0;
QVariant vid = value(KEY_QT_VERSION_ID);
if (vid.isValid()) {
id = vid.toInt();
if (vm->version(id)->isValid()) {
return id;
} else {
const_cast<Qt4BuildConfiguration *>(this)->setValue(KEY_QT_VERSION_ID, 0);
return 0;
}
} else {
// Backward compatibilty, we might have just the name:
QString vname = value("QtVersion").toString();
if (debug)
qDebug()<<" Backward compatibility reading QtVersion"<<vname;
if (!vname.isEmpty()) {
const QList<QtVersion *> &versions = vm->versions();
foreach (const QtVersion * const version, versions) {
if (version->name() == vname) {
if (debug)
qDebug()<<"found name in versions";
const_cast<Qt4BuildConfiguration *>(this)->setValue(KEY_QT_VERSION_ID, version->uniqueId());
return version->uniqueId();
}
}
}
}
if (debug)
qDebug()<<" using qtversion with id ="<<id;
// Nothing found, reset to default
const_cast<Qt4BuildConfiguration *>(this)->setValue(KEY_QT_VERSION_ID, id);
return id;
}
void Qt4BuildConfiguration::setQtVersion(int id)
{
setValue(KEY_QT_VERSION_ID, id);
emit qtVersionChanged();
static_cast<Qt4Project *>(project())->updateActiveRunConfiguration();
}
void Qt4BuildConfiguration::setToolChainType(ProjectExplorer::ToolChain::ToolChainType type)
{
setValue("ToolChain", (int)type);
static_cast<Qt4Project *>(project())->updateActiveRunConfiguration();
}
ProjectExplorer::ToolChain::ToolChainType Qt4BuildConfiguration::toolChainType() const
{
ToolChain::ToolChainType originalType = ToolChain::ToolChainType(value("ToolChain").toInt());
ToolChain::ToolChainType type = originalType;
const QtVersion *version = qtVersion();
if (!version->possibleToolChainTypes().contains(type)) {
// Oh no the saved type is not valid for this qt version
// use default tool chain
type = version->defaultToolchainType();
const_cast<Qt4BuildConfiguration *>(this)->setToolChainType(type);
}
return type;
}
QMakeStep *Qt4BuildConfiguration::qmakeStep() const
{
QMakeStep *qs = 0;
foreach(BuildStep *bs, buildSteps())
if ((qs = qobject_cast<QMakeStep *>(bs)) != 0)
return qs;
return 0;
}
MakeStep *Qt4BuildConfiguration::makeStep() const
{
MakeStep *qs = 0;
foreach(BuildStep *bs, buildSteps())
if ((qs = qobject_cast<MakeStep *>(bs)) != 0)
return qs;
return 0;
}
// returns true if both are equal
bool Qt4BuildConfiguration::compareBuildConfigurationToImportFrom(const QString &workingDirectory)
{
QMakeStep *qs = qmakeStep();
if (QDir(workingDirectory).exists(QLatin1String("Makefile")) && qs) {
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
QtVersion *version = qtVersion();
if (version->qmakeCommand() == qmakePath) {
// same qtversion
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
QtVersionManager::scanMakeFile(workingDirectory, version->defaultBuildConfig());
if (QtVersion::QmakeBuildConfig(value("buildConfiguration").toInt()) == result.first) {
// The QMake Build Configuration are the same,
// now compare arguments lists
// we have to compare without the spec/platform cmd argument
// and compare that on its own
QString actualSpec = Qt4Project::extractSpecFromArgumentList(qs->qmakeArguments(), workingDirectory, version);
if (actualSpec.isEmpty()) {
// Easy one the user has choosen not to override the settings
actualSpec = version->mkspec();
}
QString parsedSpec = Qt4Project::extractSpecFromArgumentList(result.second, workingDirectory, version);
QStringList actualArgs = Qt4Project::removeSpecFromArgumentList(qs->qmakeArguments());
QStringList parsedArgs = Qt4Project::removeSpecFromArgumentList(result.second);
if (debug) {
qDebug()<<"Actual args:"<<actualArgs;
qDebug()<<"Parsed args:"<<parsedArgs;
qDebug()<<"Actual spec:"<<actualSpec;
qDebug()<<"Parsed spec:"<<parsedSpec;
}
if (actualArgs == parsedArgs) {
// Specs match exactly
if (actualSpec == parsedSpec)
return true;
// Actual spec is the default one
// qDebug()<<"AS vs VS"<<actualSpec<<version->mkspec();
if ((actualSpec == version->mkspec() || actualSpec == "default")
&& (parsedSpec == version->mkspec() || parsedSpec == "default" || parsedSpec.isEmpty()))
return true;
}
}
}
}
return false;
}

View File

@@ -31,10 +31,14 @@
#define QT4BUILDCONFIGURATION_H #define QT4BUILDCONFIGURATION_H
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/toolchain.h>
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
class Qt4Project; class Qt4Project;
class QtVersion;
class QMakeStep;
class MakeStep;
namespace Internal { namespace Internal {
@@ -46,6 +50,53 @@ public:
// copy ctor // copy ctor
Qt4BuildConfiguration(Qt4BuildConfiguration *source); Qt4BuildConfiguration(Qt4BuildConfiguration *source);
~Qt4BuildConfiguration(); ~Qt4BuildConfiguration();
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;
// returns the qtdir (depends on the current QtVersion)
QString qtDir() const;
//returns the qtVersion, if the project is set to use the default qt version, then
// that is returned
// to check wheter the project uses the default qt version use qtVersionId
QtVersion *qtVersion() const;
// returns the id of the qt version, if the project is using the default qt version
// this function returns 0
int qtVersionId() const;
//returns the name of the qt version, might be QString::Null, which means default qt version
// qtVersion is in general the better method to use
QString qtVersionName() const;
void setQtVersion(int id);
ProjectExplorer::ToolChain *toolChain() const;
void setToolChainType(ProjectExplorer::ToolChain::ToolChainType type);
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
// Those functions are used in a few places.
// The drawback is that we shouldn't actually depend on them beeing always there
// That is generally the stuff that is asked should normally be transfered to
// Qt4Project *
// So that we can later enable people to build qt4projects the way they would like
QMakeStep *qmakeStep() const;
MakeStep *makeStep() const;
QString makeCommand() const;
QString defaultMakeTarget() const;
// TODO rename
bool compareBuildConfigurationToImportFrom(const QString &workingDirectory);
signals:
void qtVersionChanged();
}; };
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -29,6 +29,7 @@
#include "qt4buildenvironmentwidget.h" #include "qt4buildenvironmentwidget.h"
#include "qt4project.h" #include "qt4project.h"
#include "qt4buildconfiguration.h"
#include <projectexplorer/environmenteditmodel.h> #include <projectexplorer/environmenteditmodel.h>
@@ -70,20 +71,20 @@ void Qt4BuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
if (debug) if (debug)
qDebug() << "Qt4BuildConfigWidget::init()"; qDebug() << "Qt4BuildConfigWidget::init()";
m_buildConfiguration = bc; m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(m_buildConfiguration)); m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(m_buildConfiguration)); m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(m_buildConfiguration)); m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
m_buildEnvironmentWidget->updateButtons(); m_buildEnvironmentWidget->updateButtons();
} }
void Qt4BuildEnvironmentWidget::environmentModelUserChangesUpdated() void Qt4BuildEnvironmentWidget::environmentModelUserChangesUpdated()
{ {
m_pro->setUserEnvironmentChanges(m_buildConfiguration, m_buildEnvironmentWidget->userChanges()); m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
} }
void Qt4BuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked) void Qt4BuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
{ {
m_pro->setUseSystemEnvironment(m_buildConfiguration, !checked); m_buildConfiguration->setUseSystemEnvironment(!checked);
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(m_buildConfiguration)); m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
} }

View File

@@ -45,6 +45,8 @@ namespace Qt4ProjectManager {
class Qt4Project; class Qt4Project;
namespace Internal { namespace Internal {
class Qt4BuildConfiguration;
class Qt4BuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget class Qt4BuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
{ {
Q_OBJECT Q_OBJECT
@@ -63,7 +65,7 @@ private:
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget; ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
QCheckBox *m_clearSystemEnvironmentCheckBox; QCheckBox *m_clearSystemEnvironmentCheckBox;
Qt4Project *m_pro; Qt4Project *m_pro;
ProjectExplorer::BuildConfiguration *m_buildConfiguration; Qt4BuildConfiguration *m_buildConfiguration;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -35,6 +35,7 @@
#include "qt4project.h" #include "qt4project.h"
#include "qt4projectmanager.h" #include "qt4projectmanager.h"
#include "qtuicodemodelsupport.h" #include "qtuicodemodelsupport.h"
#include "qt4buildconfiguration.h"
#include <projectexplorer/nodesvisitor.h> #include <projectexplorer/nodesvisitor.h>
#include <projectexplorer/filewatcher.h> #include <projectexplorer/filewatcher.h>
@@ -1101,7 +1102,9 @@ ProFileReader *Qt4PriFileNode::createProFileReader() const
connect(reader, SIGNAL(errorFound(QString)), connect(reader, SIGNAL(errorFound(QString)),
m_project, SLOT(proFileParseError(QString))); m_project, SLOT(proFileParseError(QString)));
QtVersion *version = m_project->qtVersion(m_project->activeBuildConfiguration()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(m_project->activeBuildConfiguration());
QtVersion *version = qt4bc->qtVersion();
if (version->isValid()) if (version->isValid())
reader->setQtVersion(version); reader->setQtVersion(version);
@@ -1202,7 +1205,7 @@ QString Qt4PriFileNode::buildDir() const
{ {
const QDir srcDirRoot = QFileInfo(m_project->rootProjectNode()->path()).absoluteDir(); const QDir srcDirRoot = QFileInfo(m_project->rootProjectNode()->path()).absoluteDir();
const QString relativeDir = srcDirRoot.relativeFilePath(m_projectDir); const QString relativeDir = srcDirRoot.relativeFilePath(m_projectDir);
return QDir(m_project->buildDirectory(m_project->activeBuildConfiguration())).absoluteFilePath(relativeDir); return QDir(m_project->activeBuildConfiguration()->buildDirectory()).absoluteFilePath(relativeDir);
} }
/* /*

View File

@@ -42,6 +42,7 @@
#include "projectloadwizard.h" #include "projectloadwizard.h"
#include "qtversionmanager.h" #include "qtversionmanager.h"
#include "qt4buildconfiguration.h" #include "qt4buildconfiguration.h"
#include "qt4buildconfiguration.h"
#ifdef QTCREATOR_WITH_S60 #ifdef QTCREATOR_WITH_S60
#include "qt-s60/gccetoolchain.h" #include "qt-s60/gccetoolchain.h"
@@ -68,10 +69,6 @@ using namespace ProjectExplorer;
enum { debug = 0 }; enum { debug = 0 };
namespace {
const char * const KEY_QT_VERSION_ID = "QtVersionId";
}
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
@@ -341,7 +338,7 @@ Qt4Project::~Qt4Project()
void Qt4Project::defaultQtVersionChanged() void Qt4Project::defaultQtVersionChanged()
{ {
if (qtVersionId(activeBuildConfiguration()) == 0) if (static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration())->qtVersionId() == 0)
m_rootProjectNode->update(); m_rootProjectNode->update();
} }
@@ -349,9 +346,10 @@ void Qt4Project::qtVersionsChanged()
{ {
QtVersionManager *vm = QtVersionManager::instance(); QtVersionManager *vm = QtVersionManager::instance();
foreach (BuildConfiguration *bc, buildConfigurations()) { foreach (BuildConfiguration *bc, buildConfigurations()) {
if (!vm->version(qtVersionId(bc))->isValid()) { Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(bc);
setQtVersion(bc, 0); if (!vm->version(qt4bc->qtVersionId())->isValid()) {
if (bc == activeBuildConfiguration()) qt4bc->setQtVersion(0);
if (qt4bc == activeBuildConfiguration())
m_rootProjectNode->update(); m_rootProjectNode->update();
} }
} }
@@ -381,8 +379,9 @@ bool Qt4Project::restoreSettingsImpl(PersistentSettingsReader &settingsReader)
// or if not, is reset to the default // or if not, is reset to the default
foreach (BuildConfiguration *bc, buildConfigurations()) { foreach (BuildConfiguration *bc, buildConfigurations()) {
qtVersionId(bc); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(bc);
toolChainType(bc); qt4bc->qtVersionId();
qt4bc->toolChainType();
} }
m_rootProjectNode = new Qt4ProFileNode(this, m_fileInfo->fileName(), this); m_rootProjectNode = new Qt4ProFileNode(this, m_fileInfo->fileName(), this);
@@ -473,7 +472,7 @@ Qt4BuildConfiguration *Qt4Project::addQt4BuildConfiguration(QString buildConfigu
cleanStep->setClean(true); cleanStep->setClean(true);
bc->insertCleanStep(0, cleanStep); bc->insertCleanStep(0, cleanStep);
if (!additionalArguments.isEmpty()) if (!additionalArguments.isEmpty())
qmakeStep->m_qmakeArgs = additionalArguments; qmakeStep->setQMakeArguments(additionalArguments);
// set some options for qmake and make // set some options for qmake and make
if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets
@@ -484,9 +483,9 @@ Qt4BuildConfiguration *Qt4Project::addQt4BuildConfiguration(QString buildConfigu
// Finally set the qt version // Finally set the qt version
bool defaultQtVersion = (qtversion == 0); bool defaultQtVersion = (qtversion == 0);
if (defaultQtVersion) if (defaultQtVersion)
setQtVersion(bc, 0); bc->setQtVersion(0);
else else
setQtVersion(bc, qtversion->uniqueId()); bc->setQtVersion(qtversion->uniqueId());
return bc; return bc;
} }
@@ -517,61 +516,13 @@ void Qt4Project::scheduleUpdateCodeModel(Qt4ProjectManager::Internal::Qt4ProFile
m_proFilesForCodeModelUpdate.append(pro); m_proFilesForCodeModelUpdate.append(pro);
} }
ProjectExplorer::ToolChain *Qt4Project::toolChain(BuildConfiguration *configuration) const
{
ToolChain::ToolChainType tct = toolChainType(configuration);
return qtVersion(configuration)->toolChain(tct);
}
QString Qt4Project::makeCommand(BuildConfiguration *configuration) const
{
ToolChain *tc = toolChain(configuration);
return tc ? tc->makeCommand() : "make";
}
#ifdef QTCREATOR_WITH_S60
static inline QString symbianMakeTarget(QtVersion::QmakeBuildConfig buildConfig,
const QString &type)
{
QString rc = (buildConfig & QtVersion::DebugBuild) ?
QLatin1String("debug-") : QLatin1String("release-");
rc += type;
return rc;
}
#endif
QString Qt4Project::defaultMakeTarget(BuildConfiguration *configuration) const
{
#ifdef QTCREATOR_WITH_S60
ToolChain *tc = toolChain(configuration);
if (!tc)
return QString::null;
const QtVersion::QmakeBuildConfig buildConfig
= QtVersion::QmakeBuildConfig(activeBuildConfiguration()->value("buildConfiguration").toInt());
switch (tc->type()) {
case ToolChain::GCCE:
case ToolChain::GCCE_GNUPOC:
return symbianMakeTarget(buildConfig, QLatin1String("gcce"));
case ToolChain::RVCT_ARMV5:
return symbianMakeTarget(buildConfig, QLatin1String("armv5"));
case ToolChain::RVCT_ARMV6:
case ToolChain::RVCT_ARMV6_GNUPOC:
return symbianMakeTarget(buildConfig, QLatin1String("armv6"));
default:
break;
}
#else
Q_UNUSED(configuration);
#endif
return QString::null;
}
void Qt4Project::updateCodeModel() void Qt4Project::updateCodeModel()
{ {
if (debug) if (debug)
qDebug()<<"Qt4Project::updateCodeModel()"; qDebug()<<"Qt4Project::updateCodeModel()";
Qt4BuildConfiguration *activeQt4BuildConfiguration = static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration());
CppTools::CppModelManagerInterface *modelmanager = CppTools::CppModelManagerInterface *modelmanager =
ExtensionSystem::PluginManager::instance() ExtensionSystem::PluginManager::instance()
->getObject<CppTools::CppModelManagerInterface>(); ->getObject<CppTools::CppModelManagerInterface>();
@@ -583,7 +534,7 @@ void Qt4Project::updateCodeModel()
QStringList predefinedFrameworkPaths; QStringList predefinedFrameworkPaths;
QByteArray predefinedMacros; QByteArray predefinedMacros;
ToolChain *tc = toolChain(activeBuildConfiguration()); ToolChain *tc = activeQt4BuildConfiguration->toolChain();
QList<HeaderPath> allHeaderPaths; QList<HeaderPath> allHeaderPaths;
if (tc) { if (tc) {
predefinedMacros = tc->predefinedMacros(); predefinedMacros = tc->predefinedMacros();
@@ -602,7 +553,7 @@ void Qt4Project::updateCodeModel()
predefinedIncludePaths.append(headerPath.path()); predefinedIncludePaths.append(headerPath.path());
} }
const QHash<QString, QString> versionInfo = qtVersion(activeBuildConfiguration())->versionInfo(); const QHash<QString, QString> versionInfo = activeQt4BuildConfiguration->qtVersion()->versionInfo();
const QString newQtIncludePath = versionInfo.value(QLatin1String("QT_INSTALL_HEADERS")); const QString newQtIncludePath = versionInfo.value(QLatin1String("QT_INSTALL_HEADERS"));
predefinedIncludePaths.append(newQtIncludePath); predefinedIncludePaths.append(newQtIncludePath);
@@ -687,7 +638,7 @@ void Qt4Project::updateCodeModel()
} }
// Add mkspec directory // Add mkspec directory
info.includes.append(qtVersion(activeBuildConfiguration())->mkspecPath()); info.includes.append(activeQt4BuildConfiguration->qtVersion()->mkspecPath());
info.frameworkPaths = allFrameworkPaths; info.frameworkPaths = allFrameworkPaths;
@@ -701,7 +652,7 @@ void Qt4Project::updateCodeModel()
} }
// Add mkspec directory // Add mkspec directory
allIncludePaths.append(qtVersion(activeBuildConfiguration())->mkspecPath()); allIncludePaths.append(activeQt4BuildConfiguration->qtVersion()->mkspecPath());
// Dump things out // Dump things out
// This is debugging output... // This is debugging output...
@@ -784,7 +735,6 @@ QStringList Qt4Project::frameworkPaths(const QString &fileName) const
// */ // */
void Qt4Project::update() void Qt4Project::update()
{ {
// TODO Maybe remove this method completely?
m_rootProjectNode->update(); m_rootProjectNode->update();
//updateCodeModel(); //updateCodeModel();
} }
@@ -859,126 +809,6 @@ Qt4ProFileNode *Qt4Project::rootProjectNode() const
return m_rootProjectNode; return m_rootProjectNode;
} }
QString Qt4Project::buildDirectory(BuildConfiguration *configuration) const
{
QString workingDirectory;
if (configuration->value("useShadowBuild").toBool())
workingDirectory = configuration->value("buildDirectory").toString();
if (workingDirectory.isEmpty())
workingDirectory = QFileInfo(file()->fileName()).absolutePath();
return workingDirectory;
}
ProjectExplorer::Environment Qt4Project::baseEnvironment(BuildConfiguration *configuration) const
{
Environment env = useSystemEnvironment(configuration) ? Environment::systemEnvironment() : Environment();
qtVersion(configuration)->addToEnvironment(env);
ToolChain *tc = toolChain(configuration);
if (tc)
tc->addToEnvironment(env);
return env;
}
ProjectExplorer::Environment Qt4Project::environment(BuildConfiguration *configuration) const
{
Environment env = baseEnvironment(configuration);
env.modify(userEnvironmentChanges(configuration));
return env;
}
void Qt4Project::setUseSystemEnvironment(BuildConfiguration *configuration, bool b)
{
if (useSystemEnvironment(configuration) == b)
return;
configuration->setValue("clearSystemEnvironment", !b);
emit environmentChanged(configuration);
}
bool Qt4Project::useSystemEnvironment(BuildConfiguration *configuration) const
{
bool b = !(configuration->value("clearSystemEnvironment").isValid()
&& configuration->value("clearSystemEnvironment").toBool());
return b;
}
QList<ProjectExplorer::EnvironmentItem> Qt4Project::userEnvironmentChanges(BuildConfiguration *configuration) const
{
return EnvironmentItem::fromStringList(configuration->value("userEnvironmentChanges").toStringList());
}
void Qt4Project::setUserEnvironmentChanges(BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff)
{
QStringList list = EnvironmentItem::toStringList(diff);
if (list == configuration->value("userEnvironmentChanges").toStringList())
return;
configuration->setValue("userEnvironmentChanges", list);
emit environmentChanged(configuration);
}
QString Qt4Project::qtDir(BuildConfiguration *configuration) const
{
QtVersion *version = qtVersion(configuration);
if (version)
return version->versionInfo().value("QT_INSTALL_DATA");
return QString::null;
}
QtVersion *Qt4Project::qtVersion(BuildConfiguration *configuration) const
{
return QtVersionManager::instance()->version(qtVersionId(configuration));
}
int Qt4Project::qtVersionId(BuildConfiguration *configuration) const
{
QtVersionManager *vm = QtVersionManager::instance();
if (debug)
qDebug()<<"Looking for qtVersion ID of "<<configuration->displayName();
int id = 0;
QVariant vid = configuration->value(KEY_QT_VERSION_ID);
if (vid.isValid()) {
id = vid.toInt();
if (vm->version(id)->isValid()) {
return id;
} else {
configuration->setValue(KEY_QT_VERSION_ID, 0);
return 0;
}
} else {
// Backward compatibilty, we might have just the name:
QString vname = configuration->value("QtVersion").toString();
if (debug)
qDebug()<<" Backward compatibility reading QtVersion"<<vname;
if (!vname.isEmpty()) {
const QList<QtVersion *> &versions = vm->versions();
foreach (const QtVersion * const version, versions) {
if (version->name() == vname) {
if (debug)
qDebug()<<"found name in versions";
configuration->setValue(KEY_QT_VERSION_ID, version->uniqueId());
return version->uniqueId();
}
}
}
}
if (debug)
qDebug()<<" using qtversion with id ="<<id;
// Nothing found, reset to default
configuration->setValue(KEY_QT_VERSION_ID, id);
return id;
}
void Qt4Project::setQtVersion(BuildConfiguration *configuration, int id)
{
configuration->setValue(KEY_QT_VERSION_ID, id);
emit qtVersionChanged(configuration);
updateActiveRunConfiguration();
}
void Qt4Project::setToolChainType(BuildConfiguration *configuration, ProjectExplorer::ToolChain::ToolChainType type)
{
configuration->setValue("ToolChain", (int)type);
updateActiveRunConfiguration();
}
void Qt4Project::updateActiveRunConfiguration() void Qt4Project::updateActiveRunConfiguration()
{ {
@@ -986,18 +816,6 @@ void Qt4Project::updateActiveRunConfiguration()
emit targetInformationChanged(); emit targetInformationChanged();
} }
ProjectExplorer::ToolChain::ToolChainType Qt4Project::toolChainType(BuildConfiguration *configuration) const
{
ToolChain::ToolChainType originalType = ToolChain::ToolChainType(configuration->value("ToolChain").toInt());
ToolChain::ToolChainType type = originalType;
const QtVersion *version = qtVersion(configuration);
if (!version->possibleToolChainTypes().contains(type)) // use default tool chain
type = version->defaultToolchainType();
if (type != originalType)
const_cast<Qt4Project *>(this)->setToolChainType(configuration, type);
return type;
}
QString Qt4Project::extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version) QString Qt4Project::extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version)
{ {
int index = list.indexOf("-spec"); int index = list.indexOf("-spec");
@@ -1185,24 +1003,6 @@ void Qt4Project::proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *nod
} }
} }
QMakeStep *Qt4Project::qmakeStep(ProjectExplorer::BuildConfiguration *bc) const
{
QMakeStep *qs = 0;
foreach(BuildStep *bs, bc->buildSteps())
if ((qs = qobject_cast<QMakeStep *>(bs)) != 0)
return qs;
return 0;
}
MakeStep *Qt4Project::makeStep(ProjectExplorer::BuildConfiguration *bc) const
{
MakeStep *qs = 0;
foreach(BuildStep *bs, bc->buildSteps())
if ((qs = qobject_cast<MakeStep *>(bs)) != 0)
return qs;
return 0;
}
bool Qt4Project::hasSubNode(Qt4PriFileNode *root, const QString &path) bool Qt4Project::hasSubNode(Qt4PriFileNode *root, const QString &path)
{ {
if (root->path() == path) if (root->path() == path)
@@ -1243,11 +1043,6 @@ void Qt4Project::invalidateCachedTargetInformation()
emit targetInformationChanged(); emit targetInformationChanged();
} }
void Qt4Project::emitBuildDirectoryChanged()
{
emit buildDirectoryChanged();
}
// We match -spec and -platfrom separetly // We match -spec and -platfrom separetly
// We ignore -cache, because qmake contained a bug that it didn't // We ignore -cache, because qmake contained a bug that it didn't
// mention the -cache in the Makefile // mention the -cache in the Makefile
@@ -1274,56 +1069,6 @@ QStringList Qt4Project::removeSpecFromArgumentList(const QStringList &old)
return newList; return newList;
} }
// returns true if both are equal
bool Qt4Project::compareBuildConfigurationToImportFrom(BuildConfiguration *bc, const QString &workingDirectory)
{
QMakeStep *qs = qmakeStep(bc);
if (QDir(workingDirectory).exists(QLatin1String("Makefile")) && qs) {
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
QtVersion *version = qtVersion(bc);
if (version->qmakeCommand() == qmakePath) {
// same qtversion
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
QtVersionManager::scanMakeFile(workingDirectory, version->defaultBuildConfig());
if (QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt()) == result.first) {
// The QMake Build Configuration are the same,
// now compare arguments lists
// we have to compare without the spec/platform cmd argument
// and compare that on its own
QString actualSpec = extractSpecFromArgumentList(qs->m_qmakeArgs, workingDirectory, version);
if (actualSpec.isEmpty()) {
// Easy one the user has choosen not to override the settings
actualSpec = version->mkspec();
}
QString parsedSpec = extractSpecFromArgumentList(result.second, workingDirectory, version);
QStringList actualArgs = removeSpecFromArgumentList(qs->m_qmakeArgs);
QStringList parsedArgs = removeSpecFromArgumentList(result.second);
if (debug) {
qDebug()<<"Actual args:"<<actualArgs;
qDebug()<<"Parsed args:"<<parsedArgs;
qDebug()<<"Actual spec:"<<actualSpec;
qDebug()<<"Parsed spec:"<<parsedSpec;
}
if (actualArgs == parsedArgs) {
// Specs match exactly
if (actualSpec == parsedSpec)
return true;
// Actual spec is the default one
// qDebug()<<"AS vs VS"<<actualSpec<<version->mkspec();
if ((actualSpec == version->mkspec() || actualSpec == "default")
&& (parsedSpec == version->mkspec() || parsedSpec == "default" || parsedSpec.isEmpty()))
return true;
}
}
}
}
return false;
}
/*! /*!
Handle special case were a subproject of the qt directory is opened, and Handle special case were a subproject of the qt directory is opened, and

View File

@@ -178,70 +178,34 @@ public:
virtual QStringList files(FilesMode fileMode) const; virtual QStringList files(FilesMode fileMode) 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;
// returns the CONFIG variable from the .pro file // returns the CONFIG variable from the .pro file
QStringList qmakeConfig() const; QStringList qmakeConfig() const;
// returns the qtdir (depends on the current QtVersion)
QString qtDir(ProjectExplorer::BuildConfiguration *configuration) const;
//returns the qtVersion, if the project is set to use the default qt version, then
// that is returned
// to check wheter the project uses the default qt version use qtVersionId
QtVersion *qtVersion(ProjectExplorer::BuildConfiguration *configuration) const;
// returns the id of the qt version, if the project is using the default qt version
// this function returns 0
int qtVersionId(ProjectExplorer::BuildConfiguration *configuration) const;
//returns the name of the qt version, might be QString::Null, which means default qt version
// qtVersion is in general the better method to use
QString qtVersionName(ProjectExplorer::BuildConfiguration *configuration) const;
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::BuildConfiguration *configuration) const;
void setToolChainType(ProjectExplorer::BuildConfiguration *configuration, ProjectExplorer::ToolChain::ToolChainType type);
ProjectExplorer::ToolChain::ToolChainType toolChainType(ProjectExplorer::BuildConfiguration *configuration) const;
ProjectExplorer::BuildConfigWidget *createConfigWidget(); ProjectExplorer::BuildConfigWidget *createConfigWidget();
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets(); QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
void setQtVersion(ProjectExplorer::BuildConfiguration *configuration, int id);
QList<Internal::Qt4ProFileNode *> applicationProFiles() const; QList<Internal::Qt4ProFileNode *> applicationProFiles() const;
// Those functions are used in a few places.
// The drawback is that we shouldn't actually depend on them beeing always there
// That is generally the stuff that is asked should normally be transfered to
// Qt4Project *
// So that we can later enable people to build qt4projects the way they would like
QMakeStep *qmakeStep(ProjectExplorer::BuildConfiguration *bc) const;
MakeStep *makeStep(ProjectExplorer::BuildConfiguration *bc) const;
void notifyChanged(const QString &name); void notifyChanged(const QString &name);
QString makeCommand(ProjectExplorer::BuildConfiguration *configuration) const;
QString defaultMakeTarget(ProjectExplorer::BuildConfiguration *configuration) const;
// Is called by qmakestep qt4configurationwidget if the settings change // Is called by qmakestep qt4configurationwidget if the settings change
// Informs all Qt4RunConfigurations that their cached values are now invalid // Informs all Qt4RunConfigurations that their cached values are now invalid
// the Qt4RunConfigurations will update as soon as asked // the Qt4RunConfigurations will update as soon as asked
// TODO remove
void invalidateCachedTargetInformation(); void invalidateCachedTargetInformation();
virtual QByteArray predefinedMacros(const QString &fileName) const; virtual QByteArray predefinedMacros(const QString &fileName) const;
virtual QStringList includePaths(const QString &fileName) const; virtual QStringList includePaths(const QString &fileName) const;
virtual QStringList frameworkPaths(const QString &fileName) const; virtual QStringList frameworkPaths(const QString &fileName) const;
bool compareBuildConfigurationToImportFrom(ProjectExplorer::BuildConfiguration *configuration, const QString &workingDirectory);
static QStringList removeSpecFromArgumentList(const QStringList &old); static QStringList removeSpecFromArgumentList(const QStringList &old);
static QString extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version); static QString extractSpecFromArgumentList(const QStringList &list, QString directory, QtVersion *version);
// TODO can i remove this?
void updateActiveRunConfiguration();
signals: signals:
void targetInformationChanged(); void targetInformationChanged();
void qtVersionChanged(ProjectExplorer::BuildConfiguration *);
public slots: public slots:
void update(); void update();
@@ -271,17 +235,12 @@ private:
static void findProFile(const QString& fileName, Internal::Qt4ProFileNode *root, QList<Internal::Qt4ProFileNode *> &list); static void findProFile(const QString& fileName, Internal::Qt4ProFileNode *root, QList<Internal::Qt4ProFileNode *> &list);
static bool hasSubNode(Internal::Qt4PriFileNode *root, const QString &path); static bool hasSubNode(Internal::Qt4PriFileNode *root, const QString &path);
// called by Qt4ProjectConfigWidget
// TODO remove once there's a setBuildDirectory call
void emitBuildDirectoryChanged();
QList<Internal::Qt4ProFileNode *> m_applicationProFileChange; QList<Internal::Qt4ProFileNode *> m_applicationProFileChange;
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const; ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
void addDefaultBuild(); void addDefaultBuild();
static QString qmakeVarName(ProjectExplorer::FileType type); static QString qmakeVarName(ProjectExplorer::FileType type);
void updateActiveRunConfiguration();
Qt4Manager *m_manager; Qt4Manager *m_manager;
Internal::Qt4ProFileNode *m_rootProjectNode; Internal::Qt4ProFileNode *m_rootProjectNode;

View File

@@ -34,6 +34,7 @@
#include "qt4project.h" #include "qt4project.h"
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include "qt4projectmanager.h" #include "qt4projectmanager.h"
#include "qt4buildconfiguration.h"
#include "ui_qt4projectconfigwidget.h" #include "ui_qt4projectconfigwidget.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -53,9 +54,9 @@ using namespace Qt4ProjectManager::Internal;
Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project) Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
: BuildConfigWidget(), : BuildConfigWidget(),
m_pro(project),
m_buildConfiguration(0) m_buildConfiguration(0)
{ {
Q_UNUSED(project);
QVBoxLayout *vbox = new QVBoxLayout(this); QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setMargin(0); vbox->setMargin(0);
m_detailsContainer = new Utils::DetailsWidget(this); m_detailsContainer = new Utils::DetailsWidget(this);
@@ -112,9 +113,9 @@ Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
void Qt4ProjectConfigWidget::updateDetails() void Qt4ProjectConfigWidget::updateDetails()
{ {
QtVersion *version = m_pro->qtVersion(m_buildConfiguration); QtVersion *version = m_buildConfiguration->qtVersion();
QString versionString; QString versionString;
if (m_pro->qtVersionId(m_buildConfiguration) == 0) { if (m_buildConfiguration->qtVersionId() == 0) {
versionString = tr("Default Qt Version (%1)").arg(version->name()); versionString = tr("Default Qt Version (%1)").arg(version->name());
} else if(version){ } else if(version){
versionString = version->name(); versionString = version->name();
@@ -126,8 +127,8 @@ void Qt4ProjectConfigWidget::updateDetails()
"with tool chain <b>%2</b><br>" "with tool chain <b>%2</b><br>"
"building in <b>%3</b>") "building in <b>%3</b>")
.arg(versionString, .arg(versionString,
ProjectExplorer::ToolChain::toolChainName(m_pro->toolChainType(m_buildConfiguration)), ProjectExplorer::ToolChain::toolChainName(m_buildConfiguration->toolChainType()),
QDir::toNativeSeparators(m_pro->buildDirectory(m_buildConfiguration)))); QDir::toNativeSeparators(m_buildConfiguration->buildDirectory())));
} }
void Qt4ProjectConfigWidget::manageQtVersions() void Qt4ProjectConfigWidget::manageQtVersions()
@@ -147,7 +148,7 @@ void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
if (debug) if (debug)
qDebug() << "Qt4ProjectConfigWidget::init() for"<<bc->displayName(); qDebug() << "Qt4ProjectConfigWidget::init() for"<<bc->displayName();
m_buildConfiguration = bc; m_buildConfiguration = static_cast<Qt4BuildConfiguration *>(bc);
m_ui->nameLineEdit->setText(m_buildConfiguration->displayName()); m_ui->nameLineEdit->setText(m_buildConfiguration->displayName());
setupQtVersionsComboBox(); setupQtVersionsComboBox();
@@ -156,7 +157,7 @@ void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
m_ui->shadowBuildCheckBox->setChecked(shadowBuild); m_ui->shadowBuildCheckBox->setChecked(shadowBuild);
m_ui->shadowBuildDirEdit->setEnabled(shadowBuild); m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
m_browseButton->setEnabled(shadowBuild); m_browseButton->setEnabled(shadowBuild);
m_ui->shadowBuildDirEdit->setPath(m_pro->buildDirectory(m_buildConfiguration)); m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->buildDirectory());
updateImportLabel(); updateImportLabel();
updateToolChainCombo(); updateToolChainCombo();
updateDetails(); updateDetails();
@@ -164,7 +165,7 @@ void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc)
void Qt4ProjectConfigWidget::changeConfigName(const QString &newName) void Qt4ProjectConfigWidget::changeConfigName(const QString &newName)
{ {
m_pro->setDisplayNameFor(m_buildConfiguration, newName); m_buildConfiguration->project()->setDisplayNameFor(m_buildConfiguration, newName);
} }
void Qt4ProjectConfigWidget::setupQtVersionsComboBox() void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
@@ -180,7 +181,7 @@ void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
m_ui->qtVersionComboBox->clear(); m_ui->qtVersionComboBox->clear();
m_ui->qtVersionComboBox->addItem(tr("Default Qt Version (%1)").arg(vm->defaultVersion()->name()), 0); m_ui->qtVersionComboBox->addItem(tr("Default Qt Version (%1)").arg(vm->defaultVersion()->name()), 0);
int qtVersionId = m_pro->qtVersionId(m_buildConfiguration); int qtVersionId = m_buildConfiguration->qtVersionId();
if (qtVersionId == 0) { if (qtVersionId == 0) {
m_ui->qtVersionComboBox->setCurrentIndex(0); m_ui->qtVersionComboBox->setCurrentIndex(0);
@@ -204,7 +205,7 @@ void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
void Qt4ProjectConfigWidget::onBeforeBeforeShadowBuildDirBrowsed() void Qt4ProjectConfigWidget::onBeforeBeforeShadowBuildDirBrowsed()
{ {
QString initialDirectory = QFileInfo(m_pro->file()->fileName()).absolutePath(); QString initialDirectory = QFileInfo(m_buildConfiguration->project()->file()->fileName()).absolutePath();
if (!initialDirectory.isEmpty()) if (!initialDirectory.isEmpty())
m_ui->shadowBuildDirEdit->setInitialBrowsePathBackup(initialDirectory); m_ui->shadowBuildDirEdit->setInitialBrowsePathBackup(initialDirectory);
} }
@@ -220,7 +221,7 @@ void Qt4ProjectConfigWidget::shadowBuildCheckBoxClicked(bool checked)
else else
m_buildConfiguration->setValue("buildDirectory", QVariant(QString::null)); m_buildConfiguration->setValue("buildDirectory", QVariant(QString::null));
updateDetails(); updateDetails();
m_pro->invalidateCachedTargetInformation(); static_cast<Qt4Project *>(m_buildConfiguration->project())->invalidateCachedTargetInformation();
updateImportLabel(); updateImportLabel();
} }
@@ -229,9 +230,9 @@ void Qt4ProjectConfigWidget::updateImportLabel()
bool visible = false; bool visible = false;
// we only show if we actually have a qmake and makestep // we only show if we actually have a qmake and makestep
if (m_pro->qmakeStep(m_buildConfiguration) && m_pro->makeStep(m_buildConfiguration)) { if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) {
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(m_pro->buildDirectory(m_buildConfiguration)); QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(m_buildConfiguration->buildDirectory());
QtVersion *version = m_pro->qtVersion(m_buildConfiguration); QtVersion *version = m_buildConfiguration->qtVersion();
// check that there's a makefile // check that there's a makefile
if (!qmakePath.isEmpty()) { if (!qmakePath.isEmpty()) {
// and that the qmake path is different from the current version // and that the qmake path is different from the current version
@@ -240,7 +241,7 @@ void Qt4ProjectConfigWidget::updateImportLabel()
visible = true; visible = true;
} else { } else {
// check that the qmake flags, arguments match // check that the qmake flags, arguments match
visible = !m_pro->compareBuildConfigurationToImportFrom(m_buildConfiguration, m_pro->buildDirectory(m_buildConfiguration)); visible = !m_buildConfiguration->compareBuildConfigurationToImportFrom(m_buildConfiguration->buildDirectory());
} }
} else { } else {
visible = false; visible = false;
@@ -260,15 +261,15 @@ void Qt4ProjectConfigWidget::shadowBuildLineEditTextChanged()
// offer to import it // offer to import it
updateImportLabel(); updateImportLabel();
m_pro->invalidateCachedTargetInformation(); static_cast<Qt4Project *>(m_buildConfiguration->project())->invalidateCachedTargetInformation();
updateDetails(); updateDetails();
} }
void Qt4ProjectConfigWidget::importLabelClicked() void Qt4ProjectConfigWidget::importLabelClicked()
{ {
if (!m_pro->qmakeStep(m_buildConfiguration) || !m_pro->makeStep(m_buildConfiguration)) if (!m_buildConfiguration->qmakeStep() || !m_buildConfiguration->makeStep())
return; return;
QString directory = m_pro->buildDirectory(m_buildConfiguration); QString directory = m_buildConfiguration->buildDirectory();
if (!directory.isEmpty()) { if (!directory.isEmpty()) {
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(directory); QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(directory);
if (!qmakePath.isEmpty()) { if (!qmakePath.isEmpty()) {
@@ -293,12 +294,12 @@ void Qt4ProjectConfigWidget::importLabelClicked()
} }
// So we got all the information now apply it... // So we got all the information now apply it...
m_pro->setQtVersion(m_buildConfiguration, version->uniqueId()); m_buildConfiguration->setQtVersion(version->uniqueId());
// Combo box will be updated at the end // Combo box will be updated at the end
QMakeStep *qmakeStep = m_pro->qmakeStep(m_buildConfiguration); QMakeStep *qmakeStep = m_buildConfiguration->qmakeStep();
qmakeStep->setQMakeArguments(additionalArguments); qmakeStep->setQMakeArguments(additionalArguments);
MakeStep *makeStep = m_pro->makeStep(m_buildConfiguration); MakeStep *makeStep = m_buildConfiguration->makeStep();
m_buildConfiguration->setValue("buildConfiguration", int(qmakeBuildConfig)); m_buildConfiguration->setValue("buildConfiguration", int(qmakeBuildConfig));
// Adjust command line arguments, this is ugly as hell // Adjust command line arguments, this is ugly as hell
@@ -335,10 +336,10 @@ void Qt4ProjectConfigWidget::qtVersionComboBoxCurrentIndexChanged(const QString
QtVersionManager *vm = QtVersionManager::instance(); QtVersionManager *vm = QtVersionManager::instance();
bool isValid = vm->version(newQtVersion)->isValid(); bool isValid = vm->version(newQtVersion)->isValid();
m_ui->invalidQtWarningLabel->setVisible(!isValid); m_ui->invalidQtWarningLabel->setVisible(!isValid);
if (newQtVersion != m_pro->qtVersionId(m_buildConfiguration)) { if (newQtVersion != m_buildConfiguration->qtVersionId()) {
m_pro->setQtVersion(m_buildConfiguration, newQtVersion); m_buildConfiguration->setQtVersion(newQtVersion);
updateToolChainCombo(); updateToolChainCombo();
m_pro->update(); static_cast<Qt4Project *>(m_buildConfiguration->project())->update();
} }
updateDetails(); updateDetails();
} }
@@ -346,19 +347,19 @@ void Qt4ProjectConfigWidget::qtVersionComboBoxCurrentIndexChanged(const QString
void Qt4ProjectConfigWidget::updateToolChainCombo() void Qt4ProjectConfigWidget::updateToolChainCombo()
{ {
m_ui->toolChainComboBox->clear(); m_ui->toolChainComboBox->clear();
QList<ProjectExplorer::ToolChain::ToolChainType> toolchains = m_pro->qtVersion(m_buildConfiguration)->possibleToolChainTypes(); QList<ProjectExplorer::ToolChain::ToolChainType> toolchains = m_buildConfiguration->qtVersion()->possibleToolChainTypes();
using namespace ProjectExplorer; using namespace ProjectExplorer;
foreach (ToolChain::ToolChainType toolchain, toolchains) { foreach (ToolChain::ToolChainType toolchain, toolchains) {
m_ui->toolChainComboBox->addItem(ToolChain::toolChainName(toolchain), qVariantFromValue(toolchain)); m_ui->toolChainComboBox->addItem(ToolChain::toolChainName(toolchain), qVariantFromValue(toolchain));
} }
m_ui->toolChainComboBox->setEnabled(toolchains.size() > 1); m_ui->toolChainComboBox->setEnabled(toolchains.size() > 1);
setToolChain(toolchains.indexOf(m_pro->toolChainType(m_buildConfiguration))); setToolChain(toolchains.indexOf(m_buildConfiguration->toolChainType()));
} }
void Qt4ProjectConfigWidget::selectToolChain(int index) void Qt4ProjectConfigWidget::selectToolChain(int index)
{ {
setToolChain(index); setToolChain(index);
m_pro->update(); static_cast<Qt4Project *>(m_buildConfiguration->project())->update();
} }
void Qt4ProjectConfigWidget::setToolChain(int index) void Qt4ProjectConfigWidget::setToolChain(int index)
@@ -366,7 +367,7 @@ void Qt4ProjectConfigWidget::setToolChain(int index)
ProjectExplorer::ToolChain::ToolChainType selectedToolChainType = ProjectExplorer::ToolChain::ToolChainType selectedToolChainType =
m_ui->toolChainComboBox->itemData(index, m_ui->toolChainComboBox->itemData(index,
Qt::UserRole).value<ProjectExplorer::ToolChain::ToolChainType>(); Qt::UserRole).value<ProjectExplorer::ToolChain::ToolChainType>();
m_pro->setToolChainType(m_buildConfiguration, selectedToolChainType); m_buildConfiguration->setToolChainType(selectedToolChainType);
if (m_ui->toolChainComboBox->currentIndex() != index) if (m_ui->toolChainComboBox->currentIndex() != index)
m_ui->toolChainComboBox->setCurrentIndex(index); m_ui->toolChainComboBox->setCurrentIndex(index);
updateDetails(); updateDetails();

View File

@@ -39,6 +39,7 @@ namespace Qt4ProjectManager {
class Qt4Project; class Qt4Project;
namespace Internal { namespace Internal {
class Qt4BuildConfiguration;
namespace Ui { namespace Ui {
class Qt4ProjectConfigWidget; class Qt4ProjectConfigWidget;
@@ -72,8 +73,7 @@ private:
void setToolChain(int index); void setToolChain(int index);
Ui::Qt4ProjectConfigWidget *m_ui; Ui::Qt4ProjectConfigWidget *m_ui;
QAbstractButton *m_browseButton; QAbstractButton *m_browseButton;
Qt4Project *m_pro; // TODO remove Qt4BuildConfiguration *m_buildConfiguration;
ProjectExplorer::BuildConfiguration *m_buildConfiguration;
Utils::DetailsWidget *m_detailsContainer; Utils::DetailsWidget *m_detailsContainer;
}; };

View File

@@ -33,6 +33,7 @@
#include "profilereader.h" #include "profilereader.h"
#include "qt4nodes.h" #include "qt4nodes.h"
#include "qt4project.h" #include "qt4project.h"
#include "qt4buildconfiguration.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
@@ -96,9 +97,9 @@ QString Qt4RunConfiguration::type() const
bool Qt4RunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const bool Qt4RunConfiguration::isEnabled(ProjectExplorer::BuildConfiguration *configuration) const
{ {
#if defined(QTCREATOR_WITH_S60) || defined(QTCREATOR_WITH_MAEMO) #if defined(QTCREATOR_WITH_S60) || defined(QTCREATOR_WITH_MAEMO)
Qt4Project *pro = qobject_cast<Qt4Project*>(project()); Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(configuration);
QTC_ASSERT(pro, return false); QTC_ASSERT(qt4bc, return false);
ProjectExplorer::ToolChain::ToolChainType type = pro->toolChainType(configuration); ProjectExplorer::ToolChain::ToolChainType type = qt4bc->toolChainType();
#ifdef QTCREATOR_WITH_S60 #ifdef QTCREATOR_WITH_S60
if (type == ProjectExplorer::ToolChain::WINSCW if (type == ProjectExplorer::ToolChain::WINSCW
|| type == ProjectExplorer::ToolChain::GCCE || type == ProjectExplorer::ToolChain::GCCE
@@ -479,7 +480,7 @@ ProjectExplorer::Environment Qt4RunConfiguration::baseEnvironment() const
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase) { } else if (m_baseEnvironmentBase == Qt4RunConfiguration::SystemEnvironmentBase) {
env = ProjectExplorer::Environment::systemEnvironment(); env = ProjectExplorer::Environment::systemEnvironment();
} else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase) { } else if (m_baseEnvironmentBase == Qt4RunConfiguration::BuildEnvironmentBase) {
env = project()->environment(project()->activeBuildConfiguration()); env = project()->activeBuildConfiguration()->environment();
} }
if (m_isUsingDyldImageSuffix) { if (m_isUsingDyldImageSuffix) {
env.set("DYLD_IMAGE_SUFFIX", "_debug"); env.set("DYLD_IMAGE_SUFFIX", "_debug");
@@ -554,7 +555,7 @@ void Qt4RunConfiguration::updateTarget()
if (m_cachedTargetInformationValid) if (m_cachedTargetInformationValid)
return; return;
//qDebug()<<"updateTarget"; //qDebug()<<"updateTarget";
Qt4Project *pro = static_cast<Qt4Project *>(project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath); Qt4PriFileNode * priFileNode = static_cast<Qt4Project *>(project())->rootProjectNode()->findProFileFor(m_proFilePath);
if (!priFileNode) { if (!priFileNode) {
m_workingDir = QString::null; m_workingDir = QString::null;
@@ -565,11 +566,11 @@ void Qt4RunConfiguration::updateTarget()
} }
ProFileReader *reader = priFileNode->createProFileReader(); ProFileReader *reader = priFileNode->createProFileReader();
reader->setCumulative(false); reader->setCumulative(false);
reader->setQtVersion(pro->qtVersion(pro->activeBuildConfiguration())); reader->setQtVersion(qt4bc->qtVersion());
// Find out what flags we pass on to qmake, this code is duplicated in the qmake step // Find out what flags we pass on to qmake, this code is duplicated in the qmake step
QtVersion::QmakeBuildConfigs defaultBuildConfiguration = pro->qtVersion(pro->activeBuildConfiguration())->defaultBuildConfig(); QtVersion::QmakeBuildConfigs defaultBuildConfiguration = qt4bc->qtVersion()->defaultBuildConfig();
QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(pro->activeBuildConfiguration()->value("buildConfiguration").toInt()); QtVersion::QmakeBuildConfigs projectBuildConfiguration = QtVersion::QmakeBuildConfig(qt4bc->value("buildConfiguration").toInt());
QStringList addedUserConfigArguments; QStringList addedUserConfigArguments;
QStringList removedUserConfigArguments; QStringList removedUserConfigArguments;
if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll)) if ((defaultBuildConfiguration & QtVersion::BuildAll) && !(projectBuildConfiguration & QtVersion::BuildAll))
@@ -592,7 +593,7 @@ void Qt4RunConfiguration::updateTarget()
// Extract data // Extract data
QDir baseProjectDirectory = QFileInfo(project()->file()->fileName()).absoluteDir(); QDir baseProjectDirectory = QFileInfo(project()->file()->fileName()).absoluteDir();
QString relSubDir = baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path()); QString relSubDir = baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path());
QDir baseBuildDirectory = project()->buildDirectory(project()->activeBuildConfiguration()); QDir baseBuildDirectory = project()->activeBuildConfiguration()->buildDirectory();
QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir); QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir);
//qDebug()<<relSubDir<<baseDir; //qDebug()<<relSubDir<<baseDir;
@@ -653,8 +654,8 @@ void Qt4RunConfiguration::invalidateCachedTargetInformation()
QString Qt4RunConfiguration::dumperLibrary() const QString Qt4RunConfiguration::dumperLibrary() const
{ {
Qt4Project *pro = qobject_cast<Qt4Project *>(project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
QtVersion *version = pro->qtVersion(pro->activeBuildConfiguration()); QtVersion *version = qt4bc->qtVersion();
if (version) if (version)
return version->debuggingHelperLibrary(); return version->debuggingHelperLibrary();
else else
@@ -663,8 +664,8 @@ QString Qt4RunConfiguration::dumperLibrary() const
QStringList Qt4RunConfiguration::dumperLibraryLocations() const QStringList Qt4RunConfiguration::dumperLibraryLocations() const
{ {
Qt4Project *pro = qobject_cast<Qt4Project *>(project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
QtVersion *version = pro->qtVersion(pro->activeBuildConfiguration()); QtVersion *version = qt4bc->qtVersion();
if (version) if (version)
return version->debuggingHelperLibraryLocations(); return version->debuggingHelperLibraryLocations();
else else
@@ -685,8 +686,8 @@ Qt4RunConfiguration::BaseEnvironmentBase Qt4RunConfiguration::baseEnvironmentBas
} }
ProjectExplorer::ToolChain::ToolChainType Qt4RunConfiguration::toolChainType() const ProjectExplorer::ToolChain::ToolChainType Qt4RunConfiguration::toolChainType() const
{ {
Qt4Project *pro = qobject_cast<Qt4Project *>(project()); Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration());
return pro->toolChainType(pro->activeBuildConfiguration()); return qt4bc->toolChainType();
} }
/// ///

View File

@@ -1,4 +1,5 @@
#include "qtuicodemodelsupport.h" #include "qtuicodemodelsupport.h"
#include "qt4buildconfiguration.h"
#include "qt4project.h" #include "qt4project.h"
#include <designer/formwindoweditor.h> #include <designer/formwindoweditor.h>
@@ -88,9 +89,10 @@ void Qt4UiCodeModelSupport::setFileName(const QString &name)
bool Qt4UiCodeModelSupport::runUic(const QString &ui) const bool Qt4UiCodeModelSupport::runUic(const QString &ui) const
{ {
Qt4BuildConfiguration *qt4bc = static_cast<Qt4BuildConfiguration *>(m_project->activeBuildConfiguration());
QProcess uic; QProcess uic;
uic.setEnvironment(m_project->environment(m_project->activeBuildConfiguration()).toStringList()); uic.setEnvironment(m_project->activeBuildConfiguration()->environment().toStringList());
uic.start(m_project->qtVersion(m_project->activeBuildConfiguration())->uicCommand(), QStringList(), QIODevice::ReadWrite); uic.start(qt4bc->qtVersion()->uicCommand(), QStringList(), QIODevice::ReadWrite);
uic.waitForStarted(); uic.waitForStarted();
uic.write(ui.toUtf8()); uic.write(ui.toUtf8());
uic.closeWriteChannel(); uic.closeWriteChannel();