Build tool
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include <vector>
  3. #include <string>
  4. #include <optional>
  5. #include "BBBParser.h"
  6. #include "sys.h"
  7. class SourceFile {
  8. public:
  9. enum FileType {
  10. UNKNOWN, C, CXX,
  11. };
  12. static FileType fileTypeFrom(const std::string &name);
  13. SourceFile(
  14. std::string dir, std::string name,
  15. FileType type, BBBParser::Variables vars);
  16. const std::string &dir() const { return dir_; }
  17. const std::string &name() const { return name_; }
  18. FileType type() const { return type_; }
  19. const BBBParser::Variables &vars() const { return vars_; }
  20. const std::vector<std::string> *variable(const std::string &name) const;
  21. const std::vector<std::string> &compileFlags() const;
  22. const std::vector<std::string> &ldLibs() const;
  23. std::vector<std::string> dependencies() const;
  24. bool needsRecompile(const std::string &outDir) const;
  25. void compile(const std::string &outDir) const;
  26. private:
  27. std::string dir_;
  28. std::string name_;
  29. FileType type_;
  30. BBBParser::Variables vars_;
  31. mutable std::vector<std::string> compileFlags_;
  32. mutable bool hasCompileFlags_ = false;
  33. mutable std::vector<std::string> ldLibs_;
  34. mutable bool hasLDLibs_ = false;
  35. };