cmCustomCommandGenerator.h 2.4 KB

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