blob: f48fefa0138734427a626fdce27e783b9d1a7599 (
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
|
// Copyright (C) 2020 Alexis Jeandet.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "mesonprojectnodes.h"
#include "mesonbuildconfiguration.h"
#include "mesonbuildsystem.h"
#include "mesonpluginconstants.h"
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace MesonProjectManager::Internal {
MesonProjectNode::MesonProjectNode(const FilePath &directory)
: ProjectNode(directory)
{
setPriority(Node::DefaultProjectPriority + 1000);
setIcon(Constants::Icons::MESON);
setListInProject(false);
}
MesonTargetNode::MesonTargetNode(const FilePath &directory, const QString &name,const QString &target_type, const QStringList &filenames, bool build_by_default)
: ProjectNode(directory)
, m_name(name)
, m_target_type(target_type)
, m_filenames(filenames)
, m_build_by_default(build_by_default)
{
setPriority(Node::DefaultProjectPriority + 900);
setIcon(":/projectexplorer/images/build.png");
setListInProject(false);
setShowWhenEmpty(true);
setProductType(ProductType::Other);
}
void MesonTargetNode::build()
{
if (const auto bc = activeBuildConfig(getProject()))
static_cast<MesonBuildConfiguration *>(bc)->build(m_name);
}
QString MesonTargetNode::tooltip() const
{
return QString(R"(Target: %1
Type: %2
Build by default: %3
Produced files: %4)").arg(m_name, m_target_type,
m_build_by_default ? QStringLiteral("Yes"):QStringLiteral("No"),
m_filenames.join(", "));
}
QString MesonTargetNode::buildKey() const
{
return m_name;
}
} // MesonProjectManager::Internal
|