cmGlobalVisualStudio7Generator.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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(const std::string& platformName = "");
  25. ~cmGlobalVisualStudio7Generator();
  26. static cmGlobalGeneratorFactory* NewFactory() {
  27. return new cmGlobalGeneratorSimpleFactory
  28. <cmGlobalVisualStudio7Generator>(); }
  29. ///! Get the name for the generator.
  30. virtual std::string GetName() const {
  31. return cmGlobalVisualStudio7Generator::GetActualName();}
  32. static std::string GetActualName() {return "Visual Studio 7";}
  33. ///! Get the name for the platform.
  34. const std::string& GetPlatformName() const { return this->PlatformName; }
  35. ///! Create a local generator appropriate to this Global Generator
  36. virtual cmLocalGenerator *CreateLocalGenerator();
  37. virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
  38. /** Get the documentation entry for this generator. */
  39. static void GetDocumentation(cmDocumentationEntry& entry);
  40. /**
  41. * Try to determine system infomation such as shared library
  42. * extension, pthreads, byte order etc.
  43. */
  44. virtual void EnableLanguage(std::vector<std::string>const& languages,
  45. cmMakefile *, bool optional);
  46. /**
  47. * Try running cmake and building a file. This is used for dynamically
  48. * loaded commands, not as part of the usual build process.
  49. */
  50. virtual void GenerateBuildCommand(
  51. std::vector<std::string>& makeCommand,
  52. const std::string& makeProgram,
  53. const std::string& projectName,
  54. const std::string& projectDir,
  55. const std::string& targetName,
  56. const std::string& config,
  57. bool fast,
  58. std::vector<std::string> const& makeOptions = std::vector<std::string>()
  59. );
  60. /**
  61. * Generate the all required files for building this project/tree. This
  62. * basically creates a series of LocalGenerators for each directory and
  63. * requests that they Generate.
  64. */
  65. virtual void Generate();
  66. /**
  67. * Generate the DSW workspace file.
  68. */
  69. virtual void OutputSLNFile();
  70. /**
  71. * Get the list of configurations
  72. */
  73. std::vector<std::string> *GetConfigurations();
  74. ///! Create a GUID or get an existing one.
  75. void CreateGUID(const std::string& name);
  76. std::string GetGUID(const std::string& name);
  77. /** Append the subdirectory for the given configuration. */
  78. virtual void AppendDirectoryForConfig(const std::string& prefix,
  79. const std::string& config,
  80. const std::string& suffix,
  81. std::string& dir);
  82. ///! What is the configurations directory variable called?
  83. virtual const char* GetCMakeCFGIntDir() const { return "$(OutDir)"; }
  84. /** Return true if the target project file should have the option
  85. LinkLibraryDependencies and link to .sln dependencies. */
  86. virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; }
  87. const char* GetIntelProjectVersion();
  88. virtual void FindMakeProgram(cmMakefile*);
  89. // Encoding for Visual Studio files
  90. virtual std::string Encoding();
  91. protected:
  92. virtual const char* GetIDEVersion() { return "7.0"; }
  93. std::string const& GetDevEnvCommand();
  94. virtual std::string FindDevEnvCommand();
  95. static const char* ExternalProjectType(const char* location);
  96. static cmIDEFlagTable const* GetExtraFlagTableVS7();
  97. virtual void OutputSLNFile(cmLocalGenerator* root,
  98. std::vector<cmLocalGenerator*>& generators);
  99. virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
  100. std::vector<cmLocalGenerator*>& generators);
  101. virtual void WriteProject(std::ostream& fout,
  102. const std::string& name, const char* path,
  103. cmTarget const& t);
  104. virtual void WriteProjectDepends(std::ostream& fout,
  105. const std::string& name, const char* path,
  106. cmTarget const&t);
  107. virtual void WriteProjectConfigurations(
  108. std::ostream& fout, const std::string& name, cmTarget::TargetType type,
  109. const std::set<std::string>& configsPartOfDefaultBuild,
  110. const std::string& platformMapping = "");
  111. virtual void WriteSLNGlobalSections(std::ostream& fout,
  112. cmLocalGenerator* root);
  113. virtual void WriteSLNFooter(std::ostream& fout);
  114. virtual void WriteSLNHeader(std::ostream& fout);
  115. virtual std::string WriteUtilityDepend(cmTarget const* target);
  116. virtual void WriteTargetsToSolution(
  117. std::ostream& fout,
  118. cmLocalGenerator* root,
  119. OrderedTargetDependSet const& projectTargets);
  120. virtual void WriteTargetDepends(
  121. std::ostream& fout,
  122. OrderedTargetDependSet const& projectTargets);
  123. virtual void WriteTargetConfigurations(
  124. std::ostream& fout,
  125. OrderedTargetDependSet const& projectTargets);
  126. void GenerateConfigurations(cmMakefile* mf);
  127. virtual void WriteExternalProject(std::ostream& fout,
  128. const std::string& name,
  129. const char* path,
  130. const char* typeGuid,
  131. const std::set<std::string>&
  132. dependencies);
  133. std::string ConvertToSolutionPath(const char* path);
  134. std::set<std::string>
  135. IsPartOfDefaultBuild(OrderedTargetDependSet const& projectTargets,
  136. cmTarget const* target);
  137. bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
  138. cmTarget const* target);
  139. std::vector<std::string> Configurations;
  140. std::map<std::string, std::string> GUIDMap;
  141. virtual void WriteFolders(std::ostream& fout);
  142. virtual void WriteFoldersContent(std::ostream& fout);
  143. std::map<std::string,std::set<std::string> > VisualStudioFolders;
  144. // Set during OutputSLNFile with the name of the current project.
  145. // There is one SLN file per project.
  146. std::string CurrentProject;
  147. std::string PlatformName;
  148. private:
  149. char* IntelProjectVersion;
  150. std::string DevEnvCommand;
  151. bool DevEnvCommandInitialized;
  152. virtual std::string GetVSMakeProgram() { return this->GetDevEnvCommand(); }
  153. };
  154. #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
  155. #endif