forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.6'
Change-Id: I68512c775ed25b51c8b0abe1818c9c7c5955874c
This commit is contained in:
@@ -61,13 +61,14 @@ namespace Internal {
|
||||
const char USE_NINJA_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.UseNinja";
|
||||
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())
|
||||
return 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());
|
||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));
|
||||
@@ -79,7 +80,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent
|
||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
|
||||
parent->kit(),
|
||||
displayName()));
|
||||
displayName(), BuildConfiguration::Unknown));
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
||||
@@ -202,7 +203,8 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSet
|
||||
} else {
|
||||
info->displayName = info->typeName;
|
||||
}
|
||||
info->buildDirectory = shadowBuildDirectory(projectPathName, k, info->displayName);
|
||||
info->buildDirectory
|
||||
= shadowBuildDirectory(projectPathName, k, info->displayName, info->buildType);
|
||||
result << info;
|
||||
}
|
||||
return result;
|
||||
@@ -220,7 +222,7 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(Proj
|
||||
|
||||
if (copy.buildDirectory.isEmpty()) {
|
||||
copy.buildDirectory = shadowBuildDirectory(project->projectFilePath(), parent->kit(),
|
||||
copy.displayName);
|
||||
copy.displayName, info->buildType);
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
||||
@@ -306,18 +308,22 @@ CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExp
|
||||
case BuildTypeDebug:
|
||||
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=Debug");
|
||||
info->typeName = tr("Debug");
|
||||
info->buildType = BuildConfiguration::Debug;
|
||||
break;
|
||||
case BuildTypeRelease:
|
||||
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=Release");
|
||||
info->typeName = tr("Release");
|
||||
info->buildType = BuildConfiguration::Release;
|
||||
break;
|
||||
case BuildTypeMinSizeRel:
|
||||
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=MinSizeRel");
|
||||
info->typeName = tr("Minimum Size Release");
|
||||
info->buildType = BuildConfiguration::Release;
|
||||
break;
|
||||
case BuildTypeRelWithDebInfo:
|
||||
info->arguments = QLatin1String("-DCMAKE_BUILD_TYPE=RelWithDebInfo");
|
||||
info->typeName = tr("Release with Debug Information");
|
||||
info->buildType = BuildConfiguration::Profile;
|
||||
break;
|
||||
default:
|
||||
QTC_CHECK(false);
|
||||
|
||||
@@ -265,10 +265,28 @@ void CMakeCbpParser::parseBuildTargetOption()
|
||||
m_buildTarget.targetType = TargetType(value.toInt());
|
||||
} else if (attributes().hasAttribute(QLatin1String("working_dir"))) {
|
||||
m_buildTarget.workingDirectory = attributes().value(QLatin1String("working_dir")).toString();
|
||||
QDir dir(m_buildDirectory);
|
||||
const QString relative = dir.relativeFilePath(m_buildTarget.workingDirectory);
|
||||
m_buildTarget.sourceDirectory
|
||||
= FileName::fromString(m_sourceDirectory).appendPath(relative).toString();
|
||||
|
||||
QFile cmakeSourceInfoFile(m_buildTarget.workingDirectory
|
||||
+ QStringLiteral("/CMakeFiles/CMakeDirectoryInformation.cmake"));
|
||||
if (cmakeSourceInfoFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream stream(&cmakeSourceInfoFile);
|
||||
const QLatin1String searchSource("SET(CMAKE_RELATIVE_PATH_TOP_SOURCE \"");
|
||||
while (!stream.atEnd()) {
|
||||
const QString lineTopSource = stream.readLine().trimmed();
|
||||
if (lineTopSource.startsWith(searchSource)) {
|
||||
m_buildTarget.sourceDirectory = lineTopSource.mid(searchSource.size());
|
||||
m_buildTarget.sourceDirectory.chop(2); // cut off ")
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_buildTarget.sourceDirectory.isEmpty()) {
|
||||
QDir dir(m_buildDirectory);
|
||||
const QString relative = dir.relativeFilePath(m_buildTarget.workingDirectory);
|
||||
m_buildTarget.sourceDirectory
|
||||
= FileName::fromString(m_sourceDirectory).appendPath(relative).toString();
|
||||
}
|
||||
}
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include <QStringList>
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QDir>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
@@ -495,7 +496,7 @@ void CMakeRunPage::initializePage()
|
||||
"You can add command line arguments below. Note that "
|
||||
"CMake remembers command line arguments from the "
|
||||
"previous runs.")
|
||||
.arg(m_buildDirectory)
|
||||
.arg(QDir::toNativeSeparators(m_buildDirectory))
|
||||
.arg(m_buildConfigurationName)
|
||||
.arg(m_kitName));
|
||||
} else if (m_mode == CMakeRunPage::Recreate) {
|
||||
@@ -505,7 +506,7 @@ void CMakeRunPage::initializePage()
|
||||
"Some projects require command line arguments to "
|
||||
"the initial CMake call. Note that CMake remembers command "
|
||||
"line arguments from the previous runs.")
|
||||
.arg(m_buildDirectory)
|
||||
.arg(QDir::toNativeSeparators(m_buildDirectory))
|
||||
.arg(m_buildConfigurationName)
|
||||
.arg(m_kitName));
|
||||
} else if (m_mode == CMakeRunPage::ChangeDirectory) {
|
||||
@@ -516,7 +517,7 @@ void CMakeRunPage::initializePage()
|
||||
} else if (m_mode == CMakeRunPage::WantToUpdate) {
|
||||
m_descriptionLabel->setText(tr("Refreshing the .cbp file in \"%1\" for build configuration \"%2\" "
|
||||
"for target \"%3\".")
|
||||
.arg(m_buildDirectory)
|
||||
.arg(QDir::toNativeSeparators(m_buildDirectory))
|
||||
.arg(m_buildConfigurationName)
|
||||
.arg(m_kitName));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user