cmLocalVisualStudio7Generator.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. // Compute the maximum length full path to the intermediate
  50. // files directory for any configuration. This is used to construct
  51. // object file names that do not produce paths that are too long.
  52. void ComputeMaxDirectoryLength(std::string& maxdir,
  53. cmTarget& target);
  54. virtual void ReadAndStoreExternalGUID(const char* name,
  55. const char* path);
  56. protected:
  57. void CreateSingleVCProj(const char *lname, cmTarget &tgt);
  58. private:
  59. typedef cmVisualStudioGeneratorOptions Options;
  60. typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
  61. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  62. const char* configName);
  63. void FixGlobalTargets();
  64. void WriteProjectFiles();
  65. void WriteVCProjHeader(std::ostream& fout, const char *libName,
  66. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  67. void WriteVCProjFooter(std::ostream& fout, cmTarget &target);
  68. void WriteVCProjFile(std::ostream& fout, const char *libName,
  69. cmTarget &tgt);
  70. void WriteConfigurations(std::ostream& fout,
  71. const char *libName, cmTarget &tgt);
  72. void WriteConfiguration(std::ostream& fout,
  73. const char* configName,
  74. const char* libName, cmTarget &tgt);
  75. std::string EscapeForXML(const char* s);
  76. std::string ConvertToXMLOutputPath(const char* path);
  77. std::string ConvertToXMLOutputPathSingle(const char* path);
  78. void OutputTargetRules(std::ostream& fout, const char* configName,
  79. cmTarget &target, const char *libName);
  80. void OutputBuildTool(std::ostream& fout, const char* configName,
  81. cmTarget& t, bool debug);
  82. void OutputLibraryDirectories(std::ostream& fout,
  83. std::vector<std::string> const& dirs);
  84. void WriteProjectSCC(std::ostream& fout, cmTarget& target);
  85. void WriteProjectStart(std::ostream& fout, const char *libName,
  86. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  87. void WriteProjectStartFortran(std::ostream& fout, const char *libName,
  88. cmTarget &tgt);
  89. void WriteVCProjBeginGroup(std::ostream& fout,
  90. const char* group,
  91. const char* filter);
  92. void WriteVCProjEndGroup(std::ostream& fout);
  93. void WriteCustomRule(std::ostream& fout,
  94. const char* source,
  95. const cmCustomCommand& command,
  96. FCInfo& fcinfo);
  97. void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
  98. void WriteGroup(const cmSourceGroup *sg,
  99. cmTarget& target, std::ostream &fout,
  100. const char *libName, std::vector<std::string> *configs);
  101. friend class cmLocalVisualStudio7GeneratorFCInfo;
  102. friend class cmLocalVisualStudio7GeneratorInternals;
  103. class EventWriter;
  104. friend class EventWriter;
  105. cmVS7FlagTable const* ExtraFlagTable;
  106. std::string ModuleDefinitionFile;
  107. bool FortranProject;
  108. std::string PlatformName; // Win32 or x64
  109. cmLocalVisualStudio7GeneratorInternals* Internal;
  110. };
  111. #endif