cmGlobalNMakeMakefileGenerator.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 <iosfwd>
  5. #include <memory>
  6. #include <string>
  7. #include <vector>
  8. #include "cm_codecvt_Encoding.hxx"
  9. #include "cmGlobalGeneratorFactory.h"
  10. #include "cmGlobalUnixMakefileGenerator3.h"
  11. #include "cmValue.h"
  12. class cmMakefile;
  13. class cmake;
  14. /** \class cmGlobalNMakeMakefileGenerator
  15. * \brief Write a NMake makefiles.
  16. *
  17. * cmGlobalNMakeMakefileGenerator manages nmake build process for a tree
  18. */
  19. class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
  20. {
  21. public:
  22. cmGlobalNMakeMakefileGenerator(cmake* cm);
  23. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
  24. {
  25. return std::unique_ptr<cmGlobalGeneratorFactory>(
  26. new cmGlobalGeneratorSimpleFactory<cmGlobalNMakeMakefileGenerator>());
  27. }
  28. //! Get the name for the generator.
  29. std::string GetName() const override
  30. {
  31. return cmGlobalNMakeMakefileGenerator::GetActualName();
  32. }
  33. static std::string GetActualName() { return "NMake Makefiles"; }
  34. /** Get encoding used by generator for makefile files */
  35. codecvt_Encoding GetMakefileEncoding() const override
  36. {
  37. return this->NMakeSupportsUTF8 ? codecvt_Encoding::UTF8_WITH_BOM
  38. : codecvt_Encoding::ANSI;
  39. }
  40. /** Get the documentation entry for this generator. */
  41. static cmDocumentationEntry GetDocumentation();
  42. /**
  43. * Try to determine system information such as shared library
  44. * extension, pthreads, byte order etc.
  45. */
  46. void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
  47. bool optional) override;
  48. protected:
  49. std::vector<GeneratedMakeCommand> GenerateBuildCommand(
  50. const std::string& makeProgram, const std::string& projectName,
  51. const std::string& projectDir, std::vector<std::string> const& targetNames,
  52. const std::string& config, int jobs, bool verbose,
  53. const cmBuildOptions& buildOptions = cmBuildOptions(),
  54. std::vector<std::string> const& makeOptions =
  55. std::vector<std::string>()) override;
  56. void PrintBuildCommandAdvice(std::ostream& os, int jobs) const override;
  57. private:
  58. bool NMakeSupportsUTF8 = false;
  59. std::string NMakeVersion;
  60. bool FindMakeProgram(cmMakefile* mf) override;
  61. void CheckNMakeFeatures();
  62. void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
  63. cmValue envVar) const override;
  64. };