resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmExtraSublimeTextGenerator.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 #pragma once
4
5 #include "cmConfigure.h" // IWYU pragma: keep
6
7 #include <map>
8 #include <string>
9 #include <vector>
10
11 #include "cmExternalMakefileProjectGenerator.h"
12
13 class cmGeneratedFileStream;
14 class cmGeneratorTarget;
15 class cmLocalGenerator;
16 class cmMakefile;
17 class cmSourceFile;
18
19 /** \class cmExtraSublimeTextGenerator
20  * \brief Write Sublime Text 2 project files for Makefile based projects
21  */
22 class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
23 {
24 public:
25   static cmExternalMakefileProjectGeneratorFactory* GetFactory();
26   using MapSourceFileFlags = std::map<std::string, std::vector<std::string>>;
27   cmExtraSublimeTextGenerator();
28
29   void Generate() override;
30
31 private:
32   void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
33
34   void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
35                             const std::string& filename);
36
37   /** Appends all targets as build systems to the project file and get all
38    * include directories and compiler definitions used.
39    */
40   void AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
41                         const cmMakefile* mf, cmGeneratedFileStream& fout,
42                         MapSourceFileFlags& sourceFileFlags);
43   /** Returns the build command that needs to be executed to build the
44    *  specified target.
45    */
46   std::string BuildMakeCommand(const std::string& make,
47                                const std::string& makefile,
48                                const std::string& target);
49   /** Appends the specified target to the generated project file as a Sublime
50    *  Text build system.
51    */
52   void AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName,
53                     cmLocalGenerator* lg, cmGeneratorTarget* target,
54                     const char* make, const cmMakefile* makefile,
55                     const char* compiler, MapSourceFileFlags& sourceFileFlags,
56                     bool firstTarget);
57   /**
58    * Compute the flags for compilation of object files for a given @a language.
59    * @note Generally it is the value of the variable whose name is computed
60    *       by LanguageFlagsVarName().
61    */
62   std::string ComputeFlagsForObject(cmSourceFile* source, cmLocalGenerator* lg,
63                                     cmGeneratorTarget* gtgt);
64
65   std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg,
66                              cmGeneratorTarget* gtgt);
67
68   std::string ComputeIncludes(cmSourceFile* source, cmLocalGenerator* lg,
69                               cmGeneratorTarget* gtgt);
70
71   bool Open(const std::string& bindir, const std::string& projectName,
72             bool dryRun) override;
73
74   bool ExcludeBuildFolder;
75   std::string EnvSettings;
76 };