cmGlobalVisualStudio7Generator.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
  24. virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
  25. virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
  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. virtual void EnableLanguage(std::vector<std::string> const& languages,
  41. cmMakefile*, bool optional);
  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. virtual void GenerateBuildCommand(
  47. std::vector<std::string>& makeCommand, const std::string& makeProgram,
  48. const std::string& projectName, const std::string& projectDir,
  49. const std::string& targetName, const std::string& config, bool fast,
  50. bool verbose,
  51. std::vector<std::string> const& makeOptions = std::vector<std::string>());
  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. virtual void AppendDirectoryForConfig(const std::string& prefix,
  60. const std::string& config,
  61. const std::string& suffix,
  62. std::string& dir);
  63. ///! What is the configurations directory variable called?
  64. virtual const char* GetCMakeCFGIntDir() const
  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 char* GetIntelProjectVersion();
  75. virtual void FindMakeProgram(cmMakefile*);
  76. /** Is the Microsoft Assembler enabled? */
  77. bool IsMasmEnabled() const { return this->MasmEnabled; }
  78. // Encoding for Visual Studio files
  79. virtual std::string Encoding();
  80. cmIDEFlagTable const* ExtraFlagTable;
  81. protected:
  82. virtual void Generate();
  83. virtual const char* GetIDEVersion() = 0;
  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, cmState::TargetType type,
  98. 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. virtual void WriteSLNHeader(std::ostream& fout) = 0;
  105. virtual std::string WriteUtilityDepend(const cmGeneratorTarget* target);
  106. virtual void WriteTargetsToSolution(
  107. std::ostream& fout, cmLocalGenerator* root,
  108. OrderedTargetDependSet const& projectTargets);
  109. virtual void WriteTargetDepends(
  110. std::ostream& fout, OrderedTargetDependSet const& projectTargets);
  111. virtual void WriteTargetConfigurations(
  112. std::ostream& fout, std::vector<std::string> const& configs,
  113. OrderedTargetDependSet const& projectTargets);
  114. virtual void WriteExternalProject(
  115. std::ostream& fout, const std::string& name, const char* path,
  116. const char* typeGuid, const std::set<std::string>& dependencies) = 0;
  117. std::string ConvertToSolutionPath(const char* path);
  118. std::set<std::string> IsPartOfDefaultBuild(
  119. std::vector<std::string> const& configs,
  120. OrderedTargetDependSet const& projectTargets,
  121. cmGeneratorTarget const* target);
  122. bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
  123. cmGeneratorTarget const* target);
  124. std::map<std::string, std::string> GUIDMap;
  125. virtual void WriteFolders(std::ostream& fout);
  126. virtual void WriteFoldersContent(std::ostream& fout);
  127. std::map<std::string, std::set<std::string> > VisualStudioFolders;
  128. // Set during OutputSLNFile with the name of the current project.
  129. // There is one SLN file per project.
  130. std::string CurrentProject;
  131. std::string GeneratorPlatform;
  132. std::string DefaultPlatformName;
  133. bool MasmEnabled;
  134. private:
  135. char* IntelProjectVersion;
  136. std::string DevEnvCommand;
  137. bool DevEnvCommandInitialized;
  138. virtual std::string GetVSMakeProgram() { return this->GetDevEnvCommand(); }
  139. };
  140. #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
  141. #endif