cmCustomCommandGenerator.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 <set>
  6. #include <string>
  7. #include <utility>
  8. #include <vector>
  9. #include "cmCustomCommandLines.h"
  10. #include "cmListFileCache.h"
  11. class cmCustomCommand;
  12. class cmLocalGenerator;
  13. class cmCustomCommandGenerator
  14. {
  15. cmCustomCommand const* CC;
  16. std::string Config;
  17. cmLocalGenerator* LG;
  18. bool OldStyle;
  19. bool MakeVars;
  20. cmCustomCommandLines CommandLines;
  21. std::vector<std::vector<std::string>> EmulatorsWithArguments;
  22. std::vector<std::string> Outputs;
  23. std::vector<std::string> Byproducts;
  24. std::vector<std::string> Depends;
  25. std::string WorkingDirectory;
  26. std::set<BT<std::pair<std::string, bool>>> Utilities;
  27. void FillEmulatorsWithArguments();
  28. std::vector<std::string> GetCrossCompilingEmulator(unsigned int c) const;
  29. const char* GetArgv0Location(unsigned int c) const;
  30. public:
  31. cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config,
  32. cmLocalGenerator* lg, bool transformDepfile = true);
  33. cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete;
  34. cmCustomCommandGenerator(cmCustomCommandGenerator&&) = default;
  35. cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) =
  36. delete;
  37. cmCustomCommandGenerator& operator=(cmCustomCommandGenerator&&) = default;
  38. cmCustomCommand const& GetCC() const { return *(this->CC); }
  39. unsigned int GetNumberOfCommands() const;
  40. std::string GetCommand(unsigned int c) const;
  41. void AppendArguments(unsigned int c, std::string& cmd) const;
  42. const char* GetComment() const;
  43. std::string GetWorkingDirectory() const;
  44. std::vector<std::string> const& GetOutputs() const;
  45. std::vector<std::string> const& GetByproducts() const;
  46. std::vector<std::string> const& GetDepends() const;
  47. std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const;
  48. bool HasOnlyEmptyCommandLines() const;
  49. std::string GetFullDepfile() const;
  50. std::string GetInternalDepfile() const;
  51. };