2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 Alexis Jeandet.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2020-05-01 18:20:56 +02:00
|
|
|
|
|
|
|
|
#include "mesonprojectnodes.h"
|
2020-10-29 10:20:14 +01:00
|
|
|
|
2022-10-06 16:58:18 +02:00
|
|
|
#include "mesonbuildconfiguration.h"
|
|
|
|
|
#include "mesonbuildsystem.h"
|
2020-10-29 10:20:14 +01:00
|
|
|
#include "mesonpluginconstants.h"
|
|
|
|
|
|
2020-05-01 18:20:56 +02:00
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
#include <projectexplorer/target.h>
|
2020-10-29 10:20:14 +01:00
|
|
|
|
2020-05-01 18:20:56 +02:00
|
|
|
namespace MesonProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
MesonProjectNode::MesonProjectNode(const Utils::FilePath &directory)
|
|
|
|
|
: ProjectExplorer::ProjectNode{directory}
|
|
|
|
|
{
|
|
|
|
|
setPriority(Node::DefaultProjectPriority + 1000);
|
2021-04-08 16:31:31 +02:00
|
|
|
setIcon(Constants::Icons::MESON);
|
2020-05-01 18:20:56 +02:00
|
|
|
setListInProject(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MesonFileNode::MesonFileNode(const Utils::FilePath &file)
|
|
|
|
|
: ProjectExplorer::ProjectNode{file}
|
|
|
|
|
{
|
2021-04-08 16:31:31 +02:00
|
|
|
setIcon(ProjectExplorer::DirectoryIcon(Constants::Icons::MESON));
|
2020-05-01 18:20:56 +02:00
|
|
|
setListInProject(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MesonTargetNode::MesonTargetNode(const Utils::FilePath &directory, const QString &name)
|
|
|
|
|
: ProjectExplorer::ProjectNode{directory}
|
|
|
|
|
, m_name{name}
|
|
|
|
|
{
|
|
|
|
|
setPriority(Node::DefaultProjectPriority + 900);
|
2021-04-08 16:31:31 +02:00
|
|
|
setIcon(":/projectexplorer/images/build.png");
|
2020-05-01 18:20:56 +02:00
|
|
|
setListInProject(false);
|
|
|
|
|
setShowWhenEmpty(true);
|
|
|
|
|
setProductType(ProjectExplorer::ProductType::Other);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MesonTargetNode::build()
|
|
|
|
|
{
|
|
|
|
|
ProjectExplorer::Project *p = getProject();
|
|
|
|
|
ProjectExplorer::Target *t = p ? p->activeTarget() : nullptr;
|
|
|
|
|
if (t)
|
|
|
|
|
static_cast<MesonBuildSystem *>(t->buildSystem())->mesonBuildConfiguration()->build(m_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString MesonTargetNode::tooltip() const
|
|
|
|
|
{
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString MesonTargetNode::buildKey() const
|
|
|
|
|
{
|
|
|
|
|
return m_name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace MesonProjectManager
|