cmLocalVisualStudio7Generator.h 5.5 KB

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