cmVisualStudio10TargetGenerator.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 cmVisualStudioTargetGenerator_h
  11. #define cmVisualStudioTargetGenerator_h
  12. #include "cmStandardIncludes.h"
  13. class cmTarget;
  14. class cmMakefile;
  15. class cmGeneratorTarget;
  16. class cmGeneratedFileStream;
  17. class cmGlobalVisualStudio10Generator;
  18. class cmSourceFile;
  19. class cmCustomCommand;
  20. class cmLocalVisualStudio7Generator;
  21. class cmComputeLinkInformation;
  22. class cmVisualStudioGeneratorOptions;
  23. #include "cmSourceGroup.h"
  24. class cmVisualStudio10TargetGenerator
  25. {
  26. public:
  27. cmVisualStudio10TargetGenerator(cmTarget* target,
  28. cmGlobalVisualStudio10Generator* gg);
  29. ~cmVisualStudio10TargetGenerator();
  30. void Generate();
  31. // used by cmVisualStudioGeneratorOptions
  32. void WritePlatformConfigTag(
  33. const char* tag,
  34. const char* config,
  35. int indentLevel,
  36. const char* attribute = 0,
  37. const char* end = 0,
  38. std::ostream* strm = 0
  39. );
  40. private:
  41. struct ToolSource
  42. {
  43. cmSourceFile* SourceFile;
  44. bool RelativePath;
  45. };
  46. struct ToolSources: public std::vector<ToolSource> {};
  47. std::string ConvertPath(std::string const& path, bool forceRelative);
  48. void ConvertToWindowsSlash(std::string& s);
  49. void WriteString(const char* line, int indentLevel);
  50. void WriteProjectConfigurations();
  51. void WriteProjectConfigurationValues();
  52. void WriteSource(const char* tool, cmSourceFile* sf, const char* end = 0);
  53. void WriteSources(const char* tool, std::vector<cmSourceFile*> const&);
  54. void WriteAllSources();
  55. void WriteDotNetReferences();
  56. void WriteEmbeddedResourceGroup();
  57. void WriteWinRTReferences();
  58. void WritePathAndIncrementalLinkOptions();
  59. void WriteItemDefinitionGroups();
  60. bool ComputeClOptions();
  61. bool ComputeClOptions(std::string const& configName);
  62. void WriteClOptions(std::string const& config,
  63. std::vector<std::string> const & includes);
  64. void WriteRCOptions(std::string const& config,
  65. std::vector<std::string> const & includes);
  66. bool ComputeLinkOptions();
  67. bool ComputeLinkOptions(std::string const& config);
  68. void WriteLinkOptions(std::string const& config);
  69. void WriteMidlOptions(std::string const& config,
  70. std::vector<std::string> const & includes);
  71. void OutputIncludes(std::vector<std::string> const & includes);
  72. void OutputLinkIncremental(std::string const& configName);
  73. void WriteCustomRule(cmSourceFile* source,
  74. cmCustomCommand const & command);
  75. void WriteCustomCommands();
  76. void WriteCustomCommand(cmSourceFile* sf);
  77. void WriteGroups();
  78. void WriteProjectReferences();
  79. bool OutputSourceSpecificFlags(cmSourceFile* source);
  80. void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
  81. void WriteLibOptions(std::string const& config);
  82. void WriteEvents(std::string const& configName);
  83. void WriteEvent(const char* name,
  84. std::vector<cmCustomCommand> const& commands,
  85. std::string const& configName);
  86. void WriteGroupSources(const char* name, ToolSources const& sources,
  87. std::vector<cmSourceGroup>& );
  88. void AddMissingSourceGroups(std::set<cmSourceGroup*>& groupsUsed,
  89. const std::vector<cmSourceGroup>& allGroups);
  90. bool IsResxHeader(const std::string& headerFile);
  91. private:
  92. typedef cmVisualStudioGeneratorOptions Options;
  93. typedef std::map<cmStdString, Options*> OptionsMap;
  94. OptionsMap ClOptions;
  95. OptionsMap LinkOptions;
  96. std::string PathToVcxproj;
  97. cmTarget* Target;
  98. cmGeneratorTarget* GeneratorTarget;
  99. cmMakefile* Makefile;
  100. std::string Platform;
  101. std::string GUID;
  102. std::string Name;
  103. cmGlobalVisualStudio10Generator* GlobalGenerator;
  104. cmGeneratedFileStream* BuildFileStream;
  105. cmLocalVisualStudio7Generator* LocalGenerator;
  106. std::set<cmSourceFile*> SourcesVisited;
  107. typedef std::map<cmStdString, ToolSources> ToolSourceMap;
  108. ToolSourceMap Tools;
  109. };
  110. #endif