Commit d500ceac authored by con's avatar con
Browse files

Add both "debug" and "release" build configurations, not only "release".

Reviewed-by: dt
parent 7f345078
......@@ -112,33 +112,6 @@ ProjectLoadWizard::~ProjectLoadWizard()
}
void ProjectLoadWizard::addBuildConfiguration(QString buildConfigurationName, QtVersion *qtversion, QtVersion::QmakeBuildConfig qmakeBuildConfiguration, QStringList additionalArguments)
{
QMakeStep *qmakeStep = m_project->qmakeStep();
MakeStep *makeStep = m_project->makeStep();
bool debug = qmakeBuildConfiguration & QtVersion::DebugBuild;
// Add the buildconfiguration
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration(buildConfigurationName);
m_project->addBuildConfiguration(bc);
const QString &finalBuildConfigurationName = bc->name();
qmakeStep->setValue(finalBuildConfigurationName, "qmakeArgs", additionalArguments);
// set some options for qmake and make
if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets
makeStep->setValue(finalBuildConfigurationName, "makeargs", QStringList() << (debug ? "debug" : "release"));
bc->setValue("buildConfiguration", int(qmakeBuildConfiguration));
// Finally set the qt version
bool defaultQtVersion = (qtversion == 0);
if (defaultQtVersion)
m_project->setQtVersion(bc, 0);
else
m_project->setQtVersion(bc, qtversion->uniqueId());
}
void ProjectLoadWizard::done(int result)
{
QtVersionManager *vm = QtVersionManager::instance();
......@@ -154,7 +127,7 @@ void ProjectLoadWizard::done(int result)
// qDebug()<<"Creating m_buildconfiguration entry from imported stuff";
// qDebug()<<((m_importBuildConfig& QtVersion::BuildAll)? "debug_and_release" : "")<<((m_importBuildConfig & QtVersion::DebugBuild)? "debug" : "release");
bool debug = m_importBuildConfig & QtVersion::DebugBuild;
addBuildConfiguration(debug ? "Debug" : "Release", m_importVersion, m_importBuildConfig, m_additionalArguments);
m_project->addQt4BuildConfiguration(debug ? "Debug" : "Release", m_importVersion, m_importBuildConfig, m_additionalArguments);
if (m_importBuildConfig & QtVersion::BuildAll) {
// Also create the other configuration
......@@ -164,7 +137,7 @@ void ProjectLoadWizard::done(int result)
else
otherBuildConfiguration = QtVersion::QmakeBuildConfig(otherBuildConfiguration | QtVersion::DebugBuild);
addBuildConfiguration(debug ? "Release" : "Debug", m_importVersion, otherBuildConfiguration, m_additionalArguments);
m_project->addQt4BuildConfiguration(debug ? "Release" : "Debug", m_importVersion, otherBuildConfiguration, m_additionalArguments);
}
} else {
// Not importing
......@@ -176,11 +149,11 @@ void ProjectLoadWizard::done(int result)
if (defaultVersion && defaultVersion->isValid() && (defaultVersion->defaultBuildConfig() & QtVersion::BuildAll))
buildAll = true;
if (buildAll) {
addBuildConfiguration("Debug", 0, QtVersion::QmakeBuildConfig(QtVersion::BuildAll | QtVersion::DebugBuild), m_additionalArguments);
addBuildConfiguration("Release", 0, QtVersion::BuildAll, m_additionalArguments);
m_project->addQt4BuildConfiguration("Debug", 0, QtVersion::QmakeBuildConfig(QtVersion::BuildAll | QtVersion::DebugBuild), m_additionalArguments);
m_project->addQt4BuildConfiguration("Release", 0, QtVersion::BuildAll, m_additionalArguments);
} else {
addBuildConfiguration("Debug", 0, QtVersion::DebugBuild, m_additionalArguments);
addBuildConfiguration("Release", 0, QtVersion::QmakeBuildConfig(0), m_additionalArguments);
m_project->addQt4BuildConfiguration("Debug", 0, QtVersion::DebugBuild, m_additionalArguments);
m_project->addQt4BuildConfiguration("Release", 0, QtVersion::QmakeBuildConfig(0), m_additionalArguments);
}
}
......
......@@ -57,7 +57,6 @@ public:
void execDialog();
private:
void addBuildConfiguration(QString name, QtVersion *qtversion, QtVersion::QmakeBuildConfig buildConfiguration, QStringList additionalArguments);
void setupImportPage(QtVersion *version, QtVersion::QmakeBuildConfig buildConfig, QStringList addtionalArguments);
Qt4Project *m_project;
......
......@@ -283,9 +283,15 @@ bool Qt4BuildConfigurationFactory::create(const QString &type) const
&ok);
if (!ok || buildConfigurationName.isEmpty())
return false;
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
bc->setValue(KEY_QT_VERSION_ID, info.versionId);
m_project->addBuildConfiguration(bc);
QtVersion *version = QtVersionManager::instance()->version(info.versionId);
m_project->addQt4BuildConfiguration(tr("%1 Debug").arg(buildConfigurationName),
version,
(QtVersion::QmakeBuildConfig)(version->defaultBuildConfig() | QtVersion::DebugBuild));
m_project->addQt4BuildConfiguration(tr("%1 Release").arg(buildConfigurationName),
version,
(QtVersion::QmakeBuildConfig)(version->defaultBuildConfig() & ~QtVersion::DebugBuild));
return true;
}
......@@ -431,6 +437,36 @@ ProjectExplorer::IBuildConfigurationFactory *Qt4Project::buildConfigurationFacto
return m_buildConfigurationFactory;
}
void Qt4Project::addQt4BuildConfiguration(QString buildConfigurationName, QtVersion *qtversion,
QtVersion::QmakeBuildConfig qmakeBuildConfiguration,
QStringList additionalArguments)
{
QMakeStep *qmake = qmakeStep();
MakeStep *make = makeStep();
bool debug = qmakeBuildConfiguration & QtVersion::DebugBuild;
// Add the buildconfiguration
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration(buildConfigurationName);
addBuildConfiguration(bc);
const QString &finalBuildConfigurationName = bc->name();
if (!additionalArguments.isEmpty())
qmake->setValue(finalBuildConfigurationName, "qmakeArgs", additionalArguments);
// set some options for qmake and make
if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets
make->setValue(finalBuildConfigurationName, "makeargs", QStringList() << (debug ? "debug" : "release"));
bc->setValue("buildConfiguration", int(qmakeBuildConfiguration));
// Finally set the qt version
bool defaultQtVersion = (qtversion == 0);
if (defaultQtVersion)
setQtVersion(bc, 0);
else
setQtVersion(bc, qtversion->uniqueId());
}
namespace {
class FindQt4ProFiles: protected ProjectExplorer::NodesVisitor {
QList<Qt4ProFileNode *> m_proFiles;
......
......@@ -160,6 +160,11 @@ public:
Qt4Manager *qt4ProjectManager() const;
ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
void addQt4BuildConfiguration(QString buildConfigurationName,
QtVersion *qtversion,
QtVersion::QmakeBuildConfig qmakeBuildConfiguration,
QStringList additionalArguments = QStringList());
QList<Core::IFile *> dependencies(); //NBS remove
QList<ProjectExplorer::Project *>dependsOn();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment