Changeset View
Changeset View
Standalone View
Standalone View
plugins/meson/mesonmanager.h
- This file was added.
1 | /* This file is part of KDevelop | ||||
---|---|---|---|---|---|
2 | Copyright 2017 Aleix Pol Gonzalez <aleixpol@kde.org> | ||||
3 | Copyright 2018 Daniel Mensinger <daniel@mensinger-ka.de> | ||||
4 | | ||||
5 | This library is free software; you can redistribute it and/or | ||||
6 | modify it under the terms of the GNU Library General Public | ||||
7 | License as published by the Free Software Foundation; either | ||||
8 | version 2 of the License, or (at your option) any later version. | ||||
9 | | ||||
10 | This library is distributed in the hope that it will be useful, | ||||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
13 | Library General Public License for more details. | ||||
14 | | ||||
15 | You should have received a copy of the GNU Library General Public License | ||||
16 | along with this library; see the file COPYING.LIB. If not, write to | ||||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
18 | Boston, MA 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | #ifndef KDEVPLATFORM_PLUGIN_MESONMANAGER_H | ||||
22 | #define KDEVPLATFORM_PLUGIN_MESONMANAGER_H | ||||
23 | | ||||
24 | #include "mesonconfig.h" | ||||
25 | #include <project/abstractfilemanagerplugin.h> | ||||
26 | #include <project/interfaces/ibuildsystemmanager.h> | ||||
27 | | ||||
28 | class MesonBuilder; | ||||
29 | | ||||
30 | class MesonManager : public KDevelop::AbstractFileManagerPlugin, public KDevelop::IBuildSystemManager | ||||
31 | { | ||||
32 | Q_OBJECT | ||||
33 | Q_INTERFACES(KDevelop::IBuildSystemManager) | ||||
34 | | ||||
35 | public: | ||||
36 | explicit MesonManager(QObject* parent = nullptr, const QVariantList& args = QVariantList()); | ||||
37 | ~MesonManager() override; | ||||
38 | | ||||
39 | // ******************** | ||||
40 | // * Custom functions * | ||||
41 | // ******************** | ||||
42 | | ||||
43 | /// Create a new build directory and write it into the config | ||||
44 | Meson::BuildDir newBuildDirectory(KDevelop::IProject* project); | ||||
45 | | ||||
46 | /// Returns a list of all supported Meson backends (for now only ninja) | ||||
47 | QStringList supportedMesonBackends() const; | ||||
48 | QString defaultMesonBackend() const; | ||||
49 | | ||||
50 | KDevelop::Path findMeson() const; | ||||
51 | | ||||
52 | void setProjectData(KDevelop::IProject* project, const QJsonObject& data); | ||||
53 | | ||||
54 | // ********************************* | ||||
55 | // * AbstractFileManagerPlugin API * | ||||
56 | // ********************************* | ||||
57 | | ||||
58 | KDevelop::IProjectFileManager::Features features() const override; | ||||
59 | KDevelop::ProjectFolderItem* createFolderItem(KDevelop::IProject* project, const KDevelop::Path& path, | ||||
60 | KDevelop::ProjectBaseItem* parent = nullptr) override; | ||||
61 | | ||||
62 | // *********** | ||||
63 | // * IPlugin * | ||||
64 | // *********** | ||||
65 | | ||||
66 | KDevelop::ConfigPage* perProjectConfigPage(int number, const KDevelop::ProjectConfigOptions& options, | ||||
67 | QWidget* parent) override; | ||||
68 | int perProjectConfigPages() const override; | ||||
69 | | ||||
70 | // *************************** | ||||
71 | // * IBuildSystemManager API * | ||||
72 | // *************************** | ||||
73 | | ||||
74 | KJob* createImportJob(KDevelop::ProjectFolderItem* item) override; | ||||
75 | | ||||
76 | KDevelop::IProjectBuilder* builder() const override; | ||||
77 | | ||||
78 | // FIXME now: should use compile_commands.json for these (i.e. m_projects) | ||||
79 | KDevelop::Path::List includeDirectories(KDevelop::ProjectBaseItem*) const override { return {}; } | ||||
80 | KDevelop::Path::List frameworkDirectories(KDevelop::ProjectBaseItem*) const override { return {}; } | ||||
81 | QHash<QString, QString> defines(KDevelop::ProjectBaseItem*) const override { return {}; } | ||||
82 | QString extraArguments(KDevelop::ProjectBaseItem* /*item*/) const override { return {}; } | ||||
83 | bool hasBuildInfo(KDevelop::ProjectBaseItem* /*item*/) const override { return false; } | ||||
84 | | ||||
85 | KDevelop::Path buildDirectory(KDevelop::ProjectBaseItem*) const override; | ||||
86 | | ||||
87 | // fill if&when we have targets | ||||
88 | QList<KDevelop::ProjectTargetItem*> targets(KDevelop::ProjectFolderItem*) const override { return {}; } | ||||
89 | | ||||
90 | // you can ignore these for now I guess, but TODO | ||||
91 | KDevelop::ProjectTargetItem* createTarget(const QString& /*target*/, | ||||
92 | KDevelop::ProjectFolderItem* /*parent*/) override | ||||
93 | { | ||||
94 | return nullptr; | ||||
95 | } | ||||
96 | bool removeTarget(KDevelop::ProjectTargetItem* /*target*/) override { return false; } | ||||
97 | bool addFilesToTarget(const QList<KDevelop::ProjectFileItem*>& /*files*/, | ||||
98 | KDevelop::ProjectTargetItem* /*target*/) override | ||||
99 | { | ||||
100 | return false; | ||||
101 | } | ||||
102 | bool removeFilesFromTargets(const QList<KDevelop::ProjectFileItem*>& /*files*/) override { return false; } | ||||
103 | | ||||
104 | private: | ||||
105 | MesonBuilder* m_builder; | ||||
106 | QHash<KDevelop::IProject*, QJsonObject> m_projects; | ||||
107 | }; | ||||
108 | | ||||
109 | #endif |