1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef TARGETSMANAGER_H
6#define TARGETSMANAGER_H
7
8#include "services/project/projectservice.h"
9
10#include <QObject>
11
12class CMakeCbpParser;
13class TargetsManager : public QObject
14{
15 Q_OBJECT
16public:
17 static TargetsManager *instance();
18
19 CMakeCbpParser *cbpParser() const;
20
21 void readTargets(const QString &buildDirectory, const QString &workspaceDirectory);
22
23 const QStringList getTargetNamesList() const;
24 const QStringList getExeTargetNamesList() const;
25
26 dpfservice::Target getActivedTargetByTargetType(const dpfservice::TargetType type);
27 dpfservice::Target getTargetByName(const QString &targetName);
28
29 const dpfservice::Targets getAllTargets() const;
30
31 void updateActivedBuildTarget(const QString &targetName);
32 void updateActivedCleanTarget(const QString &targetName);
33 void updateActiveExceTarget(const QString &targetName);
34
35 QString getCMakeConfigFile();
36
37signals:
38 void initialized();
39
40public slots:
41
42private:
43 explicit TargetsManager(QObject *parent = nullptr);
44 ~TargetsManager();
45
46 bool isGloablTarget(dpfservice::Target &target);
47 QString cbpFilePath(const QString &buildFolder);
48
49 dpfservice::Target buildTargetSelected;
50 dpfservice::Target cleanTargetSelected;
51 dpfservice::Target rebuildTargetSelected;
52 dpfservice::Target exeTargetSelected;
53
54 dpfservice::Targets exeTargets;
55 dpfservice::Targets targets;
56
57 QStringList buildTargetNameList;
58 QStringList exeTargetNameList;
59
60 CMakeCbpParser *parser = nullptr;
61};
62
63#endif // TARGETSMANAGER_H
64