cmGlobalVisualStudio7Generator.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmGlobalVisualStudio7Generator_h
  11. #define cmGlobalVisualStudio7Generator_h
  12. #include "cmGlobalVisualStudioGenerator.h"
  13. #include "cmGlobalGeneratorFactory.h"
  14. class cmTarget;
  15. struct cmIDEFlagTable;
  16. /** \class cmGlobalVisualStudio7Generator
  17. * \brief Write a Unix makefiles.
  18. *
  19. * cmGlobalVisualStudio7Generator manages UNIX build process for a tree
  20. */
  21. class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
  22. {
  23. public:
  24. cmGlobalVisualStudio7Generator(cmake* cm,
  25. const std::string& platformName = "");
  26. ~cmGlobalVisualStudio7Generator();
  27. static cmGlobalGeneratorFactory* NewFactory() {
  28. return new cmGlobalGeneratorSimpleFactory
  29. <cmGlobalVisualStudio7Generator>(); }
  30. ///! Get the name for the generator.
  31. virtual std::string GetName() const {
  32. return cmGlobalVisualStudio7Generator::GetActualName();}
  33. static std::string GetActualName() {return "Visual Studio 7";}
  34. ///! Get the name for the platform.
  35. std::string const& GetPlatformName() const;
  36. ///! Create a local generator appropriate to this Global Generator
  37. virtual cmLocalGenerator *CreateLocalGenerator(cmState::Snapshot snapshot);
  38. virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
  39. virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
  40. /** Get the documentation entry for this generator. */
  41. static void GetDocumentation(cmDocumentationEntry& entry);
  42. /**
  43. * Try to determine system information such as shared library
  44. * extension, pthreads, byte order etc.
  45. */
  46. virtual void EnableLanguage(std::vector<std::string>const& languages,
  47. cmMakefile *, bool optional);
  48. /**
  49. * Try running cmake and building a file. This is used for dynamically
  50. * loaded commands, not as part of the usual build process.
  51. */
  52. virtual void GenerateBuildCommand(
  53. std::vector<std::string>& makeCommand,
  54. const std::string& makeProgram,
  55. const std::string& projectName,
  56. const std::string& projectDir,
  57. const std::string& targetName,
  58. const std::string& config,
  59. bool fast, bool verbose,
  60. std::vector<std::string> const& makeOptions = std::vector<std::string>()
  61. );
  62. /**
  63. * Generate the DSW workspace file.
  64. */
  65. virtual void OutputSLNFile();
  66. ///! Lookup a stored GUID or compute one deterministically.
  67. std::string GetGUID(std::string const& name);
  68. /** Append the subdirectory for the given configuration. */
  69. virtual void AppendDirectoryForConfig(const std::string& prefix,
  70. const std::string& config,
  71. const std::string& suffix,
  72. std::string& dir);
  73. ///! What is the configurations directory variable called?
  74. virtual const char* GetCMakeCFGIntDir() const
  75. { return "$(ConfigurationName)"; }
  76. /** Return true if the target project file should have the option
  77. LinkLibraryDependencies and link to .sln dependencies. */
  78. virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; }
  79. const char* GetIntelProjectVersion();
  80. virtual void FindMakeProgram(cmMakefile*);
  81. /** Is the Microsoft Assembler enabled? */
  82. bool IsMasmEnabled() const { return this->MasmEnabled; }
  83. // Encoding for Visual Studio files
  84. virtual std::string Encoding();
  85. cmIDEFlagTable const* ExtraFlagTable;
  86. protected:
  87. virtual void Generate();
  88. virtual const char* GetIDEVersion() { return "7.0"; }
  89. std::string const& GetDevEnvCommand();
  90. virtual std::string FindDevEnvCommand();
  91. static const char* ExternalProjectType(const char* location);
  92. virtual void OutputSLNFile(cmLocalGenerator* root,
  93. std::vector<cmLocalGenerator*>& generators);
  94. virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
  95. std::vector<cmLocalGenerator*>& generators);
  96. virtual void WriteProject(std::ostream& fout,
  97. const std::string& name, const char* path,
  98. cmTarget const& t);
  99. virtual void WriteProjectDepends(std::ostream& fout,
  100. const std::string& name, const char* path,
  101. cmTarget const&t);
  102. virtual void WriteProjectConfigurations(
  103. std::ostream& fout, const std::string& name, cmTarget::TargetType type,
  104. std::vector<std::string> const& configs,
  105. const std::set<std::string>& configsPartOfDefaultBuild,
  106. const std::string& platformMapping = "");
  107. virtual void WriteSLNGlobalSections(std::ostream& fout,
  108. cmLocalGenerator* root);
  109. virtual void WriteSLNFooter(std::ostream& fout);
  110. virtual void WriteSLNHeader(std::ostream& fout);
  111. virtual std::string WriteUtilityDepend(cmTarget const* target);
  112. virtual void WriteTargetsToSolution(
  113. std::ostream& fout,
  114. cmLocalGenerator* root,
  115. OrderedTargetDependSet const& projectTargets);
  116. virtual void WriteTargetDepends(
  117. std::ostream& fout,
  118. OrderedTargetDependSet const& projectTargets);
  119. virtual void WriteTargetConfigurations(
  120. std::ostream& fout,
  121. std::vector<std::string> const& configs,
  122. OrderedTargetDependSet const& projectTargets);
  123. virtual void WriteExternalProject(std::ostream& fout,
  124. const std::string& name,
  125. const char* path,
  126. const char* typeGuid,
  127. const std::set<std::string>&
  128. dependencies);
  129. std::string ConvertToSolutionPath(const char* path);
  130. std::set<std::string>
  131. IsPartOfDefaultBuild(std::vector<std::string> const& configs,
  132. OrderedTargetDependSet const& projectTargets,
  133. cmTarget const* target);
  134. bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
  135. cmTarget const* target);
  136. std::map<std::string, std::string> GUIDMap;
  137. virtual void WriteFolders(std::ostream& fout);
  138. virtual void WriteFoldersContent(std::ostream& fout);
  139. std::map<std::string,std::set<std::string> > VisualStudioFolders;
  140. // Set during OutputSLNFile with the name of the current project.
  141. // There is one SLN file per project.
  142. std::string CurrentProject;
  143. std::string GeneratorPlatform;
  144. std::string DefaultPlatformName;
  145. bool MasmEnabled;
  146. private:
  147. char* IntelProjectVersion;
  148. std::string DevEnvCommand;
  149. bool DevEnvCommandInitialized;
  150. virtual std::string GetVSMakeProgram() { return this->GetDevEnvCommand(); }
  151. };
  152. #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
  153. #endif