cmGlobalVisualStudio7Generator.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmGlobalVisualStudio7Generator_h
  4. #define cmGlobalVisualStudio7Generator_h
  5. #include <memory>
  6. #include "cmGlobalGeneratorFactory.h"
  7. #include "cmGlobalVisualStudioGenerator.h"
  8. class cmTarget;
  9. struct cmIDEFlagTable;
  10. /** \class cmGlobalVisualStudio7Generator
  11. * \brief Write a Unix makefiles.
  12. *
  13. * cmGlobalVisualStudio7Generator manages UNIX build process for a tree
  14. */
  15. class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
  16. {
  17. public:
  18. ~cmGlobalVisualStudio7Generator();
  19. //! Create a local generator appropriate to this Global Generator
  20. std::unique_ptr<cmLocalGenerator> CreateLocalGenerator(
  21. cmMakefile* mf) override;
  22. #if !defined(CMAKE_BOOTSTRAP)
  23. Json::Value GetJson() const override;
  24. #endif
  25. bool SetSystemName(std::string const& s, cmMakefile* mf) override;
  26. /**
  27. * Utilized by the generator factory to determine if this generator
  28. * supports toolsets.
  29. */
  30. static bool SupportsToolset() { return false; }
  31. /**
  32. * Utilized by the generator factory to determine if this generator
  33. * supports platforms.
  34. */
  35. static bool SupportsPlatform() { return false; }
  36. /**
  37. * Try to determine system information such as shared library
  38. * extension, pthreads, byte order etc.
  39. */
  40. void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
  41. bool optional) override;
  42. /**
  43. * Try running cmake and building a file. This is used for dynamically
  44. * loaded commands, not as part of the usual build process.
  45. */
  46. std::vector<GeneratedMakeCommand> GenerateBuildCommand(
  47. const std::string& makeProgram, const std::string& projectName,
  48. const std::string& projectDir, std::vector<std::string> const& targetNames,
  49. const std::string& config, bool fast, int jobs, bool verbose,
  50. std::vector<std::string> const& makeOptions =
  51. std::vector<std::string>()) override;
  52. /**
  53. * Generate the DSW workspace file.
  54. */
  55. virtual void OutputSLNFile();
  56. //! Lookup a stored GUID or compute one deterministically.
  57. std::string GetGUID(std::string const& name);
  58. /** Append the subdirectory for the given configuration. */
  59. void AppendDirectoryForConfig(const std::string& prefix,
  60. const std::string& config,
  61. const std::string& suffix,
  62. std::string& dir) override;
  63. //! What is the configurations directory variable called?
  64. const char* GetCMakeCFGIntDir() const override
  65. {
  66. return "$(ConfigurationName)";
  67. }
  68. /** Return true if the target project file should have the option
  69. LinkLibraryDependencies and link to .sln dependencies. */
  70. virtual bool NeedLinkLibraryDependencies(cmGeneratorTarget*)
  71. {
  72. return false;
  73. }
  74. const std::string& GetIntelProjectVersion();
  75. bool FindMakeProgram(cmMakefile* mf) override;
  76. /** Is the Microsoft Assembler enabled? */
  77. bool IsMasmEnabled() const { return this->MasmEnabled; }
  78. bool IsNasmEnabled() const { return this->NasmEnabled; }
  79. // Encoding for Visual Studio files
  80. virtual std::string Encoding();
  81. cmIDEFlagTable const* ExtraFlagTable;
  82. protected:
  83. cmGlobalVisualStudio7Generator(cmake* cm,
  84. std::string const& platformInGeneratorName);
  85. void Generate() override;
  86. std::string const& GetDevEnvCommand();
  87. virtual std::string FindDevEnvCommand();
  88. static const char* ExternalProjectType(const std::string& location);
  89. virtual void OutputSLNFile(cmLocalGenerator* root,
  90. std::vector<cmLocalGenerator*>& generators);
  91. virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
  92. std::vector<cmLocalGenerator*>& generators) = 0;
  93. virtual void WriteProject(std::ostream& fout, const std::string& name,
  94. const std::string& path,
  95. const cmGeneratorTarget* t) = 0;
  96. virtual void WriteProjectDepends(std::ostream& fout, const std::string& name,
  97. const std::string& path,
  98. cmGeneratorTarget const* t) = 0;
  99. virtual void WriteProjectConfigurations(
  100. std::ostream& fout, const std::string& name,
  101. cmGeneratorTarget const& target, std::vector<std::string> const& configs,
  102. const std::set<std::string>& configsPartOfDefaultBuild,
  103. const std::string& platformMapping = "") = 0;
  104. virtual void WriteSLNGlobalSections(std::ostream& fout,
  105. cmLocalGenerator* root);
  106. virtual void WriteSLNFooter(std::ostream& fout);
  107. std::string WriteUtilityDepend(const cmGeneratorTarget* target) override;
  108. virtual void WriteTargetsToSolution(
  109. std::ostream& fout, cmLocalGenerator* root,
  110. OrderedTargetDependSet const& projectTargets);
  111. virtual void WriteTargetDepends(
  112. std::ostream& fout, OrderedTargetDependSet const& projectTargets);
  113. virtual void WriteTargetConfigurations(
  114. std::ostream& fout, std::vector<std::string> const& configs,
  115. OrderedTargetDependSet const& projectTargets);
  116. virtual void WriteExternalProject(
  117. std::ostream& fout, const std::string& name, const std::string& path,
  118. const char* typeGuid,
  119. const std::set<BT<std::pair<std::string, bool>>>& dependencies) = 0;
  120. std::string ConvertToSolutionPath(const std::string& path);
  121. std::set<std::string> IsPartOfDefaultBuild(
  122. std::vector<std::string> const& configs,
  123. OrderedTargetDependSet const& projectTargets,
  124. cmGeneratorTarget const* target);
  125. bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
  126. cmGeneratorTarget const* target);
  127. std::map<std::string, std::string> GUIDMap;
  128. virtual void WriteFolders(std::ostream& fout);
  129. virtual void WriteFoldersContent(std::ostream& fout);
  130. std::map<std::string, std::set<std::string>> VisualStudioFolders;
  131. // Set during OutputSLNFile with the name of the current project.
  132. // There is one SLN file per project.
  133. std::string CurrentProject;
  134. bool MasmEnabled;
  135. bool NasmEnabled;
  136. private:
  137. std::string IntelProjectVersion;
  138. std::string DevEnvCommand;
  139. bool DevEnvCommandInitialized;
  140. std::string GetVSMakeProgram() override { return this->GetDevEnvCommand(); }
  141. };
  142. #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
  143. #endif