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. static cmGlobalGeneratorFactory* NewFactory();
  25. virtual bool MatchesGeneratorName(const std::string& name) const;
  26. virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
  27. virtual bool SetSystemName(std::string const& s, 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. ///! create the correct local generator
  39. virtual cmLocalGenerator *CreateLocalGenerator();
  40. /**
  41. * Try to determine system infomation such as shared library
  42. * extension, pthreads, byte order etc.
  43. */
  44. virtual void EnableLanguage(std::vector<std::string>const& languages,
  45. cmMakefile *, bool optional);
  46. virtual void WriteSLNHeader(std::ostream& fout);
  47. /** Is the installed VS an Express edition? */
  48. bool IsExpressEdition() const { return this->ExpressEdition; }
  49. /** Is the Microsoft Assembler enabled? */
  50. bool IsMasmEnabled() const { return this->MasmEnabled; }
  51. /** The toolset name for the target platform. */
  52. const char* GetPlatformToolset() const;
  53. /**
  54. * Where does this version of Visual Studio look for macros for the
  55. * current user? Returns the empty string if this version of Visual
  56. * Studio does not implement support for VB macros.
  57. */
  58. virtual std::string GetUserMacrosDirectory();
  59. /**
  60. * What is the reg key path to "vsmacros" for this version of Visual
  61. * Studio?
  62. */
  63. virtual std::string GetUserMacrosRegKeyBase();
  64. virtual const char* GetCMakeCFGIntDir() const
  65. { return "$(Configuration)";}
  66. bool Find64BitTools(cmMakefile* mf);
  67. /** Generate an <output>.rule file path for a given command output. */
  68. virtual std::string GenerateRuleFile(std::string const& output) const;
  69. void PathTooLong(cmTarget* target, cmSourceFile const* sf,
  70. std::string const& sfRel);
  71. virtual const char* GetToolsVersion() { return "4.0"; }
  72. virtual void FindMakeProgram(cmMakefile*);
  73. protected:
  74. virtual void Generate();
  75. virtual const char* GetIDEVersion() { return "10.0"; }
  76. std::string const& GetMSBuildCommand();
  77. std::string GeneratorToolset;
  78. std::string DefaultPlatformToolset;
  79. std::string SystemName;
  80. std::string SystemVersion;
  81. bool ExpressEdition;
  82. bool MasmEnabled;
  83. bool UseFolderProperty();
  84. private:
  85. class Factory;
  86. struct LongestSourcePath
  87. {
  88. LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
  89. size_t Length;
  90. cmTarget* Target;
  91. cmSourceFile const* SourceFile;
  92. std::string SourceRel;
  93. };
  94. LongestSourcePath LongestSource;
  95. std::string MSBuildCommand;
  96. bool MSBuildCommandInitialized;
  97. virtual std::string FindMSBuildCommand();
  98. virtual std::string FindDevEnvCommand();
  99. virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
  100. void AddVSPlatformToolsetDefinition(cmMakefile* mf) const;
  101. };
  102. #endif