cmLocalVisualStudio7Generator.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 cmMakeDepend;
  17. class cmTarget;
  18. class cmSourceFile;
  19. class cmCustomCommand;
  20. class cmSourceGroup;
  21. struct cmVS7FlagTable;
  22. class cmLocalVisualStudio7GeneratorOptions;
  23. /** \class cmLocalVisualStudio7Generator
  24. * \brief Write Visual Studio .NET project files.
  25. *
  26. * cmLocalVisualStudio7Generator produces a Visual Studio .NET project
  27. * file for each target in its directory.
  28. */
  29. class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
  30. {
  31. public:
  32. ///! Set cache only and recurse to false by default.
  33. cmLocalVisualStudio7Generator();
  34. virtual ~cmLocalVisualStudio7Generator();
  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. /**
  45. * Return array of created DSP names in a STL vector.
  46. * Each executable must have its own dsp.
  47. */
  48. std::vector<std::string> GetCreatedProjectNames()
  49. {
  50. return this->CreatedProjectNames;
  51. }
  52. void SetVersion71() {this->Version = 71;}
  53. void SetVersion8() {this->Version = 8;}
  54. void SetPlatformName(const char* n) { this->PlatformName = n;}
  55. virtual void ConfigureFinalPass();
  56. private:
  57. typedef cmLocalVisualStudio7GeneratorOptions Options;
  58. void ReadAndStoreExternalGUID(const char* name,
  59. const char* path);
  60. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  61. const char* configName);
  62. void FixGlobalTargets();
  63. void OutputVCProjFile();
  64. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  65. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  66. void WriteVCProjFooter(std::ostream& fout);
  67. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  68. void WriteVCProjFile(std::ostream& fout, const char *libName,
  69. cmTarget &tgt);
  70. void AddVCProjBuildRule(cmTarget& tgt);
  71. void WriteConfigurations(std::ostream& fout,
  72. const char *libName, cmTarget &tgt);
  73. void WriteConfiguration(std::ostream& fout,
  74. const char* configName,
  75. const char* libName, cmTarget &tgt);
  76. std::string EscapeForXML(const char* s);
  77. std::string ConvertToXMLOutputPath(const char* path);
  78. std::string ConvertToXMLOutputPathSingle(const char* path);
  79. void OutputTargetRules(std::ostream& fout, cmTarget &target,
  80. const char *libName);
  81. void OutputBuildTool(std::ostream& fout, const char* configName,
  82. cmTarget& t);
  83. void OutputLibraries(std::ostream& fout,
  84. std::vector<cmStdString> const& libs);
  85. void OutputLibraryDirectories(std::ostream& fout,
  86. std::vector<cmStdString> 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 WriteVCProjBeginGroup(std::ostream& fout,
  91. const char* group,
  92. const char* filter);
  93. void WriteVCProjEndGroup(std::ostream& fout);
  94. void WriteCustomRule(std::ostream& fout,
  95. const char* source,
  96. const char* command,
  97. const char* comment,
  98. const std::vector<std::string>& depends,
  99. const std::vector<std::string>& outputs,
  100. const char* extraFlags);
  101. void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
  102. void WriteGroup(const cmSourceGroup *sg,
  103. cmTarget target, std::ostream &fout,
  104. const char *libName, std::vector<std::string> *configs);
  105. virtual std::string GetTargetDirectory(cmTarget&);
  106. std::vector<std::string> CreatedProjectNames;
  107. std::string LibraryOutputPath;
  108. std::string ExecutableOutputPath;
  109. std::string ModuleDefinitionFile;
  110. int Version;
  111. std::string PlatformName; // Win32 or x64
  112. };
  113. #endif