cmGlobalVisualStudio7Generator.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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(cmake* cm,
  18. const std::string& platformName = "");
  19. ~cmGlobalVisualStudio7Generator();
  20. ///! Get the name for the platform.
  21. std::string const& GetPlatformName() const;
  22. ///! Create a local generator appropriate to this Global Generator
  23. cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override;
  24. bool SetSystemName(std::string const& s, cmMakefile* mf) override;
  25. bool SetGeneratorPlatform(std::string const& p, 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. void GenerateBuildCommand(std::vector<std::string>& makeCommand,
  47. const std::string& makeProgram,
  48. const std::string& projectName,
  49. const std::string& projectDir,
  50. const std::string& targetName,
  51. const std::string& config, bool fast, bool verbose,
  52. std::vector<std::string> const& makeOptions =
  53. std::vector<std::string>()) override;
  54. /**
  55. * Generate the DSW workspace file.
  56. */
  57. virtual void OutputSLNFile();
  58. ///! Lookup a stored GUID or compute one deterministically.
  59. std::string GetGUID(std::string const& name);
  60. /** Append the subdirectory for the given configuration. */
  61. void AppendDirectoryForConfig(const std::string& prefix,
  62. const std::string& config,
  63. const std::string& suffix,
  64. std::string& dir) override;
  65. ///! What is the configurations directory variable called?
  66. const char* GetCMakeCFGIntDir() const override
  67. {
  68. return "$(ConfigurationName)";
  69. }
  70. /** Return true if the target project file should have the option
  71. LinkLibraryDependencies and link to .sln dependencies. */
  72. virtual bool NeedLinkLibraryDependencies(cmGeneratorTarget*)
  73. {
  74. return false;
  75. }
  76. const char* GetIntelProjectVersion();
  77. bool FindMakeProgram(cmMakefile* mf) override;
  78. /** Is the Microsoft Assembler enabled? */
  79. bool IsMasmEnabled() const { return this->MasmEnabled; }
  80. bool IsNasmEnabled() const { return this->NasmEnabled; }
  81. // Encoding for Visual Studio files
  82. virtual std::string Encoding();
  83. cmIDEFlagTable const* ExtraFlagTable;
  84. protected:
  85. void Generate() override;
  86. virtual const char* GetIDEVersion() = 0;
  87. std::string const& GetDevEnvCommand();
  88. virtual std::string FindDevEnvCommand();
  89. static const char* ExternalProjectType(const char* location);
  90. virtual void OutputSLNFile(cmLocalGenerator* root,
  91. std::vector<cmLocalGenerator*>& generators);
  92. virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
  93. std::vector<cmLocalGenerator*>& generators) = 0;
  94. virtual void WriteProject(std::ostream& fout, const std::string& name,
  95. const char* path, const cmGeneratorTarget* t) = 0;
  96. virtual void WriteProjectDepends(std::ostream& fout, const std::string& name,
  97. const char* 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. virtual void WriteSLNHeader(std::ostream& fout) = 0;
  108. std::string WriteUtilityDepend(const cmGeneratorTarget* target) override;
  109. virtual void WriteTargetsToSolution(
  110. std::ostream& fout, cmLocalGenerator* root,
  111. OrderedTargetDependSet const& projectTargets);
  112. virtual void WriteTargetDepends(
  113. std::ostream& fout, OrderedTargetDependSet const& projectTargets);
  114. virtual void WriteTargetConfigurations(
  115. std::ostream& fout, std::vector<std::string> const& configs,
  116. OrderedTargetDependSet const& projectTargets);
  117. virtual void WriteExternalProject(
  118. std::ostream& fout, const std::string& name, const char* path,
  119. const char* typeGuid, const std::set<std::string>& dependencies) = 0;
  120. std::string ConvertToSolutionPath(const char* 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. std::string GeneratorPlatform;
  135. std::string DefaultPlatformName;
  136. bool MasmEnabled;
  137. bool NasmEnabled;
  138. private:
  139. char* IntelProjectVersion;
  140. std::string DevEnvCommand;
  141. bool DevEnvCommandInitialized;
  142. std::string GetVSMakeProgram() override { return this->GetDevEnvCommand(); }
  143. };
  144. #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
  145. #endif