cmGlobalVisualStudio7Generator.h 6.9 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(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 DSW workspace file.
  62. */
  63. virtual void OutputSLNFile();
  64. /**
  65. * Get the list of configurations
  66. */
  67. std::vector<std::string> *GetConfigurations();
  68. ///! Create a GUID or get an existing one.
  69. void CreateGUID(const std::string& name);
  70. std::string GetGUID(const std::string& name);
  71. /** Append the subdirectory for the given configuration. */
  72. virtual void AppendDirectoryForConfig(const std::string& prefix,
  73. const std::string& config,
  74. const std::string& suffix,
  75. std::string& dir);
  76. ///! What is the configurations directory variable called?
  77. virtual const char* GetCMakeCFGIntDir() const { return "$(OutDir)"; }
  78. /** Return true if the target project file should have the option
  79. LinkLibraryDependencies and link to .sln dependencies. */
  80. virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; }
  81. const char* GetIntelProjectVersion();
  82. virtual void FindMakeProgram(cmMakefile*);
  83. /** Is the Microsoft Assembler enabled? */
  84. bool IsMasmEnabled() const { return this->MasmEnabled; }
  85. // Encoding for Visual Studio files
  86. virtual std::string Encoding();
  87. protected:
  88. virtual void Generate();
  89. virtual const char* GetIDEVersion() { return "7.0"; }
  90. std::string const& GetDevEnvCommand();
  91. virtual std::string FindDevEnvCommand();
  92. static const char* ExternalProjectType(const char* location);
  93. static cmIDEFlagTable const* GetExtraFlagTableVS7();
  94. virtual void OutputSLNFile(cmLocalGenerator* root,
  95. std::vector<cmLocalGenerator*>& generators);
  96. virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
  97. std::vector<cmLocalGenerator*>& generators);
  98. virtual void WriteProject(std::ostream& fout,
  99. const std::string& name, const char* path,
  100. cmTarget const& t);
  101. virtual void WriteProjectDepends(std::ostream& fout,
  102. const std::string& name, const char* path,
  103. cmTarget const&t);
  104. virtual void WriteProjectConfigurations(
  105. std::ostream& fout, const std::string& name, cmTarget::TargetType type,
  106. const std::set<std::string>& configsPartOfDefaultBuild,
  107. const std::string& platformMapping = "");
  108. virtual void WriteSLNGlobalSections(std::ostream& fout,
  109. cmLocalGenerator* root);
  110. virtual void WriteSLNFooter(std::ostream& fout);
  111. virtual void WriteSLNHeader(std::ostream& fout);
  112. virtual std::string WriteUtilityDepend(cmTarget const* target);
  113. virtual void WriteTargetsToSolution(
  114. std::ostream& fout,
  115. cmLocalGenerator* root,
  116. OrderedTargetDependSet const& projectTargets);
  117. virtual void WriteTargetDepends(
  118. std::ostream& fout,
  119. OrderedTargetDependSet const& projectTargets);
  120. virtual void WriteTargetConfigurations(
  121. std::ostream& fout,
  122. OrderedTargetDependSet const& projectTargets);
  123. void GenerateConfigurations(cmMakefile* mf);
  124. virtual void WriteExternalProject(std::ostream& fout,
  125. const std::string& name,
  126. const char* path,
  127. const char* typeGuid,
  128. const std::set<std::string>&
  129. dependencies);
  130. std::string ConvertToSolutionPath(const char* path);
  131. std::set<std::string>
  132. IsPartOfDefaultBuild(OrderedTargetDependSet const& projectTargets,
  133. cmTarget const* target);
  134. bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
  135. cmTarget const* target);
  136. std::vector<std::string> Configurations;
  137. std::map<std::string, std::string> GUIDMap;
  138. virtual void WriteFolders(std::ostream& fout);
  139. virtual void WriteFoldersContent(std::ostream& fout);
  140. std::map<std::string,std::set<std::string> > VisualStudioFolders;
  141. // Set during OutputSLNFile with the name of the current project.
  142. // There is one SLN file per project.
  143. std::string CurrentProject;
  144. std::string PlatformName;
  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