cmLocalVisualStudio7Generator.h 5.0 KB

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