cmLocalVisualStudio7Generator.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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(cmGlobalGenerator* gg,
  32. cmState::Snapshot snapshot);
  33. virtual ~cmLocalVisualStudio7Generator();
  34. virtual void AddHelperCommands();
  35. /**
  36. * Generate the makefile for this directory.
  37. */
  38. virtual void Generate();
  39. enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY};
  40. /**
  41. * Specify the type of the build: static, dll, or executable.
  42. */
  43. void SetBuildType(BuildType,const std::string& name);
  44. virtual std::string GetTargetDirectory(cmTarget const&) const;
  45. cmSourceFile* CreateVCProjBuildRule();
  46. void WriteStampFiles();
  47. virtual std::string ComputeLongestObjectDirectory(cmTarget&) 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, cmTarget &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. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  62. void WriteVCProjFooter(std::ostream& fout, cmTarget &target);
  63. void WriteVCProjFile(std::ostream& fout, const std::string& libName,
  64. cmTarget &tgt);
  65. void WriteConfigurations(std::ostream& fout,
  66. std::vector<std::string> const& configs,
  67. const std::string& libName, cmTarget &tgt);
  68. void WriteConfiguration(std::ostream& fout,
  69. const std::string& configName,
  70. const std::string& libName, cmTarget &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. cmTarget &target, const std::string& libName);
  76. void OutputBuildTool(std::ostream& fout, const std::string& configName,
  77. cmTarget& t, const Options& targetOptions);
  78. void OutputLibraryDirectories(std::ostream& fout,
  79. std::vector<std::string> const& dirs);
  80. void WriteProjectSCC(std::ostream& fout, cmTarget& target);
  81. void WriteProjectStart(std::ostream& fout, const std::string& libName,
  82. cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
  83. void WriteProjectStartFortran(std::ostream& fout, const std::string& libName,
  84. cmTarget &tgt);
  85. void WriteVCProjBeginGroup(std::ostream& fout,
  86. const char* group,
  87. const char* filter);
  88. void WriteVCProjEndGroup(std::ostream& fout);
  89. void WriteCustomRule(std::ostream& fout,
  90. std::vector<std::string> const& configs,
  91. const char* source,
  92. const cmCustomCommand& command,
  93. FCInfo& fcinfo);
  94. void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
  95. bool WriteGroup(const cmSourceGroup *sg,
  96. cmTarget& target, std::ostream &fout,
  97. const std::string& libName,
  98. std::vector<std::string> const& configs);
  99. friend class cmLocalVisualStudio7GeneratorFCInfo;
  100. friend class cmLocalVisualStudio7GeneratorInternals;
  101. class EventWriter;
  102. friend class EventWriter;
  103. std::string ModuleDefinitionFile;
  104. bool FortranProject;
  105. bool WindowsCEProject;
  106. cmLocalVisualStudio7GeneratorInternals* Internal;
  107. };
  108. #endif