2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-11-23 12:11:48 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2016-01-27 10:14:00 +01:00
|
|
|
#pragma once
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2016-02-03 13:52:50 +01:00
|
|
|
#include "cmakeconfigitem.h"
|
2016-10-06 11:31:27 +02:00
|
|
|
#include "cmakeproject.h"
|
2016-02-24 18:00:24 +01:00
|
|
|
#include "configmodel.h"
|
2016-02-03 13:52:50 +01:00
|
|
|
|
2009-11-23 12:11:48 +01:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2011-02-01 18:36:00 +01:00
|
|
|
#include <projectexplorer/abi.h>
|
2010-11-01 14:14:17 +01:00
|
|
|
|
2016-10-17 13:55:54 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
2016-10-10 10:22:06 +02:00
|
|
|
namespace CppTools { class ProjectPartBuilder; }
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace ProjectExplorer { class ToolChain; }
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2009-11-23 13:29:45 +01:00
|
|
|
namespace CMakeProjectManager {
|
2013-07-22 15:53:57 +02:00
|
|
|
class CMakeBuildInfo;
|
2015-03-10 14:24:14 +01:00
|
|
|
class CMakeProject;
|
2013-07-22 15:53:57 +02:00
|
|
|
|
2009-11-23 13:29:45 +01:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
class BuildDirManager;
|
2010-01-18 12:11:04 +01:00
|
|
|
class CMakeBuildConfigurationFactory;
|
2016-02-24 18:00:24 +01:00
|
|
|
class CMakeBuildSettingsWidget;
|
2016-11-07 18:20:47 +01:00
|
|
|
class CMakeListsNode;
|
2009-11-23 13:29:45 +01:00
|
|
|
|
2009-11-23 12:11:48 +01:00
|
|
|
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
|
|
|
|
{
|
2009-11-25 18:49:59 +01:00
|
|
|
Q_OBJECT
|
2010-01-18 12:11:04 +01:00
|
|
|
friend class CMakeBuildConfigurationFactory;
|
|
|
|
|
|
2009-11-23 12:11:48 +01:00
|
|
|
public:
|
2012-04-24 15:49:09 +02:00
|
|
|
CMakeBuildConfiguration(ProjectExplorer::Target *parent);
|
2016-02-24 18:00:24 +01:00
|
|
|
~CMakeBuildConfiguration();
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2016-02-11 16:33:15 +01:00
|
|
|
bool isEnabled() const override;
|
|
|
|
|
QString disabledReason() const override;
|
|
|
|
|
|
2016-01-07 15:22:53 +01:00
|
|
|
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
2009-12-03 19:45:09 +01:00
|
|
|
|
2016-01-07 15:22:53 +01:00
|
|
|
QVariantMap toMap() const override;
|
2009-12-08 12:21:11 +01:00
|
|
|
|
2016-01-07 15:22:53 +01:00
|
|
|
BuildType buildType() const override;
|
2011-03-03 16:12:00 +01:00
|
|
|
|
2014-06-19 15:29:11 +02:00
|
|
|
void emitBuildTypeChanged();
|
|
|
|
|
|
2016-02-03 13:52:50 +01:00
|
|
|
void setCMakeConfiguration(const CMakeConfig &config);
|
2016-02-24 18:00:24 +01:00
|
|
|
bool hasCMakeConfiguration() const;
|
2016-02-03 13:52:50 +01:00
|
|
|
CMakeConfig cmakeConfiguration() const;
|
2015-09-10 16:17:38 +02:00
|
|
|
|
2016-02-11 16:33:15 +01:00
|
|
|
QString error() const;
|
2016-05-12 17:23:03 +02:00
|
|
|
QString warning() const;
|
2016-02-11 16:33:15 +01:00
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
bool isParsing() const;
|
|
|
|
|
|
2016-03-31 15:07:58 +02:00
|
|
|
void maybeForceReparse();
|
2016-02-24 18:00:24 +01:00
|
|
|
void resetData();
|
2016-02-25 14:18:05 +01:00
|
|
|
bool persistCMakeState();
|
2016-10-06 15:55:55 +02:00
|
|
|
bool updateCMakeStateBeforeBuild();
|
2016-10-06 11:31:27 +02:00
|
|
|
void runCMake();
|
|
|
|
|
void clearCache();
|
|
|
|
|
|
|
|
|
|
QList<CMakeBuildTarget> buildTargets() const;
|
2016-12-15 12:53:37 +01:00
|
|
|
void generateProjectTree(CMakeListsNode *root, const QList<const ProjectExplorer::FileNode *> &allFiles) const;
|
2016-10-10 10:22:06 +02:00
|
|
|
QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder);
|
2016-02-24 18:00:24 +01:00
|
|
|
|
2016-03-01 14:12:35 +01:00
|
|
|
static Utils::FileName
|
|
|
|
|
shadowBuildDirectory(const Utils::FileName &projectFilePath, const ProjectExplorer::Kit *k,
|
|
|
|
|
const QString &bcName, BuildConfiguration::BuildType buildType);
|
|
|
|
|
|
2016-11-14 15:18:25 +01:00
|
|
|
// Context menu action:
|
|
|
|
|
void buildTarget(const QString &buildTarget);
|
|
|
|
|
|
2016-02-11 16:33:15 +01:00
|
|
|
signals:
|
|
|
|
|
void errorOccured(const QString &message);
|
2016-05-12 17:23:03 +02:00
|
|
|
void warningOccured(const QString &message);
|
2016-02-11 16:33:15 +01:00
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
void parsingStarted();
|
|
|
|
|
void dataAvailable();
|
|
|
|
|
|
2010-01-18 12:11:04 +01:00
|
|
|
protected:
|
2012-04-24 15:49:09 +02:00
|
|
|
CMakeBuildConfiguration(ProjectExplorer::Target *parent, CMakeBuildConfiguration *source);
|
2016-01-07 15:22:53 +01:00
|
|
|
bool fromMap(const QVariantMap &map) override;
|
2010-01-18 12:11:04 +01:00
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
private:
|
2016-03-30 13:43:16 +02:00
|
|
|
void ctor();
|
2016-02-24 18:00:24 +01:00
|
|
|
QList<ConfigModel::DataItem> completeCMakeConfiguration() const;
|
|
|
|
|
void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items);
|
|
|
|
|
|
|
|
|
|
void setError(const QString &message);
|
2016-05-12 17:23:03 +02:00
|
|
|
void setWarning(const QString &message);
|
2016-02-24 18:00:24 +01:00
|
|
|
|
2016-02-03 13:52:50 +01:00
|
|
|
CMakeConfig m_configuration;
|
2016-02-11 16:33:15 +01:00
|
|
|
QString m_error;
|
2016-05-12 17:23:03 +02:00
|
|
|
QString m_warning;
|
2013-08-16 17:45:16 +02:00
|
|
|
|
2016-10-17 13:55:54 +02:00
|
|
|
std::unique_ptr<BuildDirManager> m_buildDirManager;
|
2016-02-24 18:00:24 +01:00
|
|
|
|
|
|
|
|
friend class CMakeBuildSettingsWidget;
|
2016-04-18 13:06:41 +02:00
|
|
|
friend class CMakeProjectManager::CMakeProject;
|
2009-11-23 12:11:48 +01:00
|
|
|
};
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
class CMakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-01-18 12:11:04 +01:00
|
|
|
CMakeBuildConfigurationFactory(QObject *parent = 0);
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2016-01-07 15:22:53 +01:00
|
|
|
int priority(const ProjectExplorer::Target *parent) const override;
|
|
|
|
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
|
|
|
|
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
2013-08-13 10:52:57 +02:00
|
|
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
2016-01-07 15:22:53 +01:00
|
|
|
const QString &projectPath) const override;
|
2013-07-22 15:53:57 +02:00
|
|
|
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
2016-01-07 15:22:53 +01:00
|
|
|
const ProjectExplorer::BuildInfo *info) const override;
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2016-01-07 15:22:53 +01:00
|
|
|
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const override;
|
|
|
|
|
CMakeBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
|
|
|
|
|
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
|
|
|
|
CMakeBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool canHandle(const ProjectExplorer::Target *t) const;
|
2015-09-10 16:17:38 +02:00
|
|
|
|
|
|
|
|
enum BuildType { BuildTypeNone = 0,
|
|
|
|
|
BuildTypeDebug = 1,
|
|
|
|
|
BuildTypeRelease = 2,
|
|
|
|
|
BuildTypeRelWithDebInfo = 3,
|
|
|
|
|
BuildTypeMinSizeRel = 4,
|
|
|
|
|
BuildTypeLast = 5 };
|
|
|
|
|
|
|
|
|
|
CMakeBuildInfo *createBuildInfo(const ProjectExplorer::Kit *k,
|
|
|
|
|
const QString &sourceDir,
|
|
|
|
|
BuildType buildType) const;
|
2010-01-07 18:17:24 +01:00
|
|
|
};
|
2009-11-23 13:29:45 +01:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CMakeProjectManager
|