forked from qt-creator/qt-creator
Expand CurrentBuild:Type in the wizards
This was just unset before. Task-number: QTCREATORBUG-15178 Change-Id: Ice66273e2ce9bc60bd8a96516f774201a7a95331 Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -61,13 +61,14 @@ namespace Internal {
|
|||||||
const char USE_NINJA_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.UseNinja";
|
const char USE_NINJA_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.UseNinja";
|
||||||
const char INITIAL_ARGUMENTS[] = "CMakeProjectManager.CMakeBuildConfiguration.InitialArgument";
|
const char INITIAL_ARGUMENTS[] = "CMakeProjectManager.CMakeBuildConfiguration.InitialArgument";
|
||||||
|
|
||||||
static FileName shadowBuildDirectory(const FileName &projectFilePath, const Kit *k, const QString &bcName)
|
static FileName shadowBuildDirectory(const FileName &projectFilePath, const Kit *k,
|
||||||
|
const QString &bcName, BuildConfiguration::BuildType buildType)
|
||||||
{
|
{
|
||||||
if (projectFilePath.isEmpty())
|
if (projectFilePath.isEmpty())
|
||||||
return FileName();
|
return FileName();
|
||||||
|
|
||||||
const QString projectName = projectFilePath.parentDir().fileName();
|
const QString projectName = projectFilePath.parentDir().fileName();
|
||||||
ProjectMacroExpander expander(projectName, k, bcName);
|
ProjectMacroExpander expander(projectName, k, bcName, buildType);
|
||||||
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
|
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
|
||||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||||
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));
|
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));
|
||||||
@@ -79,7 +80,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent
|
|||||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||||
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
|
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
|
||||||
parent->kit(),
|
parent->kit(),
|
||||||
displayName()));
|
displayName(), BuildConfiguration::Unknown));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
||||||
@@ -202,7 +203,8 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSet
|
|||||||
} else {
|
} else {
|
||||||
info->displayName = info->typeName;
|
info->displayName = info->typeName;
|
||||||
}
|
}
|
||||||
info->buildDirectory = shadowBuildDirectory(projectPathName, k, info->displayName);
|
info->buildDirectory
|
||||||
|
= shadowBuildDirectory(projectPathName, k, info->displayName, info->buildType);
|
||||||
result << info;
|
result << info;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -220,7 +222,7 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(Proj
|
|||||||
|
|
||||||
if (copy.buildDirectory.isEmpty()) {
|
if (copy.buildDirectory.isEmpty()) {
|
||||||
copy.buildDirectory = shadowBuildDirectory(project->projectFilePath(), parent->kit(),
|
copy.buildDirectory = shadowBuildDirectory(project->projectFilePath(), parent->kit(),
|
||||||
copy.displayName);
|
copy.displayName, info->buildType);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
||||||
@@ -306,18 +308,22 @@ CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExp
|
|||||||
case BuildTypeDebug:
|
case BuildTypeDebug:
|
||||||
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=Debug");
|
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=Debug");
|
||||||
info->typeName = tr("Debug");
|
info->typeName = tr("Debug");
|
||||||
|
info->buildType = BuildConfiguration::Debug;
|
||||||
break;
|
break;
|
||||||
case BuildTypeRelease:
|
case BuildTypeRelease:
|
||||||
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=Release");
|
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=Release");
|
||||||
info->typeName = tr("Release");
|
info->typeName = tr("Release");
|
||||||
|
info->buildType = BuildConfiguration::Release;
|
||||||
break;
|
break;
|
||||||
case BuildTypeMinSizeRel:
|
case BuildTypeMinSizeRel:
|
||||||
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=MinSizeRel");
|
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=MinSizeRel");
|
||||||
info->typeName = tr("Minimum Size Release");
|
info->typeName = tr("Minimum Size Release");
|
||||||
|
info->buildType = BuildConfiguration::Release;
|
||||||
break;
|
break;
|
||||||
case BuildTypeRelWithDebInfo:
|
case BuildTypeRelWithDebInfo:
|
||||||
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=RelWithDebInfo");
|
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=RelWithDebInfo");
|
||||||
info->typeName = tr("Release with Debug Information");
|
info->typeName = tr("Release with Debug Information");
|
||||||
|
info->buildType = BuildConfiguration::Profile;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
|
@@ -35,7 +35,8 @@
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
ProjectMacroExpander::ProjectMacroExpander(const QString &projectName,
|
ProjectMacroExpander::ProjectMacroExpander(const QString &projectName,
|
||||||
const Kit *kit, const QString &bcName)
|
const Kit *kit, const QString &bcName,
|
||||||
|
BuildConfiguration::BuildType buildType)
|
||||||
{
|
{
|
||||||
registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
|
registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
|
||||||
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
|
QCoreApplication::translate("ProjectExplorer", "Name of current project"),
|
||||||
@@ -45,6 +46,10 @@ ProjectMacroExpander::ProjectMacroExpander(const QString &projectName,
|
|||||||
QCoreApplication::translate("ProjectExplorer", "Name of current build"),
|
QCoreApplication::translate("ProjectExplorer", "Name of current build"),
|
||||||
[bcName] { return bcName; });
|
[bcName] { return bcName; });
|
||||||
|
|
||||||
|
registerVariable(Constants::VAR_CURRENTBUILD_TYPE,
|
||||||
|
QCoreApplication::translate("ProjectExplorer", "Type of current build"),
|
||||||
|
[buildType] { return BuildConfiguration::buildTypeName(buildType); });
|
||||||
|
|
||||||
registerSubProvider([kit] { return kit->macroExpander(); });
|
registerSubProvider([kit] { return kit->macroExpander(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,9 @@
|
|||||||
#define PROJECTMACROEXPANDER_H
|
#define PROJECTMACROEXPANDER_H
|
||||||
|
|
||||||
#include "projectexplorer_export.h"
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
|
#include "buildconfiguration.h"
|
||||||
|
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -40,7 +43,8 @@ class Kit;
|
|||||||
class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::MacroExpander
|
class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::MacroExpander
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProjectMacroExpander(const QString &projectName, const Kit *kit, const QString &bcName);
|
ProjectMacroExpander(const QString &projectName, const Kit *kit, const QString &bcName,
|
||||||
|
BuildConfiguration::BuildType buildType);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -405,10 +405,11 @@ int QbsBuildConfigurationFactory::priority(const Kit *k, const QString &projectP
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Utils::FileName defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
static Utils::FileName defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
||||||
const QString &bcName)
|
const QString &bcName,
|
||||||
|
BuildConfiguration::BuildType buildType)
|
||||||
{
|
{
|
||||||
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
||||||
ProjectMacroExpander expander(projectName, k, bcName);
|
ProjectMacroExpander expander(projectName, k, bcName, buildType);
|
||||||
QString projectDir = Project::projectDirectory(Utils::FileName::fromString(projectFilePath)).toString();
|
QString projectDir = Project::projectDirectory(Utils::FileName::fromString(projectFilePath)).toString();
|
||||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||||
return Utils::FileName::fromString(Utils::FileUtils::resolvePath(projectDir, buildPath));
|
return Utils::FileName::fromString(Utils::FileUtils::resolvePath(projectDir, buildPath));
|
||||||
@@ -422,14 +423,18 @@ QList<BuildInfo *> QbsBuildConfigurationFactory::availableSetups(const Kit *k, c
|
|||||||
//: The name of the debug build configuration created by default for a qbs project.
|
//: The name of the debug build configuration created by default for a qbs project.
|
||||||
info->displayName = tr("Debug");
|
info->displayName = tr("Debug");
|
||||||
//: Non-ASCII characters in directory suffix may cause build issues.
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
||||||
info->buildDirectory = defaultBuildDirectory(projectPath, k, tr("Debug", "Shadow build directory suffix"));
|
info->buildDirectory
|
||||||
|
= defaultBuildDirectory(projectPath, k, tr("Debug", "Shadow build directory suffix"),
|
||||||
|
info->buildType);
|
||||||
result << info;
|
result << info;
|
||||||
|
|
||||||
info = createBuildInfo(k, BuildConfiguration::Release);
|
info = createBuildInfo(k, BuildConfiguration::Release);
|
||||||
//: The name of the release build configuration created by default for a qbs project.
|
//: The name of the release build configuration created by default for a qbs project.
|
||||||
info->displayName = tr("Release");
|
info->displayName = tr("Release");
|
||||||
//: Non-ASCII characters in directory suffix may cause build issues.
|
//: Non-ASCII characters in directory suffix may cause build issues.
|
||||||
info->buildDirectory = defaultBuildDirectory(projectPath, k, tr("Release", "Shadow build directory suffix"));
|
info->buildDirectory
|
||||||
|
= defaultBuildDirectory(projectPath, k, tr("Release", "Shadow build directory suffix"),
|
||||||
|
info->buildType);
|
||||||
result << info;
|
result << info;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -450,7 +455,7 @@ BuildConfiguration *QbsBuildConfigurationFactory::create(Target *parent, const B
|
|||||||
Utils::FileName buildDir = info->buildDirectory;
|
Utils::FileName buildDir = info->buildDirectory;
|
||||||
if (buildDir.isEmpty())
|
if (buildDir.isEmpty())
|
||||||
buildDir = defaultBuildDirectory(parent->project()->projectDirectory().toString(),
|
buildDir = defaultBuildDirectory(parent->project()->projectDirectory().toString(),
|
||||||
parent->kit(), info->displayName);
|
parent->kit(), info->displayName, info->buildType);
|
||||||
|
|
||||||
BuildConfiguration *bc
|
BuildConfiguration *bc
|
||||||
= QbsBuildConfiguration::setup(parent, info->displayName, info->displayName,
|
= QbsBuildConfiguration::setup(parent, info->displayName, info->displayName,
|
||||||
|
@@ -75,13 +75,15 @@ namespace QmakeProjectManager {
|
|||||||
// Helpers:
|
// Helpers:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QString QmakeBuildConfiguration::shadowBuildDirectory(const QString &proFilePath, const Kit *k, const QString &suffix)
|
QString QmakeBuildConfiguration::shadowBuildDirectory(const QString &proFilePath, const Kit *k,
|
||||||
|
const QString &suffix,
|
||||||
|
BuildConfiguration::BuildType buildType)
|
||||||
{
|
{
|
||||||
if (proFilePath.isEmpty())
|
if (proFilePath.isEmpty())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
const QString projectName = QFileInfo(proFilePath).completeBaseName();
|
const QString projectName = QFileInfo(proFilePath).completeBaseName();
|
||||||
ProjectMacroExpander expander(projectName, k, suffix);
|
ProjectMacroExpander expander(projectName, k, suffix, buildType);
|
||||||
QString projectDir = Project::projectDirectory(FileName::fromString(proFilePath)).toString();
|
QString projectDir = Project::projectDirectory(FileName::fromString(proFilePath)).toString();
|
||||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||||
return FileUtils::resolvePath(projectDir, buildPath);
|
return FileUtils::resolvePath(projectDir, buildPath);
|
||||||
@@ -89,9 +91,11 @@ QString QmakeBuildConfiguration::shadowBuildDirectory(const QString &proFilePath
|
|||||||
|
|
||||||
static Utils::FileName defaultBuildDirectory(const QString &projectPath,
|
static Utils::FileName defaultBuildDirectory(const QString &projectPath,
|
||||||
const ProjectExplorer::Kit *k,
|
const ProjectExplorer::Kit *k,
|
||||||
const QString &suffix)
|
const QString &suffix,
|
||||||
|
BuildConfiguration::BuildType type)
|
||||||
{
|
{
|
||||||
return Utils::FileName::fromString(QmakeBuildConfiguration::shadowBuildDirectory(projectPath, k, suffix));
|
return Utils::FileName::fromString(QmakeBuildConfiguration::shadowBuildDirectory(projectPath, k,
|
||||||
|
suffix, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char QMAKE_BC_ID[] = "Qt4ProjectManager.Qt4BuildConfiguration";
|
const char QMAKE_BC_ID[] = "Qt4ProjectManager.Qt4BuildConfiguration";
|
||||||
@@ -597,7 +601,7 @@ QmakeBuildInfo *QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
|||||||
|
|
||||||
info->buildDirectory = Utils::FileName::fromString(absoluteBuildPath);
|
info->buildDirectory = Utils::FileName::fromString(absoluteBuildPath);
|
||||||
} else {
|
} else {
|
||||||
info->buildDirectory = defaultBuildDirectory(projectPath, k, suffix);
|
info->buildDirectory = defaultBuildDirectory(projectPath, k, suffix, type);
|
||||||
}
|
}
|
||||||
info->buildType = type;
|
info->buildType = type;
|
||||||
return info;
|
return info;
|
||||||
@@ -690,7 +694,7 @@ void QmakeBuildConfigurationFactory::configureBuildConfiguration(Target *parent,
|
|||||||
Utils::FileName directory = qmakeInfo->buildDirectory;
|
Utils::FileName directory = qmakeInfo->buildDirectory;
|
||||||
if (directory.isEmpty()) {
|
if (directory.isEmpty()) {
|
||||||
directory = defaultBuildDirectory(parent->project()->projectFilePath().toString(),
|
directory = defaultBuildDirectory(parent->project()->projectFilePath().toString(),
|
||||||
parent->kit(), qmakeInfo->displayName);
|
parent->kit(), qmakeInfo->displayName, bc->buildType());
|
||||||
}
|
}
|
||||||
|
|
||||||
bc->setBuildDirectory(directory);
|
bc->setBuildDirectory(directory);
|
||||||
|
@@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
/// suffix should be unique
|
/// suffix should be unique
|
||||||
static QString shadowBuildDirectory(const QString &profilePath, const ProjectExplorer::Kit *k,
|
static QString shadowBuildDirectory(const QString &profilePath, const ProjectExplorer::Kit *k,
|
||||||
const QString &suffix);
|
const QString &suffix, BuildConfiguration::BuildType type);
|
||||||
|
|
||||||
/// \internal for qmakestep
|
/// \internal for qmakestep
|
||||||
// used by qmake step to notify that the qmake args have changed
|
// used by qmake step to notify that the qmake args have changed
|
||||||
|
@@ -50,7 +50,8 @@ public:
|
|||||||
QString makefile;
|
QString makefile;
|
||||||
QMakeStepConfig config;
|
QMakeStepConfig config;
|
||||||
|
|
||||||
bool operator==(const QmakeBuildInfo &o) {
|
bool operator==(const QmakeBuildInfo &o)
|
||||||
|
{
|
||||||
return ProjectExplorer::BuildInfo::operator==(o)
|
return ProjectExplorer::BuildInfo::operator==(o)
|
||||||
&& additionalArguments == o.additionalArguments
|
&& additionalArguments == o.additionalArguments
|
||||||
&& config == o.config;
|
&& config == o.config;
|
||||||
|
@@ -52,7 +52,8 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
|
|||||||
m_defaultShadowBuildDir
|
m_defaultShadowBuildDir
|
||||||
= QmakeBuildConfiguration::shadowBuildDirectory(bc->target()->project()->projectFilePath().toString(),
|
= QmakeBuildConfiguration::shadowBuildDirectory(bc->target()->project()->projectFilePath().toString(),
|
||||||
bc->target()->kit(),
|
bc->target()->kit(),
|
||||||
Utils::FileUtils::qmakeFriendlyName(bc->displayName()));
|
Utils::FileUtils::qmakeFriendlyName(bc->displayName()),
|
||||||
|
bc->buildType());
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
vbox->setMargin(0);
|
vbox->setMargin(0);
|
||||||
|
@@ -264,7 +264,8 @@ QStringList QmakeProjectImporter::importCandidates(const FileName &projectPath)
|
|||||||
candidates << pfi.absolutePath();
|
candidates << pfi.absolutePath();
|
||||||
|
|
||||||
foreach (Kit *k, KitManager::kits()) {
|
foreach (Kit *k, KitManager::kits()) {
|
||||||
QFileInfo fi(QmakeBuildConfiguration::shadowBuildDirectory(projectPath.toString(), k, QString()));
|
QFileInfo fi(QmakeBuildConfiguration::shadowBuildDirectory(projectPath.toString(), k,
|
||||||
|
QString(), BuildConfiguration::Unknown));
|
||||||
const QString baseDir = fi.absolutePath();
|
const QString baseDir = fi.absolutePath();
|
||||||
|
|
||||||
foreach (const QString &dir, QDir(baseDir).entryList()) {
|
foreach (const QString &dir, QDir(baseDir).entryList()) {
|
||||||
|
Reference in New Issue
Block a user