cmLocalVisualStudio7Generator.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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>
  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. virtual void AddHelperCommands();
  32. /**
  33. * Generate the makefile for this directory.
  34. */
  35. virtual void Generate();
  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. virtual std::string GetTargetDirectory(
  49. cmGeneratorTarget const* target) const;
  50. cmSourceFile* CreateVCProjBuildRule();
  51. void WriteStampFiles();
  52. virtual std::string ComputeLongestObjectDirectory(
  53. cmGeneratorTarget const*) const;
  54. virtual void ReadAndStoreExternalGUID(const std::string& name,
  55. const char* path);
  56. virtual void AddCMakeListsRules();
  57. protected:
  58. void CreateSingleVCProj(const std::string& lname, cmGeneratorTarget* tgt);
  59. private:
  60. typedef cmVisualStudioGeneratorOptions Options;
  61. typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
  62. std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
  63. const std::string& configName);
  64. void FixGlobalTargets();
  65. void WriteProjectFiles();
  66. void WriteVCProjHeader(std::ostream& fout, const std::string& libName,
  67. cmGeneratorTarget* tgt,
  68. std::vector<cmSourceGroup>& sgs);
  69. void WriteVCProjFooter(std::ostream& fout, cmGeneratorTarget* target);
  70. void WriteVCProjFile(std::ostream& fout, const std::string& libName,
  71. cmGeneratorTarget* tgt);
  72. void WriteConfigurations(std::ostream& fout,
  73. std::vector<std::string> const& configs,
  74. const std::string& libName, cmGeneratorTarget* tgt);
  75. void WriteConfiguration(std::ostream& fout, const std::string& configName,
  76. const std::string& libName, cmGeneratorTarget* tgt);
  77. std::string EscapeForXML(const std::string& s);
  78. std::string ConvertToXMLOutputPath(const char* path);
  79. std::string ConvertToXMLOutputPathSingle(const char* path);
  80. void OutputTargetRules(std::ostream& fout, const std::string& configName,
  81. cmGeneratorTarget* target,
  82. const std::string& libName);
  83. void OutputBuildTool(std::ostream& fout, const std::string& configName,
  84. cmGeneratorTarget* t, const Options& targetOptions);
  85. void OutputDeploymentDebuggerTool(std::ostream& fout,
  86. std::string const& config,
  87. cmGeneratorTarget* target);
  88. void OutputLibraryDirectories(std::ostream& fout,
  89. std::vector<std::string> const& dirs);
  90. void WriteProjectSCC(std::ostream& fout, cmGeneratorTarget* target);
  91. void WriteProjectStart(std::ostream& fout, const std::string& libName,
  92. cmGeneratorTarget* tgt,
  93. std::vector<cmSourceGroup>& sgs);
  94. void WriteProjectStartFortran(std::ostream& fout, const std::string& libName,
  95. cmGeneratorTarget* tgt);
  96. void WriteVCProjBeginGroup(std::ostream& fout, const char* group,
  97. const char* filter);
  98. void WriteVCProjEndGroup(std::ostream& fout);
  99. void WriteCustomRule(std::ostream& fout,
  100. std::vector<std::string> const& configs,
  101. const char* source, const cmCustomCommand& command,
  102. FCInfo& fcinfo);
  103. void WriteTargetVersionAttribute(std::ostream& fout, cmGeneratorTarget* gt);
  104. bool WriteGroup(const cmSourceGroup* sg, cmGeneratorTarget* target,
  105. std::ostream& fout, const std::string& libName,
  106. std::vector<std::string> const& configs);
  107. friend class cmLocalVisualStudio7GeneratorFCInfo;
  108. friend class cmLocalVisualStudio7GeneratorInternals;
  109. class EventWriter;
  110. friend class EventWriter;
  111. bool FortranProject;
  112. bool WindowsCEProject;
  113. cmLocalVisualStudio7GeneratorInternals* Internal;
  114. };
  115. #endif