cmLocalVisualStudio7Generator.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmLocalVisualStudio7Generator_h
  11. #define cmLocalVisualStudio7Generator_h
  12. #include "cmLocalVisualStudioGenerator.h"
  13. #include "cmVisualStudioGeneratorOptions.h"
  14. class cmTarget;
  15. class cmSourceFile;
  16. class cmCustomCommand;
  17. class cmSourceGroup;
  18. class cmLocalVisualStudio7GeneratorOptions;
  19. class cmLocalVisualStudio7GeneratorFCInfo;
  20. class cmLocalVisualStudio7GeneratorInternals;
  21. /** \class cmLocalVisualStudio7Generator
  22. * \brief Write Visual Studio .NET project files.
  23. *
  24. * cmLocalVisualStudio7Generator produces a Visual Studio .NET project
  25. * file for each target in its directory.
  26. */
  27. class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
  28. {
  29. public:
  30. ///! Set cache only and recurse to false by default.
  31. cmLocalVisualStudio7Generator(VSVersion v);
  32. virtual ~cmLocalVisualStudio7Generator();
  33. virtual void AddHelperCommands();
  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. void SetPlatformName(const char* n) { this->PlatformName = n;}
  44. void SetExtraFlagTable(cmVS7FlagTable const* table)
  45. { this->ExtraFlagTable = table; }
  46. virtual std::string GetTargetDirectory(cmTarget const&) const;
  47. cmSourceFile* CreateVCProjBuildRule();
  48. void WriteStampFiles();
  49. virtual std::string ComputeLongestObjectDirectory(cmTarget&) const;
  50. virtual void ReadAndStoreExternalGUID(const char* name,
  51. const char* path);
  52. protected:
  53. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  54. private:
  55. typedef cmVisualStudioGeneratorOptions Options;
  56. typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
  57. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  58. const char* configName);
  59. void FixGlobalTargets();
  60. void WriteProjectFiles();
  61. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  62. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  63. void WriteVCProjFooter(std::ostream& fout, cmTarget &target);
  64. void WriteVCProjFile(std::ostream& fout, const char *libName,
  65. cmTarget &tgt);
  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 OutputTargetRules(std::ostream& fout, const char* configName,
  75. cmTarget &target, const char *libName);
  76. void OutputBuildTool(std::ostream& fout, const char* configName,
  77. cmTarget& t, bool debug);
  78. void OutputLibraryDirectories(std::ostream& fout,
  79. std::vector<std::string> const& dirs);
  80. void WriteProjectSCC(std::ostream& fout, cmTarget& target);
  81. void WriteProjectStart(std::ostream& fout, const char *libName,
  82. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  83. void WriteProjectStartFortran(std::ostream& fout, const char *libName,
  84. cmTarget &tgt);
  85. void WriteVCProjBeginGroup(std::ostream& fout,
  86. const char* group,
  87. const char* filter);
  88. void WriteVCProjEndGroup(std::ostream& fout);
  89. void WriteCustomRule(std::ostream& fout,
  90. const char* source,
  91. const cmCustomCommand& command,
  92. FCInfo& fcinfo);
  93. void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
  94. void WriteGroup(const cmSourceGroup *sg,
  95. cmTarget& target, std::ostream &fout,
  96. const char *libName, std::vector<std::string> *configs);
  97. friend class cmLocalVisualStudio7GeneratorFCInfo;
  98. friend class cmLocalVisualStudio7GeneratorInternals;
  99. class EventWriter;
  100. friend class EventWriter;
  101. cmVS7FlagTable const* ExtraFlagTable;
  102. std::string ModuleDefinitionFile;
  103. bool FortranProject;
  104. std::string PlatformName; // Win32 or x64
  105. cmLocalVisualStudio7GeneratorInternals* Internal;
  106. };
  107. #endif