2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-11-23 12:11:48 +01:00
|
|
|
|
|
|
|
|
#include "cmakebuildconfiguration.h"
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
#include "cmakebuildinfo.h"
|
2010-01-07 18:17:24 +01:00
|
|
|
#include "cmakeopenprojectwizard.h"
|
2009-11-23 13:29:45 +01:00
|
|
|
#include "cmakeproject.h"
|
2012-10-02 17:46:19 +02:00
|
|
|
#include "cmakeprojectconstants.h"
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <coreplugin/documentmanager.h>
|
2013-07-22 15:53:57 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2013-04-10 12:02:06 +02:00
|
|
|
#include <projectexplorer/kit.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <projectexplorer/projectmacroexpander.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2015-02-04 09:32:46 +01:00
|
|
|
#include <utils/mimetypes/mimedatabase.h>
|
2013-07-22 15:53:57 +02:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QInputDialog>
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
|
|
|
|
namespace CMakeProjectManager {
|
|
|
|
|
namespace Internal {
|
2009-11-23 13:29:45 +01:00
|
|
|
|
2012-10-09 16:53:50 +02:00
|
|
|
const char USE_NINJA_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.UseNinja";
|
2014-10-22 09:16:55 +02:00
|
|
|
|
2015-01-31 21:05:34 +02:00
|
|
|
static FileName shadowBuildDirectory(const FileName &projectFilePath, const Kit *k, const QString &bcName)
|
2014-10-22 09:16:55 +02:00
|
|
|
{
|
|
|
|
|
if (projectFilePath.isEmpty())
|
2015-01-31 21:05:34 +02:00
|
|
|
return FileName();
|
2014-10-22 09:16:55 +02:00
|
|
|
|
2015-03-09 11:54:57 +01:00
|
|
|
const QString projectName = projectFilePath.parentDir().fileName();
|
2014-10-22 09:16:55 +02:00
|
|
|
ProjectMacroExpander expander(projectName, k, bcName);
|
2015-01-31 21:05:34 +02:00
|
|
|
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
|
2014-10-22 09:16:55 +02:00
|
|
|
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
2015-01-31 21:05:34 +02:00
|
|
|
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));
|
2014-10-22 09:16:55 +02:00
|
|
|
}
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2012-07-18 12:02:35 +02:00
|
|
|
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
|
2012-10-02 17:46:19 +02:00
|
|
|
BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID)), m_useNinja(false)
|
2009-11-23 12:11:48 +01:00
|
|
|
{
|
2013-01-17 15:12:46 +01:00
|
|
|
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
2015-01-31 21:05:34 +02:00
|
|
|
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
|
|
|
|
|
parent->kit(),
|
|
|
|
|
displayName()));
|
2009-12-08 12:21:11 +01:00
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
|
|
|
|
CMakeBuildConfiguration *source) :
|
2010-02-08 15:50:06 +01:00
|
|
|
BuildConfiguration(parent, source),
|
2012-10-02 17:46:12 +02:00
|
|
|
m_msvcVersion(source->m_msvcVersion),
|
2014-03-06 16:22:19 +01:00
|
|
|
m_useNinja(source->m_useNinja)
|
2009-12-08 12:21:11 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(parent);
|
2010-02-25 14:23:11 +01:00
|
|
|
cloneSteps(source);
|
2009-12-08 12:21:11 +01:00
|
|
|
}
|
|
|
|
|
|
2010-01-18 12:11:04 +01:00
|
|
|
QVariantMap CMakeBuildConfiguration::toMap() const
|
2009-12-08 12:21:11 +01:00
|
|
|
{
|
2010-01-18 12:11:04 +01:00
|
|
|
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
|
2012-10-09 16:53:50 +02:00
|
|
|
map.insert(QLatin1String(USE_NINJA_KEY), m_useNinja);
|
2010-01-18 12:11:04 +01:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
2010-09-22 15:14:07 +02:00
|
|
|
if (!BuildConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
|
2012-10-09 16:53:50 +02:00
|
|
|
m_useNinja = map.value(QLatin1String(USE_NINJA_KEY), false).toBool();
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2010-09-22 15:14:07 +02:00
|
|
|
return true;
|
2009-11-23 12:11:48 +01:00
|
|
|
}
|
2009-11-23 13:29:45 +01:00
|
|
|
|
2012-10-02 17:46:12 +02:00
|
|
|
bool CMakeBuildConfiguration::useNinja() const
|
|
|
|
|
{
|
|
|
|
|
return m_useNinja;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMakeBuildConfiguration::setUseNinja(bool useNninja)
|
|
|
|
|
{
|
|
|
|
|
if (m_useNinja != useNninja) {
|
|
|
|
|
m_useNinja = useNninja;
|
|
|
|
|
emit useNinjaChanged(m_useNinja);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-19 15:29:11 +02:00
|
|
|
void CMakeBuildConfiguration::emitBuildTypeChanged()
|
|
|
|
|
{
|
|
|
|
|
emit buildTypeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
2012-04-24 15:49:09 +02:00
|
|
|
{ }
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2012-11-08 18:02:50 +01:00
|
|
|
ProjectExplorer::NamedWidget *CMakeBuildConfiguration::createConfigWidget()
|
2009-11-26 14:43:27 +01:00
|
|
|
{
|
2012-11-08 17:35:59 +01:00
|
|
|
return new CMakeBuildSettingsWidget(this);
|
2009-11-26 14:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
/*!
|
|
|
|
|
\class CMakeBuildConfigurationFactory
|
|
|
|
|
*/
|
|
|
|
|
|
2010-01-18 12:11:04 +01:00
|
|
|
CMakeBuildConfigurationFactory::CMakeBuildConfigurationFactory(QObject *parent) :
|
|
|
|
|
ProjectExplorer::IBuildConfigurationFactory(parent)
|
2010-01-07 18:17:24 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CMakeBuildConfigurationFactory::~CMakeBuildConfigurationFactory()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-24 12:42:24 +02:00
|
|
|
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
|
2010-01-07 18:17:24 +01:00
|
|
|
{
|
2013-07-24 12:42:24 +02:00
|
|
|
return canHandle(parent) ? 0 : -1;
|
2010-01-07 18:17:24 +01:00
|
|
|
}
|
|
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBuilds(const ProjectExplorer::Target *parent) const
|
2010-01-07 18:17:24 +01:00
|
|
|
{
|
2013-07-22 15:53:57 +02:00
|
|
|
QList<ProjectExplorer::BuildInfo *> result;
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2013-08-13 10:52:57 +02:00
|
|
|
CMakeBuildInfo *info = createBuildInfo(parent->kit(),
|
2014-05-02 12:53:36 +02:00
|
|
|
parent->project()->projectDirectory().toString());
|
2013-08-13 10:52:57 +02:00
|
|
|
result << info;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-24 12:42:24 +02:00
|
|
|
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
2013-08-13 10:52:57 +02:00
|
|
|
{
|
2015-02-04 09:32:46 +01:00
|
|
|
Utils::MimeDatabase mdb;
|
|
|
|
|
if (k && mdb.mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::CMAKEPROJECTMIMETYPE)))
|
|
|
|
|
return 0;
|
|
|
|
|
return -1;
|
2013-08-13 10:52:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,
|
|
|
|
|
const QString &projectPath) const
|
|
|
|
|
{
|
|
|
|
|
QList<ProjectExplorer::BuildInfo *> result;
|
2015-01-31 21:05:34 +02:00
|
|
|
const FileName projectPathName = FileName::fromString(projectPath);
|
|
|
|
|
CMakeBuildInfo *info = createBuildInfo(k, ProjectExplorer::Project::projectDirectory(projectPathName).toString());
|
2013-08-13 10:52:57 +02:00
|
|
|
//: The name of the build configuration created by default for a cmake project.
|
|
|
|
|
info->displayName = tr("Default");
|
2015-01-31 21:05:34 +02:00
|
|
|
info->buildDirectory = shadowBuildDirectory(projectPathName, k, info->displayName);
|
2013-07-22 15:53:57 +02:00
|
|
|
result << info;
|
|
|
|
|
return result;
|
2010-01-18 12:11:04 +01:00
|
|
|
}
|
|
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer::Target *parent,
|
|
|
|
|
const ProjectExplorer::BuildInfo *info) const
|
2010-01-18 12:11:04 +01:00
|
|
|
{
|
2013-07-22 15:53:57 +02:00
|
|
|
QTC_ASSERT(info->factory() == this, return 0);
|
|
|
|
|
QTC_ASSERT(info->kitId == parent->kit()->id(), return 0);
|
|
|
|
|
QTC_ASSERT(!info->displayName.isEmpty(), return 0);
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
CMakeBuildInfo copy(*static_cast<const CMakeBuildInfo *>(info));
|
2012-07-04 13:00:10 +02:00
|
|
|
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2015-01-31 21:05:34 +02:00
|
|
|
if (copy.buildDirectory.isEmpty()) {
|
|
|
|
|
copy.buildDirectory = shadowBuildDirectory(project->projectFilePath(), parent->kit(),
|
|
|
|
|
copy.displayName);
|
|
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2014-03-26 17:36:06 +01:00
|
|
|
CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), project->projectManager(), CMakeOpenProjectWizard::ChangeDirectory, ©);
|
2012-10-02 17:46:19 +02:00
|
|
|
if (copw.exec() != QDialog::Accepted)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2012-07-18 12:02:35 +02:00
|
|
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
2013-07-22 15:53:57 +02:00
|
|
|
bc->setDisplayName(copy.displayName);
|
|
|
|
|
bc->setDefaultDisplayName(copy.displayName);
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
|
|
|
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
MakeStep *makeStep = new MakeStep(buildSteps);
|
|
|
|
|
buildSteps->insertStep(0, makeStep);
|
|
|
|
|
|
|
|
|
|
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
|
|
|
|
cleanSteps->insertStep(0, cleanMakeStep);
|
2012-11-21 23:54:06 +02:00
|
|
|
cleanMakeStep->setAdditionalArguments(QLatin1String("clean"));
|
2010-01-07 18:17:24 +01:00
|
|
|
cleanMakeStep->setClean(true);
|
|
|
|
|
|
2015-01-31 21:05:34 +02:00
|
|
|
bc->setBuildDirectory(FileName::fromString(copw.buildDirectory()));
|
2012-10-02 17:46:19 +02:00
|
|
|
bc->setUseNinja(copw.useNinja());
|
2010-01-07 18:17:24 +01:00
|
|
|
|
|
|
|
|
// Default to all
|
2012-11-21 23:54:06 +02:00
|
|
|
if (project->hasBuildTarget(QLatin1String("all")))
|
|
|
|
|
makeStep->setBuildTarget(QLatin1String("all"), true);
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
return bc;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
bool CMakeBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
|
2010-01-18 12:11:04 +01:00
|
|
|
{
|
2013-07-22 15:53:57 +02:00
|
|
|
if (!canHandle(parent))
|
|
|
|
|
return false;
|
|
|
|
|
return source->id() == Constants::CMAKE_BC_ID;
|
2010-01-18 12:11:04 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeBuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source)
|
2010-01-07 18:17:24 +01:00
|
|
|
{
|
2010-01-18 12:11:04 +01:00
|
|
|
if (!canClone(parent, source))
|
|
|
|
|
return 0;
|
2010-01-07 18:17:24 +01:00
|
|
|
CMakeBuildConfiguration *old = static_cast<CMakeBuildConfiguration *>(source);
|
2012-04-24 15:49:09 +02:00
|
|
|
return new CMakeBuildConfiguration(parent, old);
|
2010-01-07 18:17:24 +01:00
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
bool CMakeBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
|
2010-01-07 18:17:24 +01:00
|
|
|
{
|
2013-07-22 15:53:57 +02:00
|
|
|
if (!canHandle(parent))
|
|
|
|
|
return false;
|
|
|
|
|
return ProjectExplorer::idFromMap(map) == Constants::CMAKE_BC_ID;
|
2010-01-18 12:11:04 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeBuildConfiguration *CMakeBuildConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
2010-01-18 12:11:04 +01:00
|
|
|
{
|
|
|
|
|
if (!canRestore(parent, map))
|
|
|
|
|
return 0;
|
2012-04-24 15:49:09 +02:00
|
|
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
2010-01-18 12:11:04 +01:00
|
|
|
if (bc->fromMap(map))
|
|
|
|
|
return bc;
|
|
|
|
|
delete bc;
|
|
|
|
|
return 0;
|
2010-01-07 18:17:24 +01:00
|
|
|
}
|
2011-03-03 16:12:00 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
bool CMakeBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
|
|
|
|
|
{
|
2013-07-22 15:53:57 +02:00
|
|
|
QTC_ASSERT(t, return false);
|
2012-09-03 18:31:44 +02:00
|
|
|
if (!t->project()->supportsKit(t->kit()))
|
2012-04-24 15:49:09 +02:00
|
|
|
return false;
|
|
|
|
|
return qobject_cast<CMakeProject *>(t->project());
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExplorer::Kit *k,
|
|
|
|
|
const QString &sourceDir) const
|
|
|
|
|
{
|
|
|
|
|
CMakeBuildInfo *info = new CMakeBuildInfo(this);
|
|
|
|
|
info->typeName = tr("Build");
|
|
|
|
|
info->kitId = k->id();
|
2015-01-31 21:05:34 +02:00
|
|
|
info->environment = Environment::systemEnvironment();
|
2013-07-22 15:53:57 +02:00
|
|
|
k->addToEnvironment(info->environment);
|
|
|
|
|
info->useNinja = false;
|
|
|
|
|
info->sourceDirectory = sourceDir;
|
2013-08-13 10:52:57 +02:00
|
|
|
info->supportsShadowBuild = true;
|
2013-07-22 15:53:57 +02:00
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-03 16:12:00 +01:00
|
|
|
ProjectExplorer::BuildConfiguration::BuildType CMakeBuildConfiguration::buildType() const
|
|
|
|
|
{
|
|
|
|
|
QString cmakeBuildType;
|
2013-08-16 17:45:16 +02:00
|
|
|
QFile cmakeCache(buildDirectory().toString() + QLatin1String("/CMakeCache.txt"));
|
2011-03-03 16:12:00 +01:00
|
|
|
if (cmakeCache.open(QIODevice::ReadOnly)) {
|
|
|
|
|
while (!cmakeCache.atEnd()) {
|
2012-11-21 23:54:06 +02:00
|
|
|
QByteArray line = cmakeCache.readLine();
|
2011-03-03 16:12:00 +01:00
|
|
|
if (line.startsWith("CMAKE_BUILD_TYPE")) {
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (int pos = line.indexOf('='))
|
2012-11-21 23:54:06 +02:00
|
|
|
cmakeBuildType = QString::fromLocal8Bit(line.mid(pos + 1).trimmed());
|
2011-03-03 16:12:00 +01:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cmakeCache.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cover all common CMake build types
|
2012-11-21 23:54:06 +02:00
|
|
|
if (cmakeBuildType.compare(QLatin1String("Release"), Qt::CaseInsensitive) == 0
|
|
|
|
|
|| cmakeBuildType.compare(QLatin1String("MinSizeRel"), Qt::CaseInsensitive) == 0)
|
2011-03-03 16:12:00 +01:00
|
|
|
{
|
|
|
|
|
return Release;
|
2012-11-21 23:54:06 +02:00
|
|
|
} else if (cmakeBuildType.compare(QLatin1String("Debug"), Qt::CaseInsensitive) == 0
|
|
|
|
|
|| cmakeBuildType.compare(QLatin1String("DebugFull"), Qt::CaseInsensitive) == 0
|
|
|
|
|
|| cmakeBuildType.compare(QLatin1String("RelWithDebInfo"), Qt::CaseInsensitive) == 0)
|
2011-03-03 16:12:00 +01:00
|
|
|
{
|
|
|
|
|
return Debug;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Unknown;
|
|
|
|
|
}
|
2012-10-02 17:46:12 +02:00
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CMakeProjectManager
|