cmLocalVisualStudio7Generator.h 5.3 KB

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