resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmRuntimeDependencyArchive.h
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3
4 #pragma once
5
6 #include <map>
7 #include <memory>
8 #include <set>
9 #include <string>
10 #include <vector>
11
12 #include "cmsys/RegularExpression.hxx"
13
14 #include "cmBinUtilsLinker.h"
15
16 class cmExecutionStatus;
17 class cmMakefile;
18
19 class cmRuntimeDependencyArchive
20 {
21 public:
22   explicit cmRuntimeDependencyArchive(
23     cmExecutionStatus& status, std::vector<std::string> searchDirectories,
24     std::string bundleExecutable,
25     const std::vector<std::string>& preIncludeRegexes,
26     const std::vector<std::string>& preExcludeRegexes,
27     const std::vector<std::string>& postIncludeRegexes,
28     const std::vector<std::string>& postExcludeRegexes,
29     std::vector<std::string> postIncludeFiles,
30     std::vector<std::string> postExcludeFiles,
31     std::vector<std::string> postExcludeFilesStrict);
32   bool Prepare();
33   bool GetRuntimeDependencies(const std::vector<std::string>& executables,
34                               const std::vector<std::string>& libraries,
35                               const std::vector<std::string>& modules);
36
37   void SetError(const std::string& e);
38
39   const std::string& GetBundleExecutable() const;
40   const std::vector<std::string>& GetSearchDirectories() const;
41   const std::string& GetGetRuntimeDependenciesTool() const;
42   bool GetGetRuntimeDependenciesCommand(
43     const std::string& search, std::vector<std::string>& command) const;
44   bool IsPreExcluded(const std::string& name) const;
45   bool IsPostExcluded(const std::string& name) const;
46
47   void AddResolvedPath(const std::string& name, const std::string& path,
48                        bool& unique, std::vector<std::string> rpaths = {});
49   void AddUnresolvedPath(const std::string& name);
50
51   cmMakefile* GetMakefile() const;
52   const std::map<std::string, std::set<std::string>>& GetResolvedPaths() const;
53   const std::set<std::string>& GetUnresolvedPaths() const;
54   const std::map<std::string, std::vector<std::string>>& GetRPaths() const;
55
56   static bool PlatformSupportsRuntimeDependencies(const std::string& platform);
57
58 private:
59   cmExecutionStatus& Status;
60   std::unique_ptr<cmBinUtilsLinker> Linker;
61
62   std::string GetRuntimeDependenciesTool;
63   std::vector<std::string> GetRuntimeDependenciesCommand;
64
65   std::vector<std::string> SearchDirectories;
66   std::string BundleExecutable;
67   std::vector<cmsys::RegularExpression> PreIncludeRegexes;
68   std::vector<cmsys::RegularExpression> PreExcludeRegexes;
69   std::vector<cmsys::RegularExpression> PostIncludeRegexes;
70   std::vector<cmsys::RegularExpression> PostExcludeRegexes;
71   std::vector<std::string> PostIncludeFiles;
72   std::vector<std::string> PostExcludeFiles;
73   std::vector<std::string> PostExcludeFilesStrict;
74   std::map<std::string, std::set<std::string>> ResolvedPaths;
75   std::set<std::string> UnresolvedPaths;
76   std::map<std::string, std::vector<std::string>> RPaths;
77 };