cmLocalVisualStudio7Generator.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. class cmTarget;
  17. class cmSourceFile;
  18. class cmCustomCommand;
  19. class cmSourceGroup;
  20. struct cmVS7FlagTable;
  21. class cmLocalVisualStudio7GeneratorOptions;
  22. /** \class cmLocalVisualStudio7Generator
  23. * \brief Write Visual Studio .NET project files.
  24. *
  25. * cmLocalVisualStudio7Generator produces a Visual Studio .NET project
  26. * file for each target in its directory.
  27. */
  28. class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
  29. {
  30. public:
  31. ///! Set cache only and recurse to false by default.
  32. cmLocalVisualStudio7Generator();
  33. virtual ~cmLocalVisualStudio7Generator();
  34. virtual void AddHelperCommands();
  35. /**
  36. * Generate the makefile for this directory.
  37. */
  38. virtual void Generate();
  39. enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
  40. /**
  41. * Specify the type of the build: static, dll, or executable.
  42. */
  43. void SetBuildType(BuildType,const char *name);
  44. void SetVersion71() {this->Version = 71;}
  45. void SetVersion8() {this->Version = 8;}
  46. void SetVersion9() {this->Version = 9;}
  47. void SetPlatformName(const char* n) { this->PlatformName = n;}
  48. virtual void ConfigureFinalPass();
  49. void GetTargetObjectFileDirectories(cmTarget* target,
  50. std::vector<std::string>&
  51. dirs);
  52. void SetExtraFlagTable(cmVS7FlagTable const* table)
  53. { this->ExtraFlagTable = table; }
  54. private:
  55. typedef cmLocalVisualStudio7GeneratorOptions Options;
  56. void ReadAndStoreExternalGUID(const char* name,
  57. const char* path);
  58. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  59. const char* configName);
  60. void FixGlobalTargets();
  61. void WriteProjectFiles();
  62. void WriteStampFiles();
  63. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  64. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  65. void WriteVCProjFooter(std::ostream& fout);
  66. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  67. void WriteVCProjFile(std::ostream& fout, const char *libName,
  68. cmTarget &tgt);
  69. cmSourceFile* CreateVCProjBuildRule();
  70. void WriteConfigurations(std::ostream& fout,
  71. const char *libName, cmTarget &tgt);
  72. void WriteConfiguration(std::ostream& fout,
  73. const char* configName,
  74. const char* libName, cmTarget &tgt);
  75. std::string EscapeForXML(const char* s);
  76. std::string ConvertToXMLOutputPath(const char* path);
  77. std::string ConvertToXMLOutputPathSingle(const char* path);
  78. void OutputTargetRules(std::ostream& fout, const char* configName,
  79. cmTarget &target, const char *libName);
  80. void OutputBuildTool(std::ostream& fout, const char* configName,
  81. cmTarget& t);
  82. void OutputLibraries(std::ostream& fout,
  83. std::vector<cmStdString> const& libs);
  84. void OutputLibraryDirectories(std::ostream& fout,
  85. std::vector<cmStdString> const& dirs);
  86. void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target);
  87. void WriteProjectStart(std::ostream& fout, const char *libName,
  88. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  89. void WriteVCProjBeginGroup(std::ostream& fout,
  90. const char* group,
  91. const char* filter);
  92. void WriteVCProjEndGroup(std::ostream& fout);
  93. void WriteCustomRule(std::ostream& fout,
  94. const char* source,
  95. const cmCustomCommand& command,
  96. const char* extraFlags);
  97. void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
  98. void WriteGroup(const cmSourceGroup *sg,
  99. cmTarget target, std::ostream &fout,
  100. const char *libName, std::vector<std::string> *configs);
  101. virtual std::string GetTargetDirectory(cmTarget const&) const;
  102. cmVS7FlagTable const* ExtraFlagTable;
  103. std::string ModuleDefinitionFile;
  104. int Version;
  105. std::string PlatformName; // Win32 or x64
  106. };
  107. // This is a table mapping XML tag IDE names to command line options
  108. struct cmVS7FlagTable
  109. {
  110. const char* IDEName; // name used in the IDE xml file
  111. const char* commandFlag; // command line flag
  112. const char* comment; // comment
  113. const char* value; // string value
  114. unsigned int special; // flags for special handling requests
  115. enum
  116. {
  117. UserValue = (1<<0), // flag contains a user-specified value
  118. UserIgnored = (1<<1), // ignore any user value
  119. UserRequired = (1<<2), // match only when user value is non-empty
  120. Continue = (1<<3), // continue looking for matching entries
  121. SemicolonAppendable = (1<<4), // a flag that if specified multiple times
  122. // should have its value appended to the
  123. // old value with semicolons (e.g.
  124. // /NODEFAULTLIB: =>
  125. // IgnoreDefaultLibraryNames)
  126. UserValueIgnored = UserValue | UserIgnored,
  127. UserValueRequired = UserValue | UserRequired
  128. };
  129. };
  130. #endif