2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +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.
|
2008-12-02 14:17:16 +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
|
|
|
****************************************************************************/
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2016-01-27 10:14:00 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-03-10 14:24:14 +01:00
|
|
|
#include "cmake_global.h"
|
2017-10-18 13:05:44 +02:00
|
|
|
|
2017-09-28 11:32:39 +02:00
|
|
|
#include "builddirmanager.h"
|
|
|
|
|
#include "cmakebuildtarget.h"
|
2016-08-25 14:33:44 +02:00
|
|
|
#include "cmakeprojectimporter.h"
|
2016-12-04 03:36:12 +10:00
|
|
|
#include "treescanner.h"
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2016-01-15 16:12:54 +01:00
|
|
|
#include <projectexplorer/extracompiler.h>
|
2017-02-07 15:00:38 +01:00
|
|
|
#include <projectexplorer/projectmacro.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
|
2015-02-02 00:37:38 +02:00
|
|
|
#include <utils/fileutils.h>
|
|
|
|
|
|
2014-09-12 13:02:40 +04:00
|
|
|
#include <QFuture>
|
2016-12-04 03:36:12 +10:00
|
|
|
#include <QHash>
|
2017-07-28 11:16:18 +02:00
|
|
|
#include <QTimer>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-08-25 14:33:44 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
2017-02-06 16:59:53 +01:00
|
|
|
namespace CppTools { class CppProjectUpdater; }
|
2017-09-28 11:32:39 +02:00
|
|
|
namespace ProjectExplorer { class FileNode; }
|
2017-02-06 16:59:53 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace CMakeProjectManager {
|
|
|
|
|
|
2015-03-10 10:22:38 +01:00
|
|
|
namespace Internal {
|
2015-03-10 14:24:14 +01:00
|
|
|
class CMakeBuildConfiguration;
|
2016-11-07 18:20:47 +01:00
|
|
|
class CMakeBuildSettingsWidget;
|
2017-09-28 11:32:39 +02:00
|
|
|
class CMakeProjectNode;
|
2016-01-20 12:19:16 +01:00
|
|
|
} // namespace Internal
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-03-10 14:24:14 +01:00
|
|
|
class CMAKE_EXPORT CMakeProject : public ProjectExplorer::Project
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2016-11-07 18:20:47 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
2017-02-28 15:13:16 +01:00
|
|
|
explicit CMakeProject(const Utils::FileName &filename);
|
2016-09-30 14:11:10 +02:00
|
|
|
~CMakeProject() final;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-02-16 14:18:39 +01:00
|
|
|
QStringList buildTargetTitles(bool runnable = false) const;
|
2010-02-02 12:01:11 +01:00
|
|
|
bool hasBuildTarget(const QString &title) const;
|
2009-11-25 18:50:20 +01:00
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
CMakeBuildTarget buildTargetForTitle(const QString &title);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-09-30 14:11:10 +02:00
|
|
|
bool knowsAllBuildExecutables() const final;
|
2015-09-10 16:17:38 +02:00
|
|
|
|
2018-02-16 12:26:58 +01:00
|
|
|
bool supportsKit(const ProjectExplorer::Kit *k, QString *errorMessage = nullptr) const final;
|
2016-01-06 15:51:44 +01:00
|
|
|
|
2016-01-20 12:19:16 +01:00
|
|
|
void runCMake();
|
2017-07-28 11:16:18 +02:00
|
|
|
void runCMakeAndScanProjectTree();
|
2016-01-27 10:22:07 +01:00
|
|
|
|
2016-11-14 15:18:25 +01:00
|
|
|
// Context menu actions:
|
|
|
|
|
void buildCMakeTarget(const QString &buildTarget);
|
|
|
|
|
|
2016-08-25 14:33:44 +02:00
|
|
|
ProjectExplorer::ProjectImporter *projectImporter() const final;
|
|
|
|
|
|
2017-09-28 11:32:39 +02:00
|
|
|
bool persistCMakeState();
|
|
|
|
|
void clearCMakeCache();
|
|
|
|
|
bool mustUpdateCMakeStateBeforeBuild();
|
|
|
|
|
|
2009-03-26 17:36:58 +01:00
|
|
|
protected:
|
2016-09-30 14:11:10 +02:00
|
|
|
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) final;
|
|
|
|
|
bool setupTarget(ProjectExplorer::Target *t) final;
|
2009-03-26 17:36:58 +01:00
|
|
|
|
2016-01-07 15:22:53 +01:00
|
|
|
private:
|
2016-10-06 11:31:19 +02:00
|
|
|
QList<CMakeBuildTarget> buildTargets() const;
|
|
|
|
|
|
2017-09-28 11:32:39 +02:00
|
|
|
void handleReparseRequest(int reparseParameters);
|
|
|
|
|
|
|
|
|
|
void startParsing(int reparseParameters);
|
2017-07-28 11:16:18 +02:00
|
|
|
|
2016-12-04 03:36:12 +10:00
|
|
|
void handleTreeScanningFinished();
|
2017-07-28 11:16:18 +02:00
|
|
|
void handleParsingSuccess(Internal::CMakeBuildConfiguration *bc);
|
2017-07-13 10:51:15 +02:00
|
|
|
void handleParsingError(Internal::CMakeBuildConfiguration *bc);
|
2017-07-28 11:16:18 +02:00
|
|
|
void combineScanAndParse(Internal::CMakeBuildConfiguration *bc);
|
|
|
|
|
void updateProjectData(Internal::CMakeBuildConfiguration *bc);
|
2016-04-18 13:06:41 +02:00
|
|
|
void updateQmlJSCodeModel();
|
2016-01-20 12:19:16 +01:00
|
|
|
|
2017-09-28 11:32:39 +02:00
|
|
|
Internal::CMakeProjectNode *
|
|
|
|
|
generateProjectTree(const QList<const ProjectExplorer::FileNode*> &allFiles) const;
|
|
|
|
|
|
2016-01-15 16:12:54 +01:00
|
|
|
void createGeneratedCodeModelSupport();
|
2016-09-30 14:11:10 +02:00
|
|
|
QStringList filesGeneratedFrom(const QString &sourceFile) const final;
|
2017-09-17 20:01:41 +02:00
|
|
|
void updateTargetRunConfigurations(ProjectExplorer::Target *t);
|
2013-07-07 23:49:13 +02:00
|
|
|
void updateApplicationAndDeploymentTargets();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// TODO probably need a CMake specific node structure
|
2010-02-02 12:01:11 +01:00
|
|
|
QList<CMakeBuildTarget> m_buildTargets;
|
2017-02-06 16:59:53 +01:00
|
|
|
CppTools::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
2016-01-15 16:12:54 +01:00
|
|
|
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
|
2016-02-24 18:00:24 +01:00
|
|
|
|
2016-12-04 03:36:12 +10:00
|
|
|
Internal::TreeScanner m_treeScanner;
|
2017-09-28 11:32:39 +02:00
|
|
|
Internal::BuildDirManager m_buildDirManager;
|
2017-07-28 11:16:18 +02:00
|
|
|
|
|
|
|
|
bool m_waitingForScan = false;
|
|
|
|
|
bool m_waitingForParse = false;
|
|
|
|
|
bool m_combinedScanAndParseResult = false;
|
|
|
|
|
|
2016-12-04 03:36:12 +10:00
|
|
|
QHash<QString, bool> m_mimeBinaryCache;
|
2016-12-15 12:53:37 +01:00
|
|
|
QList<const ProjectExplorer::FileNode *> m_allFiles;
|
2016-08-25 14:33:44 +02:00
|
|
|
mutable std::unique_ptr<Internal::CMakeProjectImporter> m_projectImporter;
|
2016-12-04 03:36:12 +10:00
|
|
|
|
2017-07-28 11:16:18 +02:00
|
|
|
QTimer m_delayedParsingTimer;
|
2017-09-28 11:32:39 +02:00
|
|
|
int m_delayedParsingParameters = 0;
|
2017-07-28 11:16:18 +02:00
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
friend class Internal::CMakeBuildConfiguration;
|
2016-11-07 18:20:47 +01:00
|
|
|
friend class Internal::CMakeBuildSettingsWidget;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2008-12-02 14:09:21 +01:00
|
|
|
} // namespace CMakeProjectManager
|