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 "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. fromTheTop indicates if this
  36. * is being invoked as part of a global Generate or specific to this
  37. * directory. The difference is that when done from the Top we might skip
  38. * some steps to save time, such as dependency generation for the
  39. * makefiles. This is done by a direct invocation from make.
  40. */
  41. virtual void Generate(bool fromTheTop);
  42. enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
  43. /**
  44. * Specify the type of the build: static, dll, or executable.
  45. */
  46. void SetBuildType(BuildType,const char *name);
  47. /**
  48. * Return array of created DSP names in a STL vector.
  49. * Each executable must have its own dsp.
  50. */
  51. std::vector<std::string> GetCreatedProjectNames()
  52. {
  53. return m_CreatedProjectNames;
  54. }
  55. void SetVersion71() {m_Version = 71;}
  56. void SetVersion8() {m_Version = 8;}
  57. virtual void ConfigureFinalPass();
  58. private:
  59. void FillFlagMapFromCommandFlags(std::map<cmStdString, cmStdString>& flagMap,
  60. cmVS7FlagTable* flagTable,
  61. std::string& flags);
  62. void OutputVCProjFile();
  63. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  64. const cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  65. void WriteVCProjFooter(std::ostream& fout);
  66. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  67. void WriteVCProjFile(std::ostream& fout, const char *libName,
  68. cmTarget &tgt);
  69. void AddVCProjBuildRule();
  70. void WriteConfigurations(std::ostream& fout,
  71. const char *libName,
  72. const cmTarget &tgt);
  73. void WriteConfiguration(std::ostream& fout,
  74. const char* configName,
  75. const char* libName,
  76. const cmTarget &tgt);
  77. std::string EscapeForXML(const char* s);
  78. std::string ConvertToXMLOutputPath(const char* path);
  79. std::string ConvertToXMLOutputPathSingle(const char* path);
  80. void OutputDefineFlags(const char* flags,
  81. std::ostream& fout);
  82. void OutputTargetRules(std::ostream& fout,
  83. const cmTarget &target,
  84. const char *libName);
  85. void OutputBuildTool(std::ostream& fout, const char* configName,
  86. const char* libname, const cmTarget& t);
  87. void OutputLibraries(std::ostream& fout,
  88. const char* configName,
  89. const char* libName,
  90. const cmTarget &target);
  91. void OutputLibraryDirectories(std::ostream& fout,
  92. const char* configName,
  93. const char* libName,
  94. const cmTarget &target);
  95. void OutputModuleDefinitionFile(std::ostream& fout,
  96. const cmTarget &target);
  97. void WriteProjectStart(std::ostream& fout, const char *libName,
  98. const cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  99. void WriteVCProjBeginGroup(std::ostream& fout,
  100. const char* group,
  101. const char* filter);
  102. void WriteVCProjEndGroup(std::ostream& fout);
  103. void WriteCustomRule(std::ostream& fout,
  104. const char* source,
  105. const char* command,
  106. const char* comment,
  107. const std::vector<std::string>& depends,
  108. const char* output,
  109. const char* extraFlags);
  110. std::vector<std::string> m_CreatedProjectNames;
  111. std::string m_LibraryOutputPath;
  112. std::string m_ExecutableOutputPath;
  113. std::string m_ModuleDefinitionFile;
  114. int m_Version;
  115. };
  116. #endif