cmGlobalVisualStudio7Generator.h 6.14 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
Ken Martin's avatar
Ken Martin committed
3 4 5
#ifndef cmGlobalVisualStudio7Generator_h
#define cmGlobalVisualStudio7Generator_h

6
#include "cmGlobalVisualStudioGenerator.h"
Brad King's avatar
Brad King committed
7

8
#include "cmGlobalGeneratorFactory.h"
Ken Martin's avatar
Ken Martin committed
9 10

class cmTarget;
Brad King's avatar
Brad King committed
11
struct cmIDEFlagTable;
Ken Martin's avatar
Ken Martin committed
12 13 14 15 16 17

/** \class cmGlobalVisualStudio7Generator
 * \brief Write a Unix makefiles.
 *
 * cmGlobalVisualStudio7Generator manages UNIX build process for a tree
 */
18
class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
Ken Martin's avatar
Ken Martin committed
19 20
{
public:
21 22
  ~cmGlobalVisualStudio7Generator();

23
  //! Create a local generator appropriate to this Global Generator
24
  cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override;
Ken Martin's avatar
Ken Martin committed
25

26 27 28 29
#if defined(CMAKE_BUILD_WITH_CMAKE)
  Json::Value GetJson() const override;
#endif

30
  bool SetSystemName(std::string const& s, cmMakefile* mf) override;
31

32 33 34 35 36 37
  /**
   * Utilized by the generator factory to determine if this generator
   * supports toolsets.
   */
  static bool SupportsToolset() { return false; }

38 39 40 41 42 43
  /**
   * Utilized by the generator factory to determine if this generator
   * supports platforms.
   */
  static bool SupportsPlatform() { return false; }

Ken Martin's avatar
Ken Martin committed
44
  /**
45
   * Try to determine system information such as shared library
46
   * extension, pthreads, byte order etc.
Ken Martin's avatar
Ken Martin committed
47
   */
48 49
  void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
                      bool optional) override;
Ken Martin's avatar
Ken Martin committed
50 51

  /**
Nicolas Despres's avatar
Nicolas Despres committed
52
   * Try running cmake and building a file. This is used for dynamically
Ken Martin's avatar
Ken Martin committed
53 54
   * loaded commands, not as part of the usual build process.
   */
55 56 57 58 59 60
  std::vector<GeneratedMakeCommand> GenerateBuildCommand(
    const std::string& makeProgram, const std::string& projectName,
    const std::string& projectDir, std::vector<std::string> const& targetNames,
    const std::string& config, bool fast, int jobs, bool verbose,
    std::vector<std::string> const& makeOptions =
      std::vector<std::string>()) override;
Ken Martin's avatar
Ken Martin committed
61 62 63 64 65 66

  /**
   * Generate the DSW workspace file.
   */
  virtual void OutputSLNFile();

67
  //! Lookup a stored GUID or compute one deterministically.
68
  std::string GetGUID(std::string const& name);
69

70
  /** Append the subdirectory for the given configuration.  */
71 72 73 74
  void AppendDirectoryForConfig(const std::string& prefix,
                                const std::string& config,
                                const std::string& suffix,
                                std::string& dir) override;
75

76
  //! What is the configurations directory variable called?
77
  const char* GetCMakeCFGIntDir() const override
78 79 80
  {
    return "$(ConfigurationName)";
  }
81

82 83
  /** Return true if the target project file should have the option
      LinkLibraryDependencies and link to .sln dependencies. */
84
  virtual bool NeedLinkLibraryDependencies(cmGeneratorTarget*)
85 86 87
  {
    return false;
  }
88

89 90
  const char* GetIntelProjectVersion();

91
  bool FindMakeProgram(cmMakefile* mf) override;
92

93 94
  /** Is the Microsoft Assembler enabled?  */
  bool IsMasmEnabled() const { return this->MasmEnabled; }
95
  bool IsNasmEnabled() const { return this->NasmEnabled; }
96

97 98 99
  // Encoding for Visual Studio files
  virtual std::string Encoding();

100 101
  cmIDEFlagTable const* ExtraFlagTable;

Bill Hoffman's avatar
Bill Hoffman committed
102
protected:
103 104 105
  cmGlobalVisualStudio7Generator(cmake* cm,
                                 std::string const& platformInGeneratorName);

106
  void Generate() override;
107

108 109 110
  std::string const& GetDevEnvCommand();
  virtual std::string FindDevEnvCommand();

111 112
  static const char* ExternalProjectType(const char* location);

113
  virtual void OutputSLNFile(cmLocalGenerator* root,
114 115
                             std::vector<cmLocalGenerator*>& generators);
  virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
116
                            std::vector<cmLocalGenerator*>& generators) = 0;
117 118 119 120 121
  virtual void WriteProject(std::ostream& fout, const std::string& name,
                            const char* path, const cmGeneratorTarget* t) = 0;
  virtual void WriteProjectDepends(std::ostream& fout, const std::string& name,
                                   const char* path,
                                   cmGeneratorTarget const* t) = 0;
122
  virtual void WriteProjectConfigurations(
123 124
    std::ostream& fout, const std::string& name,
    cmGeneratorTarget const& target, std::vector<std::string> const& configs,
125
    const std::set<std::string>& configsPartOfDefaultBuild,
126
    const std::string& platformMapping = "") = 0;
127 128
  virtual void WriteSLNGlobalSections(std::ostream& fout,
                                      cmLocalGenerator* root);
Bill Hoffman's avatar
Bill Hoffman committed
129
  virtual void WriteSLNFooter(std::ostream& fout);
130
  std::string WriteUtilityDepend(const cmGeneratorTarget* target) override;
Bill Hoffman's avatar
Bill Hoffman committed
131

132
  virtual void WriteTargetsToSolution(
133
    std::ostream& fout, cmLocalGenerator* root,
134
    OrderedTargetDependSet const& projectTargets);
135
  virtual void WriteTargetDepends(
136
    std::ostream& fout, OrderedTargetDependSet const& projectTargets);
137
  virtual void WriteTargetConfigurations(
138
    std::ostream& fout, std::vector<std::string> const& configs,
Brad King's avatar
Brad King committed
139
    OrderedTargetDependSet const& projectTargets);
140

141 142
  virtual void WriteExternalProject(
    std::ostream& fout, const std::string& name, const char* path,
143
    const char* typeGuid, const std::set<BT<std::string>>& dependencies) = 0;
Ken Martin's avatar
Ken Martin committed
144

145
  std::string ConvertToSolutionPath(const char* path);
146

147 148 149 150
  std::set<std::string> IsPartOfDefaultBuild(
    std::vector<std::string> const& configs,
    OrderedTargetDependSet const& projectTargets,
    cmGeneratorTarget const* target);
151
  bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
152
                    cmGeneratorTarget const* target);
153
  std::map<std::string, std::string> GUIDMap;
154

155 156
  virtual void WriteFolders(std::ostream& fout);
  virtual void WriteFoldersContent(std::ostream& fout);
157
  std::map<std::string, std::set<std::string>> VisualStudioFolders;
158

159 160
  // Set during OutputSLNFile with the name of the current project.
  // There is one SLN file per project.
161
  std::string CurrentProject;
162
  bool MasmEnabled;
163
  bool NasmEnabled;
164 165 166

private:
  char* IntelProjectVersion;
167 168
  std::string DevEnvCommand;
  bool DevEnvCommandInitialized;
169
  std::string GetVSMakeProgram() override { return this->GetDevEnvCommand(); }
Ken Martin's avatar
Ken Martin committed
170 171
};

172
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
173

Ken Martin's avatar
Ken Martin committed
174
#endif