1
0

cmGlobalVisualStudio7Generator.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 void AddPlatformDefinitions(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 char* 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. protected:
  90. virtual const char* GetIDEVersion() { return "7.0"; }
  91. std::string const& GetDevEnvCommand();
  92. virtual std::string FindDevEnvCommand();
  93. static const char* ExternalProjectType(const char* location);
  94. static cmIDEFlagTable const* GetExtraFlagTableVS7();
  95. virtual void OutputSLNFile(cmLocalGenerator* root,
  96. std::vector<cmLocalGenerator*>& generators);
  97. virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
  98. std::vector<cmLocalGenerator*>& generators);
  99. virtual void WriteProject(std::ostream& fout,
  100. const std::string& name, const char* path,
  101. cmTarget const& t);
  102. virtual void WriteProjectDepends(std::ostream& fout,
  103. const std::string& name, const char* path,
  104. cmTarget const&t);
  105. virtual void WriteProjectConfigurations(
  106. std::ostream& fout, const std::string& name, cmTarget::TargetType type,
  107. const std::set<std::string>& configsPartOfDefaultBuild,
  108. const std::string& platformMapping = "");
  109. virtual void WriteSLNGlobalSections(std::ostream& fout,
  110. cmLocalGenerator* root);
  111. virtual void WriteSLNFooter(std::ostream& fout);
  112. virtual void WriteSLNHeader(std::ostream& fout);
  113. virtual std::string WriteUtilityDepend(cmTarget const* target);
  114. virtual void WriteTargetsToSolution(
  115. std::ostream& fout,
  116. cmLocalGenerator* root,
  117. OrderedTargetDependSet const& projectTargets);
  118. virtual void WriteTargetDepends(
  119. std::ostream& fout,
  120. OrderedTargetDependSet const& projectTargets);
  121. virtual void WriteTargetConfigurations(
  122. std::ostream& fout,
  123. cmLocalGenerator* root,
  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> IsPartOfDefaultBuild(const std::string& project,
  134. cmTarget const* target);
  135. std::vector<std::string> Configurations;
  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 PlatformName;
  144. private:
  145. char* IntelProjectVersion;
  146. std::string DevEnvCommand;
  147. bool DevEnvCommandInitialized;
  148. virtual std::string GetVSMakeProgram() { return this->GetDevEnvCommand(); }
  149. };
  150. #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
  151. #endif