cmLocalVisualStudio7Generator.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 "cmLocalGenerator.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 a LocalUnix makefiles.
  24. *
  25. * cmLocalVisualStudio7Generator produces a LocalUnix makefile from its
  26. * member Makefile.
  27. */
  28. class cmLocalVisualStudio7Generator : public cmLocalGenerator
  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, cmStdString>& flagMap,
  57. cmVS7FlagTable* flagTable,
  58. std::string& flags);
  59. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  60. const char* configName);
  61. void OutputVCProjFile();
  62. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  63. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  64. void WriteVCProjFooter(std::ostream& fout);
  65. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  66. void WriteVCProjFile(std::ostream& fout, const char *libName,
  67. cmTarget &tgt);
  68. void AddVCProjBuildRule(cmTarget& tgt);
  69. void WriteConfigurations(std::ostream& fout,
  70. const char *libName, cmTarget &tgt);
  71. void WriteConfiguration(std::ostream& fout,
  72. const char* configName,
  73. const char* libName, cmTarget &tgt);
  74. std::string EscapeForXML(const char* s);
  75. std::string ConvertToXMLOutputPath(const char* path);
  76. std::string ConvertToXMLOutputPathSingle(const char* path);
  77. void OutputDefineFlags(const char* flags,
  78. std::ostream& fout);
  79. void OutputTargetRules(std::ostream& fout, cmTarget &target,
  80. const char *libName);
  81. void OutputBuildTool(std::ostream& fout, const char* configName,
  82. const char* libname, 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 WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout,
  102. const char *libName, std::vector<std::string> *configs);
  103. virtual std::string GetTargetDirectory(cmTarget&);
  104. std::vector<std::string> CreatedProjectNames;
  105. std::string LibraryOutputPath;
  106. std::string ExecutableOutputPath;
  107. std::string ModuleDefinitionFile;
  108. int Version;
  109. std::string PlatformName; // Win32 or x64
  110. };
  111. #endif