aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp
blob: c68d001fc24bc3ee88bb64a5499ff808f6cf3348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (C) 2020 Alexis Jeandet.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "mesonactionsmanager.h"
#include "mesonbuildconfiguration.h"
#include "mesonbuildstep.h"
#include "mesonbuildsystem.h"
#include "mesonpluginconstants.h"
#include "mesonproject.h"
#include "mesonprojectmanagertr.h"
#include "mesonrunconfiguration.h"
#include "toolssettingsaccessor.h"
#include "toolssettingspage.h"

#include <coreplugin/dialogs/ioptionspage.h>

#include <extensionsystem/iplugin.h>

#include <projectexplorer/devicesupport/idevice.h>

#include <utils/fsengine/fileiconprovider.h>

using namespace ProjectExplorer;
using namespace Utils;

namespace MesonProjectManager::Internal {

class MesonToolAspectFactory : public DeviceToolAspectFactory
{
public:
    MesonToolAspectFactory()
    {
        setToolId(Constants::ToolsSettings::TOOL_TYPE_MESON);
        setToolType(DeviceToolAspect::BuildTool);
        setFilePattern({"meson"});
        setLabelText(Tr::tr("Meson executable:"));
    }
};

void setupMesonTools()
{
    static MesonToolAspectFactory theMesonToolAspectFactory;
}

class MesonProjectPlugin final : public ExtensionSystem::IPlugin
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "MesonProjectManager.json")

    void initialize() final
    {
        Core::IOptionsPage::registerCategory(
            Constants::SettingsPage::CATEGORY, Tr::tr("Meson"), Constants::Icons::MESON_BW);

        setupMesonTools();

        setupToolsSettingsPage();
        setupToolsSettingsAccessor();

        setupMesonBuildSystem();
        setupMesonBuildConfiguration();
        setupMesonBuildStep();

        setupMesonRunConfiguration();
        setupMesonRunAndDebugWorkers();

        setupMesonProject();

        setupMesonActions(this);

        FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build");
        FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt");
    }
};

} // MesonProjectManager::Internal

#include "mesonprojectplugin.moc"