cmGlobalVisualStudio10Generator.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 cmGlobalVisualStudio10Generator_h
  11. #define cmGlobalVisualStudio10Generator_h
  12. #include "cmGlobalVisualStudio8Generator.h"
  13. /** \class cmGlobalVisualStudio10Generator
  14. * \brief Write a Unix makefiles.
  15. *
  16. * cmGlobalVisualStudio10Generator manages UNIX build process for a tree
  17. */
  18. class cmGlobalVisualStudio10Generator :
  19. public cmGlobalVisualStudio8Generator
  20. {
  21. public:
  22. cmGlobalVisualStudio10Generator(const std::string& name,
  23. const std::string& platformName,
  24. const std::string& additionalPlatformDefinition);
  25. static cmGlobalGeneratorFactory* NewFactory();
  26. virtual bool MatchesGeneratorName(const std::string& name) const;
  27. virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
  28. virtual void GenerateBuildCommand(
  29. std::vector<std::string>& makeCommand,
  30. const std::string& makeProgram,
  31. const std::string& projectName,
  32. const std::string& projectDir,
  33. const std::string& targetName,
  34. const std::string& config,
  35. bool fast,
  36. std::vector<std::string> const& makeOptions = std::vector<std::string>()
  37. );
  38. virtual void AddPlatformDefinitions(cmMakefile* mf);
  39. ///! create the correct local generator
  40. virtual cmLocalGenerator *CreateLocalGenerator();
  41. virtual void Generate();
  42. /**
  43. * Try to determine system infomation such as shared library
  44. * extension, pthreads, byte order etc.
  45. */
  46. virtual void EnableLanguage(std::vector<std::string>const& languages,
  47. cmMakefile *, bool optional);
  48. virtual void WriteSLNHeader(std::ostream& fout);
  49. /** Is the installed VS an Express edition? */
  50. bool IsExpressEdition() const { return this->ExpressEdition; }
  51. /** Is the Microsoft Assembler enabled? */
  52. bool IsMasmEnabled() const { return this->MasmEnabled; }
  53. /** The toolset name for the target platform. */
  54. const char* GetPlatformToolset() const;
  55. /**
  56. * Where does this version of Visual Studio look for macros for the
  57. * current user? Returns the empty string if this version of Visual
  58. * Studio does not implement support for VB macros.
  59. */
  60. virtual std::string GetUserMacrosDirectory();
  61. /**
  62. * What is the reg key path to "vsmacros" for this version of Visual
  63. * Studio?
  64. */
  65. virtual std::string GetUserMacrosRegKeyBase();
  66. virtual const char* GetCMakeCFGIntDir() const
  67. { return "$(Configuration)";}
  68. bool Find64BitTools(cmMakefile* mf);
  69. /** Generate an <output>.rule file path for a given command output. */
  70. virtual std::string GenerateRuleFile(std::string const& output) const;
  71. void PathTooLong(cmTarget* target, cmSourceFile const* sf,
  72. std::string const& sfRel);
  73. virtual const char* GetToolsVersion() { return "4.0"; }
  74. virtual void FindMakeProgram(cmMakefile*);
  75. protected:
  76. virtual const char* GetIDEVersion() { return "10.0"; }
  77. std::string const& GetMSBuildCommand();
  78. std::string GeneratorToolset;
  79. std::string DefaultPlatformToolset;
  80. bool ExpressEdition;
  81. bool MasmEnabled;
  82. bool UseFolderProperty();
  83. private:
  84. class Factory;
  85. struct LongestSourcePath
  86. {
  87. LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
  88. size_t Length;
  89. cmTarget* Target;
  90. cmSourceFile const* SourceFile;
  91. std::string SourceRel;
  92. };
  93. LongestSourcePath LongestSource;
  94. std::string MSBuildCommand;
  95. bool MSBuildCommandInitialized;
  96. virtual std::string FindMSBuildCommand();
  97. virtual std::string FindDevEnvCommand();
  98. virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
  99. void AddVSPlatformToolsetDefinition(cmMakefile* mf) const;
  100. };
  101. #endif