cmLocalVisualStudio7Generator.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 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. private:
  57. typedef cmLocalVisualStudio7GeneratorOptions Options;
  58. typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
  59. void ReadAndStoreExternalGUID(const char* name,
  60. const char* path);
  61. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  62. const char* configName);
  63. void FixGlobalTargets();
  64. void WriteProjectFiles();
  65. void WriteStampFiles();
  66. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  67. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  68. void WriteVCProjFooter(std::ostream& fout);
  69. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  70. void WriteVCProjFile(std::ostream& fout, const char *libName,
  71. cmTarget &tgt);
  72. cmSourceFile* CreateVCProjBuildRule();
  73. void WriteConfigurations(std::ostream& fout,
  74. const char *libName, cmTarget &tgt);
  75. void WriteConfiguration(std::ostream& fout,
  76. const char* configName,
  77. const char* libName, cmTarget &tgt);
  78. std::string EscapeForXML(const char* s);
  79. std::string ConvertToXMLOutputPath(const char* path);
  80. std::string ConvertToXMLOutputPathSingle(const char* path);
  81. void OutputTargetRules(std::ostream& fout, const char* configName,
  82. cmTarget &target, const char *libName);
  83. void OutputBuildTool(std::ostream& fout, const char* configName,
  84. cmTarget& t, bool debug);
  85. void OutputLibraryDirectories(std::ostream& fout,
  86. std::vector<std::string> const& dirs);
  87. void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target);
  88. void WriteProjectStart(std::ostream& fout, const char *libName,
  89. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  90. void WriteProjectStartFortran(std::ostream& fout, const char *libName,
  91. cmTarget &tgt);
  92. void WriteVCProjBeginGroup(std::ostream& fout,
  93. const char* group,
  94. const char* filter);
  95. void WriteVCProjEndGroup(std::ostream& fout);
  96. void WriteCustomRule(std::ostream& fout,
  97. const char* source,
  98. const cmCustomCommand& command,
  99. FCInfo& fcinfo);
  100. void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
  101. void WriteGroup(const cmSourceGroup *sg,
  102. cmTarget& target, std::ostream &fout,
  103. const char *libName, std::vector<std::string> *configs);
  104. virtual std::string GetTargetDirectory(cmTarget const&) const;
  105. friend class cmLocalVisualStudio7GeneratorFCInfo;
  106. friend class cmLocalVisualStudio7GeneratorInternals;
  107. class EventWriter;
  108. friend class EventWriter;
  109. void MaybeCreateImplibDir(cmTarget& target, const char* config,
  110. EventWriter& event);
  111. cmVS7FlagTable const* ExtraFlagTable;
  112. std::string ModuleDefinitionFile;
  113. int Version;
  114. bool FortranProject;
  115. std::string PlatformName; // Win32 or x64
  116. cmLocalVisualStudio7GeneratorInternals* Internal;
  117. };
  118. // This is a table mapping XML tag IDE names to command line options
  119. struct cmVS7FlagTable
  120. {
  121. const char* IDEName; // name used in the IDE xml file
  122. const char* commandFlag; // command line flag
  123. const char* comment; // comment
  124. const char* value; // string value
  125. unsigned int special; // flags for special handling requests
  126. enum
  127. {
  128. UserValue = (1<<0), // flag contains a user-specified value
  129. UserIgnored = (1<<1), // ignore any user value
  130. UserRequired = (1<<2), // match only when user value is non-empty
  131. Continue = (1<<3), // continue looking for matching entries
  132. SemicolonAppendable = (1<<4), // a flag that if specified multiple times
  133. // should have its value appended to the
  134. // old value with semicolons (e.g.
  135. // /NODEFAULTLIB: =>
  136. // IgnoreDefaultLibraryNames)
  137. UserValueIgnored = UserValue | UserIgnored,
  138. UserValueRequired = UserValue | UserRequired
  139. };
  140. };
  141. #endif