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.hxx"
  9. #include "cmGlobalGeneratorFactory.h"
  10. #include "cmGlobalUnixMakefileGenerator3.h"
  11. #include "cmValue.h"
  12. class cmMakefile;
  13. class cmake;
  14. struct cmDocumentationEntry;
  15. /** \class cmGlobalNMakeMakefileGenerator
  16. * \brief Write a NMake makefiles.
  17. *
  18. * cmGlobalNMakeMakefileGenerator manages nmake build process for a tree
  19. */
  20. class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
  21. {
  22. public:
  23. cmGlobalNMakeMakefileGenerator(cmake* cm);
  24. static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
  25. {
  26. return std::unique_ptr<cmGlobalGeneratorFactory>(
  27. new cmGlobalGeneratorSimpleFactory<cmGlobalNMakeMakefileGenerator>());
  28. }
  29. //! Get the name for the generator.
  30. std::string GetName() const override
  31. {
  32. return cmGlobalNMakeMakefileGenerator::GetActualName();
  33. }
  34. static std::string GetActualName() { return "NMake Makefiles"; }
  35. /** Get encoding used by generator for makefile files */
  36. codecvt::Encoding GetMakefileEncoding() const override
  37. {
  38. return this->NMakeSupportsUTF8 ? codecvt::UTF8_WITH_BOM : codecvt::ANSI;
  39. }
  40. /** Get the documentation entry for this generator. */
  41. static void GetDocumentation(cmDocumentationEntry& entry);
  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. };