Build tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CompileStep.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "DepNode.h"
  3. #include "BXParser.h"
  4. #include "sys.h"
  5. #include "toolchain.h"
  6. class CompileStep: public DepNode {
  7. public:
  8. CompileStep(std::string path, toolchain::FileType type, BXVariables vars):
  9. path_(std::move(path)), type_(type), variables_(std::move(vars)) {}
  10. private:
  11. std::string path_;
  12. toolchain::FileType type_;
  13. bool checkHasChanged(const std::string &outDir) override;
  14. toolchain::FileType doGetLinkType() override { return type_; }
  15. void doBuild(const std::string &outDir) override;
  16. void doWriteCompDB(const std::string &outDir, compdb::Writer &w) override;
  17. std::vector<std::string> getPublicLDFlags(const std::string &outDir) override;
  18. std::vector<std::string> getPublicLDLibs(const std::string &outDir) override;
  19. std::vector<std::string> getPublicObjects(const std::string &outDir) override;
  20. bool hasVariables_ = false;
  21. BXVariables variables_;
  22. BXVariables &variables();
  23. bool hasFlags_ = false;
  24. std::vector<std::string> flags_;
  25. std::vector<std::string> &flags();
  26. bool hasCompileCommand_ = false;
  27. std::vector<std::string> compileCommand_;
  28. std::vector<std::string> &compileCommand(const std::string &outDir);
  29. std::string confPath(const std::string &outDir) {
  30. return outDir + '/' + sys::sanitizePath(path_) + ".bx";
  31. }
  32. };