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. /** \class cmLocalVisualStudio7Generator
  22. * \brief Write a LocalUnix makefiles.
  23. *
  24. * cmLocalVisualStudio7Generator produces a LocalUnix makefile from its
  25. * member m_Makefile.
  26. */
  27. class cmLocalVisualStudio7Generator : public cmLocalGenerator
  28. {
  29. public:
  30. ///! Set cache only and recurse to false by default.
  31. cmLocalVisualStudio7Generator();
  32. virtual ~cmLocalVisualStudio7Generator();
  33. /**
  34. * Generate the makefile for this directory. fromTheTop indicates if this
  35. * is being invoked as part of a global Generate or specific to this
  36. * directory. The difference is that when done from the Top we might skip
  37. * some steps to save time, such as dependency generation for the
  38. * makefiles. This is done by a direct invocation from make.
  39. */
  40. virtual void Generate(bool fromTheTop);
  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. /**
  47. * Return array of created DSP names in a STL vector.
  48. * Each executable must have its own dsp.
  49. */
  50. std::vector<std::string> GetCreatedProjectNames()
  51. {
  52. return m_CreatedProjectNames;
  53. }
  54. void SetVersion71() {m_Version71 = true;}
  55. private:
  56. void OutputVCProjFile();
  57. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  58. const cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  59. void WriteVCProjFooter(std::ostream& fout);
  60. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  61. void WriteVCProjFile(std::ostream& fout, const char *libName,
  62. cmTarget &tgt);
  63. void AddVCProjBuildRule();
  64. void WriteConfigurations(std::ostream& fout,
  65. const char *libName,
  66. const cmTarget &tgt);
  67. void WriteConfiguration(std::ostream& fout,
  68. const char* configName,
  69. const char* libName,
  70. const 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(std::ostream& fout);
  75. void OutputTargetRules(std::ostream& fout,
  76. const cmTarget &target,
  77. const char *libName);
  78. void OutputBuildTool(std::ostream& fout, const char* configName,
  79. const char* libname, const cmTarget& t);
  80. void OutputLibraries(std::ostream& fout,
  81. const char* configName,
  82. const char* libName,
  83. const cmTarget &target);
  84. void OutputLibraryDirectories(std::ostream& fout,
  85. const char* configName,
  86. const char* libName,
  87. const cmTarget &target);
  88. void OutputModuleDefinitionFile(std::ostream& fout,
  89. const cmTarget &target);
  90. void WriteProjectStart(std::ostream& fout, const char *libName,
  91. const 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 char* output,
  102. const char* extraFlags);
  103. std::vector<std::string> m_CreatedProjectNames;
  104. std::string m_LibraryOutputPath;
  105. std::string m_ExecutableOutputPath;
  106. std::string m_ModuleDefinitionFile;
  107. bool m_Version71;
  108. };
  109. #endif