cmGlobalVisualStudio10Generator.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. #include "cmVisualStudio10ToolsetOptions.h"
  7. /** \class cmGlobalVisualStudio10Generator
  8. * \brief Write a Unix makefiles.
  9. *
  10. * cmGlobalVisualStudio10Generator manages UNIX build process for a tree
  11. */
  12. class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator
  13. {
  14. public:
  15. cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
  16. const std::string& platformName);
  17. static cmGlobalGeneratorFactory* NewFactory();
  18. virtual bool MatchesGeneratorName(const std::string& name) const;
  19. virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
  20. virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
  21. virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
  22. virtual void GenerateBuildCommand(
  23. std::vector<std::string>& makeCommand, const std::string& makeProgram,
  24. const std::string& projectName, const std::string& projectDir,
  25. const std::string& targetName, const std::string& config, bool fast,
  26. bool verbose,
  27. std::vector<std::string> const& makeOptions = std::vector<std::string>());
  28. ///! create the correct local generator
  29. virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
  30. /**
  31. * Try to determine system information such as shared library
  32. * extension, pthreads, byte order etc.
  33. */
  34. virtual void EnableLanguage(std::vector<std::string> const& languages,
  35. cmMakefile*, bool optional);
  36. virtual void WriteSLNHeader(std::ostream& fout);
  37. /** Generating for Nsight Tegra VS plugin? */
  38. bool IsNsightTegra() const;
  39. std::string GetNsightTegraVersion() const;
  40. /** The toolset name for the target platform. */
  41. const char* GetPlatformToolset() const;
  42. std::string const& GetPlatformToolsetString() const;
  43. /** The toolset host architecture name (e.g. x64 for 64-bit host tools). */
  44. const char* GetPlatformToolsetHostArchitecture() const;
  45. /** Return the CMAKE_SYSTEM_NAME. */
  46. std::string const& GetSystemName() const { return this->SystemName; }
  47. /** Return the CMAKE_SYSTEM_VERSION. */
  48. std::string const& GetSystemVersion() const { return this->SystemVersion; }
  49. /** Return the Windows version targeted on VS 2015 and above. */
  50. std::string const& GetWindowsTargetPlatformVersion() const
  51. {
  52. return this->WindowsTargetPlatformVersion;
  53. }
  54. /** Return true if building for WindowsCE */
  55. bool TargetsWindowsCE() const { return this->SystemIsWindowsCE; }
  56. /** Return true if building for WindowsPhone */
  57. bool TargetsWindowsPhone() const { return this->SystemIsWindowsPhone; }
  58. /** Return true if building for WindowsStore */
  59. bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; }
  60. virtual const char* GetCMakeCFGIntDir() const { return "$(Configuration)"; }
  61. bool Find64BitTools(cmMakefile* mf);
  62. /** Generate an <output>.rule file path for a given command output. */
  63. virtual std::string GenerateRuleFile(std::string const& output) const;
  64. void PathTooLong(cmGeneratorTarget* target, cmSourceFile const* sf,
  65. std::string const& sfRel);
  66. virtual const char* GetToolsVersion() { return "4.0"; }
  67. bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
  68. static std::string GetInstalledNsightTegraVersion();
  69. cmIDEFlagTable const* GetClFlagTable() const;
  70. cmIDEFlagTable const* GetCSharpFlagTable() const;
  71. cmIDEFlagTable const* GetRcFlagTable() const;
  72. cmIDEFlagTable const* GetLibFlagTable() const;
  73. cmIDEFlagTable const* GetLinkFlagTable() const;
  74. cmIDEFlagTable const* GetMasmFlagTable() const;
  75. cmIDEFlagTable const* GetNasmFlagTable() const;
  76. protected:
  77. virtual void Generate();
  78. virtual bool InitializeSystem(cmMakefile* mf);
  79. virtual bool InitializeWindows(cmMakefile* mf);
  80. virtual bool InitializeWindowsCE(cmMakefile* mf);
  81. virtual bool InitializeWindowsPhone(cmMakefile* mf);
  82. virtual bool InitializeWindowsStore(cmMakefile* mf);
  83. virtual bool ProcessGeneratorToolsetField(std::string const& key,
  84. std::string const& value);
  85. virtual std::string SelectWindowsCEToolset() const;
  86. virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
  87. virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
  88. virtual const char* GetIDEVersion() { return "10.0"; }
  89. std::string const& GetMSBuildCommand();
  90. std::string GeneratorToolset;
  91. std::string GeneratorToolsetHostArchitecture;
  92. std::string DefaultPlatformToolset;
  93. std::string WindowsTargetPlatformVersion;
  94. std::string SystemName;
  95. std::string SystemVersion;
  96. std::string NsightTegraVersion;
  97. cmIDEFlagTable const* DefaultClFlagTable;
  98. cmIDEFlagTable const* DefaultCSharpFlagTable;
  99. cmIDEFlagTable const* DefaultLibFlagTable;
  100. cmIDEFlagTable const* DefaultLinkFlagTable;
  101. cmIDEFlagTable const* DefaultMasmFlagTable;
  102. cmIDEFlagTable const* DefaultNasmFlagTable;
  103. cmIDEFlagTable const* DefaultRcFlagTable;
  104. bool SystemIsWindowsCE;
  105. bool SystemIsWindowsPhone;
  106. bool SystemIsWindowsStore;
  107. private:
  108. class Factory;
  109. struct LongestSourcePath
  110. {
  111. LongestSourcePath()
  112. : Length(0)
  113. , Target(0)
  114. , SourceFile(0)
  115. {
  116. }
  117. size_t Length;
  118. cmGeneratorTarget* Target;
  119. cmSourceFile const* SourceFile;
  120. std::string SourceRel;
  121. };
  122. LongestSourcePath LongestSource;
  123. std::string MSBuildCommand;
  124. bool MSBuildCommandInitialized;
  125. cmVisualStudio10ToolsetOptions ToolsetOptions;
  126. virtual std::string FindMSBuildCommand();
  127. virtual std::string FindDevEnvCommand();
  128. virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
  129. bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
  130. // We do not use the reload macros for VS >= 10.
  131. virtual std::string GetUserMacrosDirectory() { return ""; }
  132. };
  133. #endif