cmGlobalVisualStudioVersionedGenerator.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <iosfwd>
  6. #include <memory>
  7. #include <string>
  8. #include <cm/optional>
  9. #include "cmGlobalVisualStudio14Generator.h"
  10. #include "cmVSSetupHelper.h"
  11. class cmGlobalGeneratorFactory;
  12. class cmake;
  13. /** \class cmGlobalVisualStudioVersionedGenerator */
  14. class cmGlobalVisualStudioVersionedGenerator
  15. : public cmGlobalVisualStudio14Generator
  16. {
  17. public:
  18. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory15();
  19. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory16();
  20. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory17();
  21. bool MatchesGeneratorName(const std::string& name) const override;
  22. bool SetGeneratorInstance(std::string const& i, cmMakefile* mf) override;
  23. bool GetVSInstance(std::string& dir) const;
  24. cm::optional<std::string> FindMSBuildCommandEarly(cmMakefile* mf) override;
  25. cm::optional<std::string> GetVSInstanceVersion() const override;
  26. AuxToolset FindAuxToolset(std::string& version,
  27. std::string& props) const override;
  28. bool IsStdOutEncodingSupported() const override;
  29. bool IsUtf8EncodingSupported() const override;
  30. const char* GetAndroidApplicationTypeRevision() const override;
  31. protected:
  32. cmGlobalVisualStudioVersionedGenerator(
  33. VSVersion version, cmake* cm, const std::string& name,
  34. std::string const& platformInGeneratorName);
  35. bool InitializeWindows(cmMakefile* mf) override;
  36. bool SelectWindowsStoreToolset(std::string& toolset) const override;
  37. // Used to verify that the Desktop toolset for the current generator is
  38. // installed on the machine.
  39. bool IsWindowsDesktopToolsetInstalled() const override;
  40. // These aren't virtual because we need to check if the selected version
  41. // of the toolset is installed
  42. bool IsWindowsStoreToolsetInstalled() const;
  43. // Check for a Win 8 SDK known to the registry or VS installer tool.
  44. bool IsWin81SDKInstalled() const;
  45. std::string GetWindows10SDKMaxVersionDefault(cmMakefile*) const override;
  46. std::string FindMSBuildCommand() override;
  47. std::string FindDevEnvCommand() override;
  48. private:
  49. class Factory15;
  50. friend class Factory15;
  51. class Factory16;
  52. friend class Factory16;
  53. class Factory17;
  54. friend class Factory17;
  55. mutable cmVSSetupAPIHelper vsSetupAPIHelper;
  56. cm::optional<std::string> GeneratorInstance;
  57. };