cmLocalVisualStudio7Generator.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 m_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 m_CreatedProjectNames;
  50. }
  51. void SetVersion71() {m_Version = 71;}
  52. void SetVersion8() {m_Version = 8;}
  53. virtual void ConfigureFinalPass();
  54. private:
  55. void FillFlagMapFromCommandFlags(std::map<cmStdString, cmStdString>& flagMap,
  56. cmVS7FlagTable* flagTable,
  57. std::string& flags);
  58. void OutputVCProjFile();
  59. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  60. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  61. void WriteVCProjFooter(std::ostream& fout);
  62. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  63. void WriteVCProjFile(std::ostream& fout, const char *libName,
  64. cmTarget &tgt);
  65. void AddVCProjBuildRule();
  66. void WriteConfigurations(std::ostream& fout,
  67. const char *libName, cmTarget &tgt);
  68. void WriteConfiguration(std::ostream& fout,
  69. const char* configName,
  70. const char* libName, cmTarget &tgt);
  71. std::string EscapeForXML(const char* s);
  72. std::string ConvertToXMLOutputPath(const char* path);
  73. std::string ConvertToXMLOutputPathSingle(const char* path);
  74. void OutputDefineFlags(const char* flags,
  75. std::ostream& fout);
  76. void OutputTargetRules(std::ostream& fout, cmTarget &target,
  77. const char *libName);
  78. void OutputBuildTool(std::ostream& fout, const char* configName,
  79. const char* libname, cmTarget& t);
  80. void OutputLibraries(std::ostream& fout,
  81. const char* configName,
  82. const char* libName,
  83. cmTarget &target);
  84. void OutputLibraryDirectories(std::ostream& fout,
  85. const char* configName,
  86. const char* libName, cmTarget &target);
  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 char* output,
  100. const char* extraFlags);
  101. void WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName, std::vector<std::string> *configs);
  102. virtual std::string GetTargetDirectory(cmTarget&);
  103. std::vector<std::string> m_CreatedProjectNames;
  104. std::string m_LibraryOutputPath;
  105. std::string m_ExecutableOutputPath;
  106. std::string m_ModuleDefinitionFile;
  107. int m_Version;
  108. };
  109. #endif