File: cmInstallRuntimeDependencySet.h

package info (click to toggle)
cmake 4.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 147,412 kB
  • sloc: ansic: 403,924; cpp: 290,826; sh: 4,091; python: 3,357; yacc: 3,106; lex: 1,189; f90: 532; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 230; perl: 217; objc: 215; xml: 198; makefile: 98; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (163 lines) | stat: -rw-r--r-- 4,157 bytes parent folder | download
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file LICENSE.rst or https://cmake.org/licensing for details.  */
#pragma once

#include <map>
#include <set>
#include <string>
#include <vector>

#include <cm/memory>
#include <cm/string_view>
#include <cmext/string_view>

class cmGeneratorTarget;
class cmInstallImportedRuntimeArtifactsGenerator;
class cmInstallTargetGenerator;

class cmInstallRuntimeDependencySet
{
public:
  cmInstallRuntimeDependencySet(std::string name = "");

  cmInstallRuntimeDependencySet(cmInstallRuntimeDependencySet const&) = delete;
  cmInstallRuntimeDependencySet& operator=(
    cmInstallRuntimeDependencySet const&) = delete;

  cm::string_view GetName() const { return this->Name; }

  cm::string_view GetDisplayName() const
  {
    if (this->Name.empty()) {
      return "<anonymous>"_s;
    }
    return this->Name;
  }

  class Item
  {
  public:
    virtual ~Item() = default;

    virtual std::string GetItemPath(std::string const& config) const = 0;

    virtual void AddPostExcludeFiles(
      std::string const& /*config*/, std::set<std::string>& /*files*/,
      cmInstallRuntimeDependencySet* /*set*/) const
    {
    }
  };

  class TargetItem : public Item
  {
  public:
    TargetItem(cmInstallTargetGenerator* target)
      : Target(target)
    {
    }

    std::string GetItemPath(std::string const& config) const override;

    void AddPostExcludeFiles(
      std::string const& config, std::set<std::string>& files,
      cmInstallRuntimeDependencySet* set) const override;

  private:
    cmInstallTargetGenerator* Target;
  };

  class ImportedTargetItem : public Item
  {
  public:
    ImportedTargetItem(cmInstallImportedRuntimeArtifactsGenerator* target)
      : Target(target)
    {
    }

    std::string GetItemPath(std::string const& config) const override;

  private:
    cmInstallImportedRuntimeArtifactsGenerator* Target;
  };

  void AddExecutable(std::unique_ptr<Item> executable);
  void AddLibrary(std::unique_ptr<Item> library);
  void AddModule(std::unique_ptr<Item> module);
  bool AddBundleExecutable(std::unique_ptr<Item> bundleExecutable);

  void AddExecutable(cmInstallTargetGenerator* executable)
  {
    this->AddExecutable(cm::make_unique<TargetItem>(executable));
  }

  void AddLibrary(cmInstallTargetGenerator* library)
  {
    this->AddLibrary(cm::make_unique<TargetItem>(library));
  }

  void AddModule(cmInstallTargetGenerator* module)
  {
    this->AddModule(cm::make_unique<TargetItem>(module));
  }

  bool AddBundleExecutable(cmInstallTargetGenerator* bundleExecutable)
  {
    return this->AddBundleExecutable(
      cm::make_unique<TargetItem>(bundleExecutable));
  }

  void AddExecutable(cmInstallImportedRuntimeArtifactsGenerator* executable)
  {
    this->AddExecutable(cm::make_unique<ImportedTargetItem>(executable));
  }

  void AddLibrary(cmInstallImportedRuntimeArtifactsGenerator* library)
  {
    this->AddLibrary(cm::make_unique<ImportedTargetItem>(library));
  }

  void AddModule(cmInstallImportedRuntimeArtifactsGenerator* module)
  {
    this->AddModule(cm::make_unique<ImportedTargetItem>(module));
  }

  bool AddBundleExecutable(
    cmInstallImportedRuntimeArtifactsGenerator* bundleExecutable)
  {
    return this->AddBundleExecutable(
      cm::make_unique<ImportedTargetItem>(bundleExecutable));
  }

  std::vector<std::unique_ptr<Item>> const& GetExecutables() const
  {
    return this->Executables;
  }

  std::vector<std::unique_ptr<Item>> const& GetLibraries() const
  {
    return this->Libraries;
  }

  std::vector<std::unique_ptr<Item>> const& GetModules() const
  {
    return this->Modules;
  }

  Item* GetBundleExecutable() const { return this->BundleExecutable; }

  bool Empty() const
  {
    return this->Executables.empty() && this->Libraries.empty() &&
      this->Modules.empty();
  }

private:
  std::string Name;
  std::vector<std::unique_ptr<Item>> Executables;
  std::vector<std::unique_ptr<Item>> Libraries;
  std::vector<std::unique_ptr<Item>> Modules;
  Item* BundleExecutable = nullptr;

  std::map<cmGeneratorTarget const*, std::set<cmGeneratorTarget const*>>
    TargetDepends;
};