cmGlobalVisualStudio7Generator.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 char* platformName = NULL);
  25. ~cmGlobalVisualStudio7Generator();
  26. static cmGlobalGeneratorFactory* NewFactory() {
  27. return new cmGlobalGeneratorSimpleFactory
  28. <cmGlobalVisualStudio7Generator>(); }
  29. ///! Get the name for the generator.
  30. virtual const char* GetName() const {
  31. return cmGlobalVisualStudio7Generator::GetActualName();}
  32. static const char* GetActualName() {return "Visual Studio 7";}
  33. ///! Get the name for the platform.
  34. const char* GetPlatformName() const { return this->PlatformName.c_str(); }
  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 char* projectName,
  54. const char* projectDir,
  55. const char* targetName,
  56. const char* 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 char* name);
  76. std::string GetGUID(const char* name);
  77. /** Append the subdirectory for the given configuration. */
  78. virtual void AppendDirectoryForConfig(const char* prefix,
  79. const char* config,
  80. const char* 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. protected:
  89. virtual const char* GetIDEVersion() { return "7.0"; }
  90. std::string const& GetDevEnvCommand();
  91. virtual std::string FindDevEnvCommand();
  92. static cmIDEFlagTable const* GetExtraFlagTableVS7();
  93. virtual void OutputSLNFile(cmLocalGenerator* root,
  94. std::vector<cmLocalGenerator*>& generators);
  95. virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
  96. std::vector<cmLocalGenerator*>& generators);
  97. virtual void WriteProject(std::ostream& fout,
  98. const char* name, const char* path, cmTarget &t);
  99. virtual void WriteProjectDepends(std::ostream& fout,
  100. const char* name, const char* path, cmTarget &t);
  101. virtual void WriteProjectConfigurations(
  102. std::ostream& fout, const char* name, cmTarget::TargetType type,
  103. const std::set<std::string>& configsPartOfDefaultBuild,
  104. const char* platformMapping = NULL);
  105. virtual void WriteSLNGlobalSections(std::ostream& fout,
  106. cmLocalGenerator* root);
  107. virtual void WriteSLNFooter(std::ostream& fout);
  108. virtual void WriteSLNHeader(std::ostream& fout);
  109. virtual std::string WriteUtilityDepend(cmTarget* target);
  110. virtual void WriteTargetsToSolution(
  111. std::ostream& fout,
  112. cmLocalGenerator* root,
  113. OrderedTargetDependSet const& projectTargets);
  114. virtual void WriteTargetDepends(
  115. std::ostream& fout,
  116. OrderedTargetDependSet const& projectTargets);
  117. virtual void WriteTargetConfigurations(
  118. std::ostream& fout,
  119. cmLocalGenerator* root,
  120. OrderedTargetDependSet const& projectTargets);
  121. void GenerateConfigurations(cmMakefile* mf);
  122. virtual void WriteExternalProject(std::ostream& fout,
  123. const char* name,
  124. const char* path,
  125. const char* typeGuid,
  126. const std::set<cmStdString>&
  127. dependencies);
  128. std::string ConvertToSolutionPath(const char* path);
  129. std::set<std::string> IsPartOfDefaultBuild(const char* project,
  130. cmTarget* target);
  131. std::vector<std::string> Configurations;
  132. std::map<cmStdString, cmStdString> GUIDMap;
  133. virtual void WriteFolders(std::ostream& fout);
  134. virtual void WriteFoldersContent(std::ostream& fout);
  135. std::map<std::string,std::set<std::string> > VisualStudioFolders;
  136. // Set during OutputSLNFile with the name of the current project.
  137. // There is one SLN file per project.
  138. std::string CurrentProject;
  139. std::string PlatformName;
  140. private:
  141. char* IntelProjectVersion;
  142. std::string DevEnvCommand;
  143. bool DevEnvCommandInitialized;
  144. virtual std::string GetVSMakeProgram() { return this->GetDevEnvCommand(); }
  145. };
  146. #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
  147. #endif