cmLocalVisualStudio7Generator.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 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. /**
  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. /**
  44. * Return array of created DSP names in a STL vector.
  45. * Each executable must have its own dsp.
  46. */
  47. std::vector<std::string> GetCreatedProjectNames()
  48. {
  49. return this->CreatedProjectNames;
  50. }
  51. void SetVersion71() {this->Version = 71;}
  52. void SetVersion8() {this->Version = 8;}
  53. void SetPlatformName(const char* n) { this->PlatformName = n;}
  54. virtual void ConfigureFinalPass();
  55. private:
  56. void FillFlagMapFromCommandFlags(std::map<cmStdString,
  57. cmStdString>& flagMap,
  58. cmVS7FlagTable* flagTable,
  59. std::string& flags);
  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 OutputDefineFlags(const char* flags,
  80. std::ostream& fout);
  81. void OutputTargetRules(std::ostream& fout, cmTarget &target,
  82. const char *libName);
  83. void OutputBuildTool(std::ostream& fout, const char* configName,
  84. const char* libname, cmTarget& t);
  85. void OutputLibraries(std::ostream& fout,
  86. std::vector<cmStdString> const& libs);
  87. void OutputLibraryDirectories(std::ostream& fout,
  88. std::vector<cmStdString> const& dirs);
  89. void OutputModuleDefinitionFile(std::ostream& fout, cmTarget &target);
  90. void WriteProjectStart(std::ostream& fout, const char *libName,
  91. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  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 char* command,
  99. const char* comment,
  100. const std::vector<std::string>& depends,
  101. const std::vector<std::string>& outputs,
  102. const char* extraFlags);
  103. void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
  104. void WriteGroup(const cmSourceGroup *sg,
  105. cmTarget target, std::ostream &fout,
  106. const char *libName, std::vector<std::string> *configs);
  107. virtual std::string GetTargetDirectory(cmTarget&);
  108. std::vector<std::string> CreatedProjectNames;
  109. std::string LibraryOutputPath;
  110. std::string ExecutableOutputPath;
  111. std::string ModuleDefinitionFile;
  112. int Version;
  113. std::string PlatformName; // Win32 or x64
  114. };
  115. #endif