cmGlobalVisualStudio7Generator.h 7.0 KB

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