cmLocalVisualStudio7Generator.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 cmLocalVisualStudio7Generator_h
  11. #define cmLocalVisualStudio7Generator_h
  12. #include "cmLocalVisualStudioGenerator.h"
  13. #include "cmVisualStudioGeneratorOptions.h"
  14. class cmTarget;
  15. class cmSourceFile;
  16. class cmCustomCommand;
  17. class cmSourceGroup;
  18. class cmLocalVisualStudio7GeneratorOptions;
  19. class cmLocalVisualStudio7GeneratorFCInfo;
  20. class cmLocalVisualStudio7GeneratorInternals;
  21. /** \class cmLocalVisualStudio7Generator
  22. * \brief Write Visual Studio .NET project files.
  23. *
  24. * cmLocalVisualStudio7Generator produces a Visual Studio .NET project
  25. * file for each target in its directory.
  26. */
  27. class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
  28. {
  29. public:
  30. ///! Set cache only and recurse to false by default.
  31. cmLocalVisualStudio7Generator();
  32. virtual ~cmLocalVisualStudio7Generator();
  33. virtual void AddHelperCommands();
  34. /**
  35. * Generate the makefile for this directory.
  36. */
  37. virtual void Generate();
  38. enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
  39. /**
  40. * Specify the type of the build: static, dll, or executable.
  41. */
  42. void SetBuildType(BuildType,const char *name);
  43. void SetVersion71() {this->Version = 71;}
  44. void SetVersion8() {this->Version = 8;}
  45. void SetVersion9() {this->Version = 9;}
  46. void SetPlatformName(const char* n) { this->PlatformName = n;}
  47. virtual void ConfigureFinalPass();
  48. void GetTargetObjectFileDirectories(cmTarget* target,
  49. std::vector<std::string>&
  50. dirs);
  51. void SetExtraFlagTable(cmVS7FlagTable const* table)
  52. { this->ExtraFlagTable = table; }
  53. virtual std::string GetTargetDirectory(cmTarget const&) const;
  54. cmSourceFile* CreateVCProjBuildRule();
  55. void WriteStampFiles();
  56. // Compute the maximum length full path to the intermediate
  57. // files directory for any configuration. This is used to construct
  58. // object file names that do not produce paths that are too long.
  59. void ComputeMaxDirectoryLength(std::string& maxdir,
  60. cmTarget& target);
  61. virtual void ReadAndStoreExternalGUID(const char* name,
  62. const char* path);
  63. protected:
  64. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  65. private:
  66. typedef cmVisualStudioGeneratorOptions Options;
  67. typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
  68. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  69. const char* configName);
  70. void FixGlobalTargets();
  71. void WriteProjectFiles();
  72. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  73. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  74. void WriteVCProjFooter(std::ostream& fout);
  75. void WriteVCProjFile(std::ostream& fout, const char *libName,
  76. cmTarget &tgt);
  77. void WriteConfigurations(std::ostream& fout,
  78. const char *libName, cmTarget &tgt);
  79. void WriteConfiguration(std::ostream& fout,
  80. const char* configName,
  81. const char* libName, cmTarget &tgt);
  82. std::string EscapeForXML(const char* s);
  83. std::string ConvertToXMLOutputPath(const char* path);
  84. std::string ConvertToXMLOutputPathSingle(const char* path);
  85. void OutputTargetRules(std::ostream& fout, const char* configName,
  86. cmTarget &target, const char *libName);
  87. void OutputBuildTool(std::ostream& fout, const char* configName,
  88. cmTarget& t, bool debug);
  89. void OutputLibraryDirectories(std::ostream& fout,
  90. std::vector<std::string> const& dirs);
  91. void WriteProjectSCC(std::ostream& fout, cmTarget& target);
  92. void WriteProjectStart(std::ostream& fout, const char *libName,
  93. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  94. void WriteProjectStartFortran(std::ostream& fout, const char *libName,
  95. cmTarget &tgt);
  96. void WriteVCProjBeginGroup(std::ostream& fout,
  97. const char* group,
  98. const char* filter);
  99. void WriteVCProjEndGroup(std::ostream& fout);
  100. void WriteCustomRule(std::ostream& fout,
  101. const char* source,
  102. const cmCustomCommand& command,
  103. FCInfo& fcinfo);
  104. void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
  105. void WriteGroup(const cmSourceGroup *sg,
  106. cmTarget& target, std::ostream &fout,
  107. const char *libName, std::vector<std::string> *configs);
  108. friend class cmLocalVisualStudio7GeneratorFCInfo;
  109. friend class cmLocalVisualStudio7GeneratorInternals;
  110. class EventWriter;
  111. friend class EventWriter;
  112. cmVS7FlagTable const* ExtraFlagTable;
  113. std::string ModuleDefinitionFile;
  114. int Version;
  115. bool FortranProject;
  116. std::string PlatformName; // Win32 or x64
  117. cmLocalVisualStudio7GeneratorInternals* Internal;
  118. };
  119. #endif