Commit 7dfbb74d authored by Tobias Hunger's avatar Tobias Hunger

Qbs: Honor default build directory set up in Build & Run->General

Change-Id: I1e7d6cc97f2e8adb5956866205493d28d79887cb
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 4f73795c
......@@ -277,18 +277,16 @@ QList<ProjectExplorer::BuildInfo *> QbsBuildConfigurationFactory::availableSetup
{
QList<ProjectExplorer::BuildInfo *> result;
const Utils::FileName buildDirectory = QbsProject::defaultBuildDirectory(projectPath);
ProjectExplorer::BuildInfo *info = createBuildInfo(k, ProjectExplorer::BuildConfiguration::Debug);
//: The name of the debug build configuration created by default for a qbs project.
info->displayName = tr("Debug");
info->buildDirectory = buildDirectory;
info->buildDirectory = QbsProject::defaultBuildDirectory(projectPath, k, info->displayName);
result << info;
info = createBuildInfo(k, ProjectExplorer::BuildConfiguration::Release);
//: The name of the release build configuration created by default for a qbs project.
info->displayName = tr("Release");
info->buildDirectory = buildDirectory;
info->buildDirectory = QbsProject::defaultBuildDirectory(projectPath, k, info->displayName);
result << info;
return result;
......@@ -311,7 +309,8 @@ ProjectExplorer::BuildConfiguration *QbsBuildConfigurationFactory::create(Projec
Utils::FileName buildDir = info->buildDirectory;
if (buildDir.isEmpty())
buildDir = QbsProject::defaultBuildDirectory(parent->project()->projectDirectory());
buildDir = QbsProject::defaultBuildDirectory(parent->project()->projectDirectory(),
parent->kit(), info->displayName);
ProjectExplorer::BuildConfiguration *bc
= QbsBuildConfiguration::setup(parent, info->displayName, info->displayName,
......
......@@ -52,6 +52,7 @@
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmacroexpander.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
......@@ -247,11 +248,14 @@ bool QbsProject::hasParseResult() const
return qbsProject().isValid();
}
Utils::FileName QbsProject::defaultBuildDirectory(const QString &path)
Utils::FileName QbsProject::defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
const QString &bcName)
{
QFileInfo fi(path);
const QString buildDir = QDir(fi.canonicalPath()).absoluteFilePath(QString::fromLatin1("../%1-build").arg(fi.baseName()));
return FileName::fromString(QDir::cleanPath(buildDir));
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
ProjectExplorer::ProjectMacroExpander expander(projectFilePath, projectName, k, bcName);
QString projectDir = projectDirectory(projectFilePath);
QString buildPath = Utils::expandMacros(Core::DocumentManager::buildDirectory(), &expander);
return Utils::FileName::fromString(Utils::FileUtils::resolvePath(projectDir, buildPath));
}
qbs::Project QbsProject::qbsProject() const
......
......@@ -92,7 +92,9 @@ public:
bool hasParseResult() const;
void parseCurrentBuildConfiguration(bool force);
static Utils::FileName defaultBuildDirectory(const QString &path);
static Utils::FileName defaultBuildDirectory(const QString &projectFilePath,
const ProjectExplorer::Kit *k,
const QString &bcName);
qbs::Project qbsProject() const;
const qbs::ProjectData qbsProjectData() const;
......
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