cmLocalVisualStudio7Generator.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmLocalVisualStudio7Generator_h
  4. #define cmLocalVisualStudio7Generator_h
  5. #include "cmLocalVisualStudioGenerator.h"
  6. #include "cmVisualStudioGeneratorOptions.h"
  7. class cmSourceFile;
  8. class cmCustomCommand;
  9. class cmSourceGroup;
  10. class cmLocalVisualStudio7GeneratorOptions;
  11. class cmLocalVisualStudio7GeneratorFCInfo;
  12. class cmLocalVisualStudio7GeneratorInternals;
  13. /** \class cmLocalVisualStudio7Generator
  14. * \brief Write Visual Studio .NET project files.
  15. *
  16. * cmLocalVisualStudio7Generator produces a Visual Studio .NET project
  17. * file for each target in its directory.
  18. */
  19. class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
  20. {
  21. public:
  22. ///! Set cache only and recurse to false by default.
  23. cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf);
  24. virtual ~cmLocalVisualStudio7Generator();
  25. virtual void AddHelperCommands();
  26. /**
  27. * Generate the makefile for this directory.
  28. */
  29. virtual void Generate();
  30. enum BuildType
  31. {
  32. STATIC_LIBRARY,
  33. DLL,
  34. EXECUTABLE,
  35. WIN32_EXECUTABLE,
  36. UTILITY
  37. };
  38. /**
  39. * Specify the type of the build: static, dll, or executable.
  40. */
  41. void SetBuildType(BuildType, const std::string& name);
  42. virtual std::string GetTargetDirectory(
  43. cmGeneratorTarget const* target) const;
  44. cmSourceFile* CreateVCProjBuildRule();
  45. void WriteStampFiles();
  46. virtual std::string ComputeLongestObjectDirectory(
  47. cmGeneratorTarget const*) const;
  48. virtual void ReadAndStoreExternalGUID(const std::string& name,
  49. const char* path);
  50. virtual void AddCMakeListsRules();
  51. protected:
  52. void CreateSingleVCProj(const std::string& lname, cmGeneratorTarget* tgt);
  53. private:
  54. typedef cmVisualStudioGeneratorOptions Options;
  55. typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
  56. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  57. const std::string& configName);
  58. void FixGlobalTargets();
  59. void WriteProjectFiles();
  60. void WriteVCProjHeader(std::ostream& fout, const std::string& libName,
  61. cmGeneratorTarget* tgt,
  62. std::vector<cmSourceGroup>& sgs);
  63. void WriteVCProjFooter(std::ostream& fout, cmGeneratorTarget* target);
  64. void WriteVCProjFile(std::ostream& fout, const std::string& libName,
  65. cmGeneratorTarget* tgt);
  66. void WriteConfigurations(std::ostream& fout,
  67. std::vector<std::string> const& configs,
  68. const std::string& libName, cmGeneratorTarget* tgt);
  69. void WriteConfiguration(std::ostream& fout, const std::string& configName,
  70. const std::string& libName, cmGeneratorTarget* tgt);
  71. std::string EscapeForXML(const std::string& s);
  72. std::string ConvertToXMLOutputPath(const char* path);
  73. std::string ConvertToXMLOutputPathSingle(const char* path);
  74. void OutputTargetRules(std::ostream& fout, const std::string& configName,
  75. cmGeneratorTarget* target,
  76. const std::string& libName);
  77. void OutputBuildTool(std::ostream& fout, const std::string& configName,
  78. cmGeneratorTarget* t, const Options& targetOptions);
  79. void OutputDeploymentDebuggerTool(std::ostream& fout,
  80. std::string const& config,
  81. cmGeneratorTarget* target);
  82. void OutputLibraryDirectories(std::ostream& fout,
  83. std::vector<std::string> const& dirs);
  84. void WriteProjectSCC(std::ostream& fout, cmGeneratorTarget* target);
  85. void WriteProjectStart(std::ostream& fout, const std::string& libName,
  86. cmGeneratorTarget* tgt,
  87. std::vector<cmSourceGroup>& sgs);
  88. void WriteProjectStartFortran(std::ostream& fout, const std::string& libName,
  89. cmGeneratorTarget* tgt);
  90. void WriteVCProjBeginGroup(std::ostream& fout, const char* group,
  91. const char* filter);
  92. void WriteVCProjEndGroup(std::ostream& fout);
  93. void WriteCustomRule(std::ostream& fout,
  94. std::vector<std::string> const& configs,
  95. const char* source, const cmCustomCommand& command,
  96. FCInfo& fcinfo);
  97. void WriteTargetVersionAttribute(std::ostream& fout, cmGeneratorTarget* gt);
  98. bool WriteGroup(const cmSourceGroup* sg, cmGeneratorTarget* target,
  99. std::ostream& fout, const std::string& libName,
  100. std::vector<std::string> const& configs);
  101. friend class cmLocalVisualStudio7GeneratorFCInfo;
  102. friend class cmLocalVisualStudio7GeneratorInternals;
  103. class EventWriter;
  104. friend class EventWriter;
  105. std::string ModuleDefinitionFile;
  106. bool FortranProject;
  107. bool WindowsCEProject;
  108. cmLocalVisualStudio7GeneratorInternals* Internal;
  109. };
  110. #endif