diff options
author | Tobias Hunger <[email protected]> | 2016-10-17 13:55:54 +0200 |
---|---|---|
committer | Tobias Hunger <[email protected]> | 2016-10-31 10:40:24 +0000 |
commit | 9a980adf3ce0258d599b7269877f92c498c8e37e (patch) | |
tree | 486525182b8943350829f83fedefd6feb387daf4 /src/plugins/cmakeprojectmanager/tealeafreader.h | |
parent | b75c6444d1d0f3abb796b23d78a24029f9fb5093 (diff) |
CMake: Implement different backends to run cmake
Only the original one is implemented so far, but at least
in theory backends for retrieving data from cmake can now
be switched at runtime.
Change-Id: Id73a81c7d40f078be95defd30a38511dca3a3720
Reviewed-by: Tim Jenssen <[email protected]>
Reviewed-by: Eike Ziller <[email protected]>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/tealeafreader.h')
-rw-r--r-- | src/plugins/cmakeprojectmanager/tealeafreader.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/src/plugins/cmakeprojectmanager/tealeafreader.h b/src/plugins/cmakeprojectmanager/tealeafreader.h new file mode 100644 index 00000000000..e855716e606 --- /dev/null +++ b/src/plugins/cmakeprojectmanager/tealeafreader.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** 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 +** 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. +** +** 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. +** +****************************************************************************/ + +#pragma once + +#include "builddirreader.h" + +namespace Utils { class QtcProcess; } + +namespace CMakeProjectManager { +namespace Internal { + +class CMakeFile; + +class TeaLeafReader : public BuildDirReader +{ + Q_OBJECT + +public: + TeaLeafReader(); + ~TeaLeafReader() final; + + bool isCompatible(const Parameters &p) final; + void resetData() final; + void parse(bool force) final; + void stop() final; + + bool isParsing() const final; + bool hasData() const final; + + QList<CMakeBuildTarget> buildTargets() const final; + CMakeConfig parsedConfiguration() const final; + void generateProjectTree(CMakeProjectNode *root) final; + QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder) final; + +private: + void cleanUpProcess(); + void extractData(); + + void startCMake(const QStringList &configurationArguments); + + void cmakeFinished(int code, QProcess::ExitStatus status); + void processCMakeOutput(); + void processCMakeError(); + + QStringList getCXXFlagsFor(const CMakeBuildTarget &buildTarget, QHash<QString, QStringList> &cache); + bool extractCXXFlagsFromMake(const CMakeBuildTarget &buildTarget, QHash<QString, QStringList> &cache); + bool extractCXXFlagsFromNinja(const CMakeBuildTarget &buildTarget, QHash<QString, QStringList> &cache); + + CMakeConfig parseConfiguration(const Utils::FileName &cacheFile, QString *errorMessage) const; + + Utils::QtcProcess *m_cmakeProcess = nullptr; + + // For error reporting: + ProjectExplorer::IOutputParser *m_parser = nullptr; + QFutureInterface<void> *m_future = nullptr; + + bool m_hasData = false; + + mutable CMakeConfig m_cmakeCache; + QSet<Utils::FileName> m_cmakeFiles; + QString m_projectName; + QList<CMakeBuildTarget> m_buildTargets; + QList<ProjectExplorer::FileNode *> m_files; + QSet<Internal::CMakeFile *> m_watchedFiles; + + friend class CMakeFile; +}; + +} // namespace Internal +} // namespace CMakeProjectManager |