cmGlobalVisualStudio10Generator.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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 whether we need to use No/Debug instead of false/true
  50. for GenerateDebugInformation. */
  51. bool GetPlatformToolsetNeedsDebugEnum() const
  52. {
  53. return this->PlatformToolsetNeedsDebugEnum;
  54. }
  55. /** Return the CMAKE_SYSTEM_NAME. */
  56. std::string const& GetSystemName() const { return this->SystemName; }
  57. /** Return the CMAKE_SYSTEM_VERSION. */
  58. std::string const& GetSystemVersion() const { return this->SystemVersion; }
  59. /** Return the Windows version targeted on VS 2015 and above. */
  60. std::string const& GetWindowsTargetPlatformVersion() const
  61. {
  62. return this->WindowsTargetPlatformVersion;
  63. }
  64. /** Return true if building for WindowsCE */
  65. bool TargetsWindowsCE() const { return this->SystemIsWindowsCE; }
  66. /** Return true if building for WindowsPhone */
  67. bool TargetsWindowsPhone() const { return this->SystemIsWindowsPhone; }
  68. /** Return true if building for WindowsStore */
  69. bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; }
  70. virtual const char* GetCMakeCFGIntDir() const { return "$(Configuration)"; }
  71. bool Find64BitTools(cmMakefile* mf);
  72. /** Generate an <output>.rule file path for a given command output. */
  73. virtual std::string GenerateRuleFile(std::string const& output) const;
  74. void PathTooLong(cmGeneratorTarget* target, cmSourceFile const* sf,
  75. std::string const& sfRel);
  76. virtual const char* GetToolsVersion() { return "4.0"; }
  77. bool FindMakeProgram(cmMakefile* mf) CM_OVERRIDE;
  78. static std::string GetInstalledNsightTegraVersion();
  79. cmIDEFlagTable const* GetClFlagTable() const;
  80. cmIDEFlagTable const* GetCSharpFlagTable() const;
  81. cmIDEFlagTable const* GetRcFlagTable() const;
  82. cmIDEFlagTable const* GetLibFlagTable() const;
  83. cmIDEFlagTable const* GetLinkFlagTable() const;
  84. cmIDEFlagTable const* GetCudaFlagTable() const;
  85. cmIDEFlagTable const* GetCudaHostFlagTable() const;
  86. cmIDEFlagTable const* GetMasmFlagTable() const;
  87. cmIDEFlagTable const* GetNasmFlagTable() const;
  88. protected:
  89. virtual void Generate();
  90. virtual bool InitializeSystem(cmMakefile* mf);
  91. virtual bool InitializeWindows(cmMakefile* mf);
  92. virtual bool InitializeWindowsCE(cmMakefile* mf);
  93. virtual bool InitializeWindowsPhone(cmMakefile* mf);
  94. virtual bool InitializeWindowsStore(cmMakefile* mf);
  95. virtual bool ProcessGeneratorToolsetField(std::string const& key,
  96. std::string const& value);
  97. virtual std::string SelectWindowsCEToolset() const;
  98. virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
  99. virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
  100. virtual const char* GetIDEVersion() { return "10.0"; }
  101. std::string const& GetMSBuildCommand();
  102. std::string GeneratorToolset;
  103. std::string GeneratorToolsetHostArchitecture;
  104. std::string GeneratorToolsetCuda;
  105. std::string DefaultPlatformToolset;
  106. std::string WindowsTargetPlatformVersion;
  107. std::string SystemName;
  108. std::string SystemVersion;
  109. std::string NsightTegraVersion;
  110. cmIDEFlagTable const* DefaultClFlagTable;
  111. cmIDEFlagTable const* DefaultCSharpFlagTable;
  112. cmIDEFlagTable const* DefaultLibFlagTable;
  113. cmIDEFlagTable const* DefaultLinkFlagTable;
  114. cmIDEFlagTable const* DefaultCudaFlagTable;
  115. cmIDEFlagTable const* DefaultCudaHostFlagTable;
  116. cmIDEFlagTable const* DefaultMasmFlagTable;
  117. cmIDEFlagTable const* DefaultNasmFlagTable;
  118. cmIDEFlagTable const* DefaultRcFlagTable;
  119. bool SystemIsWindowsCE;
  120. bool SystemIsWindowsPhone;
  121. bool SystemIsWindowsStore;
  122. private:
  123. class Factory;
  124. struct LongestSourcePath
  125. {
  126. LongestSourcePath()
  127. : Length(0)
  128. , Target(0)
  129. , SourceFile(0)
  130. {
  131. }
  132. size_t Length;
  133. cmGeneratorTarget* Target;
  134. cmSourceFile const* SourceFile;
  135. std::string SourceRel;
  136. };
  137. LongestSourcePath LongestSource;
  138. std::string MSBuildCommand;
  139. bool MSBuildCommandInitialized;
  140. cmVisualStudio10ToolsetOptions ToolsetOptions;
  141. virtual std::string FindMSBuildCommand();
  142. virtual std::string FindDevEnvCommand();
  143. virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
  144. bool PlatformToolsetNeedsDebugEnum;
  145. bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
  146. std::string VCTargetsPath;
  147. bool FindVCTargetsPath(cmMakefile* mf);
  148. bool CudaEnabled;
  149. // We do not use the reload macros for VS >= 10.
  150. virtual std::string GetUserMacrosDirectory() { return ""; }
  151. };
  152. #endif