cmGlobalVisualStudio10Generator.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmGlobalVisualStudio10Generator_h
  4. #define cmGlobalVisualStudio10Generator_h
  5. #include "cmGlobalVisualStudio8Generator.h"
  6. /** \class cmGlobalVisualStudio10Generator
  7. * \brief Write a Unix makefiles.
  8. *
  9. * cmGlobalVisualStudio10Generator manages UNIX build process for a tree
  10. */
  11. class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator
  12. {
  13. public:
  14. cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
  15. const std::string& platformName);
  16. static cmGlobalGeneratorFactory* NewFactory();
  17. virtual bool MatchesGeneratorName(const std::string& name) const;
  18. virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
  19. virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
  20. virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
  21. virtual void GenerateBuildCommand(
  22. std::vector<std::string>& makeCommand, const std::string& makeProgram,
  23. const std::string& projectName, const std::string& projectDir,
  24. const std::string& targetName, const std::string& config, bool fast,
  25. bool verbose,
  26. std::vector<std::string> const& makeOptions = std::vector<std::string>());
  27. ///! create the correct local generator
  28. virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
  29. /**
  30. * Try to determine system information such as shared library
  31. * extension, pthreads, byte order etc.
  32. */
  33. virtual void EnableLanguage(std::vector<std::string> const& languages,
  34. cmMakefile*, bool optional);
  35. virtual void WriteSLNHeader(std::ostream& fout);
  36. /** Generating for Nsight Tegra VS plugin? */
  37. bool IsNsightTegra() const;
  38. std::string GetNsightTegraVersion() const;
  39. /** The toolset name for the target platform. */
  40. const char* GetPlatformToolset() const;
  41. /** Return the CMAKE_SYSTEM_NAME. */
  42. std::string const& GetSystemName() const { return this->SystemName; }
  43. /** Return the CMAKE_SYSTEM_VERSION. */
  44. std::string const& GetSystemVersion() const { return this->SystemVersion; }
  45. /** Return the Windows version targeted on VS 2015 and above. */
  46. std::string const& GetWindowsTargetPlatformVersion() const
  47. {
  48. return this->WindowsTargetPlatformVersion;
  49. }
  50. /** Return true if building for WindowsCE */
  51. bool TargetsWindowsCE() const { return this->SystemIsWindowsCE; }
  52. /** Return true if building for WindowsPhone */
  53. bool TargetsWindowsPhone() const { return this->SystemIsWindowsPhone; }
  54. /** Return true if building for WindowsStore */
  55. bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; }
  56. virtual const char* GetCMakeCFGIntDir() const { return "$(Configuration)"; }
  57. bool Find64BitTools(cmMakefile* mf);
  58. /** Generate an <output>.rule file path for a given command output. */
  59. virtual std::string GenerateRuleFile(std::string const& output) const;
  60. void PathTooLong(cmGeneratorTarget* target, cmSourceFile const* sf,
  61. std::string const& sfRel);
  62. virtual const char* GetToolsVersion() { return "4.0"; }
  63. virtual void FindMakeProgram(cmMakefile*);
  64. static std::string GetInstalledNsightTegraVersion();
  65. protected:
  66. virtual void Generate();
  67. virtual bool InitializeSystem(cmMakefile* mf);
  68. virtual bool InitializeWindows(cmMakefile* mf);
  69. virtual bool InitializeWindowsCE(cmMakefile* mf);
  70. virtual bool InitializeWindowsPhone(cmMakefile* mf);
  71. virtual bool InitializeWindowsStore(cmMakefile* mf);
  72. virtual std::string SelectWindowsCEToolset() const;
  73. virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
  74. virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
  75. virtual const char* GetIDEVersion() { return "10.0"; }
  76. std::string const& GetMSBuildCommand();
  77. std::string GeneratorToolset;
  78. std::string DefaultPlatformToolset;
  79. std::string WindowsTargetPlatformVersion;
  80. std::string SystemName;
  81. std::string SystemVersion;
  82. std::string NsightTegraVersion;
  83. bool SystemIsWindowsCE;
  84. bool SystemIsWindowsPhone;
  85. bool SystemIsWindowsStore;
  86. private:
  87. class Factory;
  88. struct LongestSourcePath
  89. {
  90. LongestSourcePath()
  91. : Length(0)
  92. , Target(0)
  93. , SourceFile(0)
  94. {
  95. }
  96. size_t Length;
  97. cmGeneratorTarget* Target;
  98. cmSourceFile const* SourceFile;
  99. std::string SourceRel;
  100. };
  101. LongestSourcePath LongestSource;
  102. std::string MSBuildCommand;
  103. bool MSBuildCommandInitialized;
  104. virtual std::string FindMSBuildCommand();
  105. virtual std::string FindDevEnvCommand();
  106. virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
  107. // We do not use the reload macros for VS >= 10.
  108. virtual std::string GetUserMacrosDirectory() { return ""; }
  109. };
  110. #endif