cmGlobalVisualStudioVersionedGenerator.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file LICENSE.rst or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <memory>
  6. #include <string>
  7. #include <cm/optional>
  8. #include "cmGlobalVisualStudio10Generator.h"
  9. #include "cmGlobalVisualStudio14Generator.h"
  10. #include "cmGlobalVisualStudioGenerator.h"
  11. #include "cmVSSetupHelper.h"
  12. class cmGlobalGeneratorFactory;
  13. class cmMakefile;
  14. class cmake;
  15. /** \class cmGlobalVisualStudioVersionedGenerator */
  16. class cmGlobalVisualStudioVersionedGenerator
  17. : public cmGlobalVisualStudio14Generator
  18. {
  19. public:
  20. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory15();
  21. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory16();
  22. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory17();
  23. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory18();
  24. bool MatchesGeneratorName(std::string const& name) const override;
  25. bool SetGeneratorInstance(std::string const& i, cmMakefile* mf) override;
  26. bool GetVSInstance(std::string& dir) const;
  27. cm::optional<std::string> FindMSBuildCommandEarly(cmMakefile* mf) override;
  28. cm::optional<std::string> GetVSInstanceVersion() const override;
  29. AuxToolset FindAuxToolset(std::string& version,
  30. std::string& props) const override;
  31. bool IsStdOutEncodingSupported() const override;
  32. bool IsUtf8EncodingSupported() const override;
  33. bool IsScanDependenciesSupported() const override;
  34. char const* GetAndroidApplicationTypeRevision() const override;
  35. bool CheckCxxModuleSupport(CxxModuleSupportQuery /*query*/) override
  36. {
  37. return this->SupportsCxxModuleDyndep();
  38. }
  39. bool SupportsCxxModuleDyndep() const override
  40. {
  41. return this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS17;
  42. }
  43. protected:
  44. cmGlobalVisualStudioVersionedGenerator(VSVersion version, cmake* cm,
  45. std::string const& name);
  46. bool SelectWindowsStoreToolset(std::string& toolset) const override;
  47. // Used to verify that the Desktop toolset for the current generator is
  48. // installed on the machine.
  49. bool IsWindowsDesktopToolsetInstalled() const override;
  50. // These aren't virtual because we need to check if the selected version
  51. // of the toolset is installed
  52. bool IsWindowsStoreToolsetInstalled() const;
  53. // Check for a Win 8 SDK known to the registry or VS installer tool.
  54. bool IsWin81SDKInstalled() const override;
  55. std::string GetWindows10SDKMaxVersionDefault(cmMakefile*) const override;
  56. virtual bool ProcessGeneratorInstanceField(std::string const& key,
  57. std::string const& value);
  58. std::string FindMSBuildCommand() override;
  59. std::string FindDevEnvCommand() override;
  60. private:
  61. class Factory15;
  62. friend class Factory15;
  63. class Factory16;
  64. friend class Factory16;
  65. class Factory17;
  66. friend class Factory17;
  67. class Factory18;
  68. friend class Factory18;
  69. mutable cmVSSetupAPIHelper vsSetupAPIHelper;
  70. bool ParseGeneratorInstance(std::string const& is, cmMakefile* mf);
  71. void SetVSVersionVar(cmMakefile* mf);
  72. std::string GeneratorInstance;
  73. std::string GeneratorInstanceVersion;
  74. cm::optional<std::string> LastGeneratorInstanceString;
  75. };