Changeset View
Changeset View
Standalone View
Standalone View
plugins/meson/mesonbuilder.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 | #pragma once | ||||
22 | | ||||
23 | #include <project/interfaces/iprojectbuilder.h> | ||||
24 | #include <util/path.h> | ||||
25 | | ||||
26 | namespace Meson | ||||
27 | { | ||||
28 | struct BuildDir; | ||||
29 | } | ||||
30 | | ||||
31 | class MesonBuilder : public QObject, public KDevelop::IProjectBuilder | ||||
32 | { | ||||
33 | Q_OBJECT | ||||
34 | Q_INTERFACES(KDevelop::IProjectBuilder) | ||||
35 | public: | ||||
36 | enum DirectoryStatus { | ||||
37 | DOES_NOT_EXIST = 0, | ||||
38 | CLEAN, | ||||
39 | MESON_CONFIGURED, | ||||
40 | MESON_FAILED_CONFIGURATION, | ||||
41 | INVALID_BUILD_DIR, | ||||
42 | DIR_NOT_EMPTY, | ||||
43 | EMPTY_STRING, | ||||
44 | ___UNDEFINED___ | ||||
45 | }; | ||||
46 | | ||||
47 | explicit MesonBuilder(QObject* parent); | ||||
48 | | ||||
49 | KJob* build(KDevelop::ProjectBaseItem* item) override; | ||||
50 | KJob* clean(KDevelop::ProjectBaseItem* item) override; | ||||
51 | KJob* install(KDevelop::ProjectBaseItem* dom, const QUrl& installPath) override; | ||||
52 | KJob* prune(KDevelop::IProject* project) override; | ||||
53 | | ||||
54 | KJob* configure(KDevelop::IProject* project) override; | ||||
55 | KJob* configure(KDevelop::IProject* project, Meson::BuildDir const& buildDir, | ||||
56 | DirectoryStatus status = ___UNDEFINED___); | ||||
57 | | ||||
58 | /// Evaluate a directory for the use with meson | ||||
59 | static DirectoryStatus evaluateBuildDirectory(KDevelop::Path const& path, QString const& backend); | ||||
60 | | ||||
61 | QList<KDevelop::IProjectBuilder *> additionalBuilderPlugins(KDevelop::IProject * project) const override; | ||||
62 | | ||||
63 | Q_SIGNALS: | ||||
64 | void built(KDevelop::ProjectBaseItem*); | ||||
65 | void installed(KDevelop::ProjectBaseItem*); | ||||
66 | void cleaned(KDevelop::ProjectBaseItem*); | ||||
67 | void failed(KDevelop::ProjectBaseItem*); | ||||
68 | void configured(KDevelop::IProject*); | ||||
69 | void pruned(KDevelop::IProject*); | ||||
70 | | ||||
71 | private: | ||||
72 | KDevelop::IProjectBuilder* m_ninjaBuilder = nullptr; | ||||
73 | | ||||
74 | KJob* configureIfRequired(KDevelop::IProject* project, KJob *realJob); | ||||
75 | }; |