cmGlobalVisualStudio10Generator.h 7.47 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3 4 5 6
#ifndef cmGlobalVisualStudio10Generator_h
#define cmGlobalVisualStudio10Generator_h

#include "cmGlobalVisualStudio8Generator.h"
7
#include "cmVisualStudio10ToolsetOptions.h"
8 9 10 11 12 13

/** \class cmGlobalVisualStudio10Generator
 * \brief Write a Unix makefiles.
 *
 * cmGlobalVisualStudio10Generator manages UNIX build process for a tree
 */
14
class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator
15 16
{
public:
17
  static cmGlobalGeneratorFactory* NewFactory();
18

19
  bool MatchesGeneratorName(const std::string& name) const override;
20

21 22 23
  bool SetSystemName(std::string const& s, cmMakefile* mf) override;
  bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf) override;
  bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) override;
24

25 26 27 28 29 30
  std::vector<GeneratedMakeCommand> GenerateBuildCommand(
    const std::string& makeProgram, const std::string& projectName,
    const std::string& projectDir, std::vector<std::string> const& targetNames,
    const std::string& config, bool fast, int jobs, bool verbose,
    std::vector<std::string> const& makeOptions =
      std::vector<std::string>()) override;
31

32
  //! create the correct local generator
33
  cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf) override;
34 35

  /**
36
   * Try to determine system information such as shared library
37
   * extension, pthreads, byte order etc.
38
   */
39 40
  void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
                      bool optional) override;
41

42 43
  bool IsCudaEnabled() const { return this->CudaEnabled; }

44 45
  /** Generating for Nsight Tegra VS plugin?  */
  bool IsNsightTegra() const;
46
  std::string GetNsightTegraVersion() const;
47

48
  /** The toolset name for the target platform.  */
49
  const char* GetPlatformToolset() const;
50
  std::string const& GetPlatformToolsetString() const;
51

52 53 54 55
  /** The toolset version.  */
  const char* GetPlatformToolsetVersion() const;
  std::string const& GetPlatformToolsetVersionString() const;

56 57
  /** The toolset host architecture name (e.g. x64 for 64-bit host tools).  */
  const char* GetPlatformToolsetHostArchitecture() const;
58
  std::string const& GetPlatformToolsetHostArchitectureString() const;
59

60 61 62 63
  /** The cuda toolset version.  */
  const char* GetPlatformToolsetCuda() const;
  std::string const& GetPlatformToolsetCudaString() const;

64 65 66 67 68 69 70
  /** Return whether we need to use No/Debug instead of false/true
      for GenerateDebugInformation.  */
  bool GetPlatformToolsetNeedsDebugEnum() const
  {
    return this->PlatformToolsetNeedsDebugEnum;
  }

71 72 73 74 75 76
  /** Return the CMAKE_SYSTEM_NAME.  */
  std::string const& GetSystemName() const { return this->SystemName; }

  /** Return the CMAKE_SYSTEM_VERSION.  */
  std::string const& GetSystemVersion() const { return this->SystemVersion; }

77 78
  /** Return the Windows version targeted on VS 2015 and above.  */
  std::string const& GetWindowsTargetPlatformVersion() const
79 80 81
  {
    return this->WindowsTargetPlatformVersion;
  }
82

83
  /** Return true if building for WindowsCE */
Vitaly Stakhovsky's avatar
Vitaly Stakhovsky committed
84
  bool TargetsWindowsCE() const override { return this->SystemIsWindowsCE; }
85

86
  /** Return true if building for WindowsPhone */
87
  bool TargetsWindowsPhone() const { return this->SystemIsWindowsPhone; }
88 89

  /** Return true if building for WindowsStore */
90
  bool TargetsWindowsStore() const { return this->SystemIsWindowsStore; }
91

92
  const char* GetCMakeCFGIntDir() const override { return "$(Configuration)"; }
93
  bool Find64BitTools(cmMakefile* mf);
94 95

  /** Generate an <output>.rule file path for a given command output.  */
96
  std::string GenerateRuleFile(std::string const& output) const override;
97

98
  void PathTooLong(cmGeneratorTarget* target, cmSourceFile const* sf,
99
                   std::string const& sfRel);
100

101
  std::string Encoding() override;
102
  const char* GetToolsVersion() const;
103

104
  virtual bool IsDefaultToolset(const std::string& version) const;
105 106
  virtual std::string GetAuxiliaryToolset() const;

107
  bool FindMakeProgram(cmMakefile* mf) override;
108

109 110
  bool IsIPOSupported() const override { return true; }

111 112
  static std::string GetInstalledNsightTegraVersion();

113 114 115
  /** Return the first two components of CMAKE_SYSTEM_VERSION.  */
  std::string GetApplicationTypeRevision() const;

116
  cmIDEFlagTable const* GetClFlagTable() const;
117
  cmIDEFlagTable const* GetCSharpFlagTable() const;
118 119 120
  cmIDEFlagTable const* GetRcFlagTable() const;
  cmIDEFlagTable const* GetLibFlagTable() const;
  cmIDEFlagTable const* GetLinkFlagTable() const;
121 122
  cmIDEFlagTable const* GetCudaFlagTable() const;
  cmIDEFlagTable const* GetCudaHostFlagTable() const;
123
  cmIDEFlagTable const* GetMasmFlagTable() const;
124
  cmIDEFlagTable const* GetNasmFlagTable() const;
125

126
protected:
127 128 129
  cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
                                  std::string const& platformInGeneratorName);

130
  void Generate() override;
131
  virtual bool InitializeSystem(cmMakefile* mf);
132
  virtual bool InitializeWindows(cmMakefile* mf);
133
  virtual bool InitializeWindowsCE(cmMakefile* mf);
134 135
  virtual bool InitializeWindowsPhone(cmMakefile* mf);
  virtual bool InitializeWindowsStore(cmMakefile* mf);
136

137 138 139
  virtual bool ProcessGeneratorToolsetField(std::string const& key,
                                            std::string const& value);

140
  virtual std::string SelectWindowsCEToolset() const;
141 142
  virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
  virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
143

144 145
  std::string const& GetMSBuildCommand();

146 147 148
  cmIDEFlagTable const* LoadFlagTable(std::string const& optionsName,
                                      std::string const& toolsetName,
                                      std::string const& defaultName,
149 150
                                      std::string const& table) const;

151
  std::string GeneratorToolset;
152
  std::string GeneratorToolsetVersion;
153
  std::string GeneratorToolsetHostArchitecture;
154
  std::string GeneratorToolsetCuda;
155
  std::string DefaultPlatformToolset;
156
  std::string DefaultPlatformToolsetHostArchitecture;
157
  std::string WindowsTargetPlatformVersion;
158 159
  std::string SystemName;
  std::string SystemVersion;
160
  std::string NsightTegraVersion;
161 162 163 164 165 166 167 168 169
  std::string DefaultCLFlagTableName;
  std::string DefaultCSharpFlagTableName;
  std::string DefaultLibFlagTableName;
  std::string DefaultLinkFlagTableName;
  std::string DefaultCudaFlagTableName;
  std::string DefaultCudaHostFlagTableName;
  std::string DefaultMasmFlagTableName;
  std::string DefaultNasmFlagTableName;
  std::string DefaultRCFlagTableName;
170
  bool SystemIsWindowsCE;
171 172
  bool SystemIsWindowsPhone;
  bool SystemIsWindowsStore;
173

174
private:
175
  class Factory;
176 177
  friend class Factory;

178 179
  struct LongestSourcePath
  {
180 181 182 183 184 185
    LongestSourcePath()
      : Length(0)
      , Target(0)
      , SourceFile(0)
    {
    }
186
    size_t Length;
187
    cmGeneratorTarget* Target;
188
    cmSourceFile const* SourceFile;
189 190 191
    std::string SourceRel;
  };
  LongestSourcePath LongestSource;
192 193 194

  std::string MSBuildCommand;
  bool MSBuildCommandInitialized;
195
  cmVisualStudio10ToolsetOptions ToolsetOptions;
196
  virtual std::string FindMSBuildCommand();
197 198
  std::string FindDevEnvCommand() override;
  std::string GetVSMakeProgram() override { return this->GetMSBuildCommand(); }
199

200 201
  bool PlatformToolsetNeedsDebugEnum;

202 203
  bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);

204 205 206
  std::string VCTargetsPath;
  bool FindVCTargetsPath(cmMakefile* mf);

207 208
  bool CudaEnabled;

209
  // We do not use the reload macros for VS >= 10.
210
  std::string GetUserMacrosDirectory() override { return ""; }
211 212
};
#endif