/src/CMake/Source/cmGeneratorFileSets.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <map> |
8 | | #include <memory> |
9 | | #include <string> |
10 | | #include <unordered_map> |
11 | | #include <vector> |
12 | | |
13 | | #include <cm/string_view> |
14 | | |
15 | | #include "cmTargetPropertyEntry.h" |
16 | | |
17 | | namespace cm { |
18 | | namespace GenEx { |
19 | | struct Context; |
20 | | } |
21 | | } |
22 | | |
23 | | struct cmGeneratorExpressionDAGChecker; |
24 | | |
25 | | class cmSourceFile; |
26 | | class cmGeneratorTarget; |
27 | | class cmGeneratorFileSet; |
28 | | class cmLocalGenerator; |
29 | | |
30 | | class cmGeneratorFileSets |
31 | | { |
32 | | public: |
33 | | using TargetPropertyEntry = cm::TargetPropertyEntry; |
34 | | |
35 | | cmGeneratorFileSets(cmGeneratorTarget* target, cmLocalGenerator* lg); |
36 | | ~cmGeneratorFileSets(); |
37 | | |
38 | | cmGeneratorFileSets(cmGeneratorFileSets const&) = delete; |
39 | | cmGeneratorFileSets& operator=(cmGeneratorFileSets const&) = delete; |
40 | | |
41 | 0 | bool Empty() const { return this->FileSets.empty(); } |
42 | | |
43 | | std::vector<cmGeneratorFileSet const*> const& GetAllFileSets() const; |
44 | | std::vector<cmGeneratorFileSet const*> const& GetFileSets( |
45 | | cm::string_view type) const; |
46 | | std::vector<cmGeneratorFileSet const*> const& GetInterfaceFileSets( |
47 | | cm::string_view type) const; |
48 | | |
49 | | cmGeneratorFileSet const* GetFileSet(std::string const& name) const; |
50 | | |
51 | | cmGeneratorFileSet const* GetFileSetForSource(std::string const& config, |
52 | | std::string const& file) const; |
53 | | cmGeneratorFileSet const* GetFileSetForSource(std::string const& config, |
54 | | cmSourceFile const* sf) const; |
55 | | |
56 | | std::vector<std::unique_ptr<TargetPropertyEntry>> GetSources( |
57 | | cm::GenEx::Context const& context, cmGeneratorTarget const* target, |
58 | | cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const; |
59 | | std::vector<std::unique_ptr<TargetPropertyEntry>> GetSources( |
60 | | std::string type, cm::GenEx::Context const& context, |
61 | | cmGeneratorTarget const* target, |
62 | | cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const; |
63 | | |
64 | | private: |
65 | | // file sets indexed by name |
66 | | std::map<std::string, std::unique_ptr<cmGeneratorFileSet>> FileSets; |
67 | | std::vector<cmGeneratorFileSet const*> AllFileSets; |
68 | | // list of private file sets indexed by type |
69 | | std::unordered_map<cm::string_view, std::vector<cmGeneratorFileSet const*>> |
70 | | SelfFileSets; |
71 | | // list of interface file sets indexed by type |
72 | | std::unordered_map<cm::string_view, std::vector<cmGeneratorFileSet const*>> |
73 | | InterfaceFileSets; |
74 | | |
75 | | struct InfoByConfig |
76 | | { |
77 | | bool BuiltCache = false; |
78 | | std::map<std::string, cmGeneratorFileSet const*> FileSetCache; |
79 | | }; |
80 | | mutable std::map<std::string, InfoByConfig> Configs; |
81 | | |
82 | | void BuildInfoCache(std::string const& config) const; |
83 | | |
84 | | cmGeneratorTarget* Target; |
85 | | cmLocalGenerator* LocalGenerator; |
86 | | }; |