cmGlobalVisualStudio10Generator.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. bool IsCudaEnabled() const { return this->CudaEnabled; }
  38. /** Generating for Nsight Tegra VS plugin? */
  39. bool IsNsightTegra() const;
  40. std::string GetNsightTegraVersion() const;
  41. /** The toolset name for the target platform. */
  42. const char* GetPlatformToolset() const;
  43. std::string const& GetPlatformToolsetString() const;
  44. /** The toolset host architecture name (e.g. x64 for 64-bit host tools). */
  45. const char* GetPlatformToolsetHostArchitecture() const;
  46. /** The cuda toolset version. */
  47. const char* GetPlatformToolsetCuda() const;
  48. std::string const& GetPlatformToolsetCudaString() const;
  49. /** Return the CMAKE_SYSTEM_NAME. */
  50. std::string const& GetSystemName() const { return this->SystemName; }
  51. /** Return the CMAKE_SYSTEM_VERSION. */
  52. std::string const& GetSystemVersion() const { return this->SystemVersion; }
  53. /** Return the Windows version targeted on VS 2015 and above. */
  54. std::string const& GetWindowsTargetPlatformVersion() const
  55. {
  56. return this->WindowsTargetPlatformVersion;
  57. }
  58. /** Return true if building for WindowsCE */
  59. bool TargetsWindowsCE() const { return this->SystemIsWindowsCE; }
  60. /** Return true if building for WindowsPhone */
  61. bool TargetsWindowsPhone() const { return this->SystemIsWindowsPhone; }
  62. /** Return true if building for WindowsStore */
  63. bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; }
  64. virtual const char* GetCMakeCFGIntDir() const { return "$(Configuration)"; }
  65. bool Find64BitTools(cmMakefile* mf);
  66. /** Generate an <output>.rule file path for a given command output. */
  67. virtual std::string GenerateRuleFile(std::string const& output) const;
  68. void PathTooLong(cmGeneratorTarget* target, cmSourceFile const* sf,
  69. std::string const& sfRel);
  70. virtual const char* GetToolsVersion() { return "4.0"; }
  71. bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
  72. static std::string GetInstalledNsightTegraVersion();
  73. cmIDEFlagTable const* GetClFlagTable() const;
  74. cmIDEFlagTable const* GetCSharpFlagTable() const;
  75. cmIDEFlagTable const* GetRcFlagTable() const;
  76. cmIDEFlagTable const* GetLibFlagTable() const;
  77. cmIDEFlagTable const* GetLinkFlagTable() const;
  78. cmIDEFlagTable const* GetMasmFlagTable() const;
  79. cmIDEFlagTable const* GetNasmFlagTable() const;
  80. protected:
  81. virtual void Generate();
  82. virtual bool InitializeSystem(cmMakefile* mf);
  83. virtual bool InitializeWindows(cmMakefile* mf);
  84. virtual bool InitializeWindowsCE(cmMakefile* mf);
  85. virtual bool InitializeWindowsPhone(cmMakefile* mf);
  86. virtual bool InitializeWindowsStore(cmMakefile* mf);
  87. virtual bool ProcessGeneratorToolsetField(std::string const& key,
  88. std::string const& value);
  89. virtual std::string SelectWindowsCEToolset() const;
  90. virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
  91. virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
  92. virtual const char* GetIDEVersion() { return "10.0"; }
  93. std::string const& GetMSBuildCommand();
  94. std::string GeneratorToolset;
  95. std::string GeneratorToolsetHostArchitecture;
  96. std::string GeneratorToolsetCuda;
  97. std::string DefaultPlatformToolset;
  98. std::string WindowsTargetPlatformVersion;
  99. std::string SystemName;
  100. std::string SystemVersion;
  101. std::string NsightTegraVersion;
  102. cmIDEFlagTable const* DefaultClFlagTable;
  103. cmIDEFlagTable const* DefaultCSharpFlagTable;
  104. cmIDEFlagTable const* DefaultLibFlagTable;
  105. cmIDEFlagTable const* DefaultLinkFlagTable;
  106. cmIDEFlagTable const* DefaultMasmFlagTable;
  107. cmIDEFlagTable const* DefaultNasmFlagTable;
  108. cmIDEFlagTable const* DefaultRcFlagTable;
  109. bool SystemIsWindowsCE;
  110. bool SystemIsWindowsPhone;
  111. bool SystemIsWindowsStore;
  112. private:
  113. class Factory;
  114. struct LongestSourcePath
  115. {
  116. LongestSourcePath()
  117. : Length(0)
  118. , Target(0)
  119. , SourceFile(0)
  120. {
  121. }
  122. size_t Length;
  123. cmGeneratorTarget* Target;
  124. cmSourceFile const* SourceFile;
  125. std::string SourceRel;
  126. };
  127. LongestSourcePath LongestSource;
  128. std::string MSBuildCommand;
  129. bool MSBuildCommandInitialized;
  130. cmVisualStudio10ToolsetOptions ToolsetOptions;
  131. virtual std::string FindMSBuildCommand();
  132. virtual std::string FindDevEnvCommand();
  133. virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
  134. bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
  135. std::string VCTargetsPath;
  136. bool FindVCTargetsPath(cmMakefile* mf);
  137. bool CudaEnabled;
  138. // We do not use the reload macros for VS >= 10.
  139. virtual std::string GetUserMacrosDirectory() { return ""; }
  140. };
  141. #endif