cmGlobalVisualStudio7Generator.h 6.2 KB

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