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.

toolchain.h 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include <vector>
  3. #include <string>
  4. #include "BXParser.h"
  5. namespace toolchain {
  6. enum class FileType {
  7. C, CXX,
  8. };
  9. enum class TargetType {
  10. BINARY,
  11. SHARED_LIBRARY,
  12. STATIC_LIBRARY,
  13. };
  14. std::string objectFilePath(const std::string &path, const std::string &outDir);
  15. std::string targetFilePath(
  16. TargetType type,
  17. const std::string &path,
  18. const std::string &outDir);
  19. void getFlags(const BXVariables &vars, FileType type, std::vector<std::string> &flags);
  20. void getLDLibs(const BXVariables &vars, std::vector<std::string> &flags);
  21. void getLDFlags(const BXVariables &vars, std::vector<std::string> &flags);
  22. std::vector<std::string> getDependencies(
  23. const std::vector<std::string> &flags,
  24. FileType type,
  25. const std::string &path);
  26. std::vector<std::string> getCompileCommand(
  27. const std::vector<std::string> &flags,
  28. FileType type,
  29. const std::string &path,
  30. const std::string &outDir);
  31. // TODO: Don't rely on FileType, just use LD and let the dependency graph nodes
  32. // provide the necessary flags to link with libstdc++
  33. std::vector<std::string> getLinkCommand(
  34. const std::vector<std::string> &ldFlags,
  35. const std::vector<std::string> &ldLibs,
  36. FileType type,
  37. TargetType targetType,
  38. const std::vector<std::string> &objs,
  39. const std::string &path,
  40. const std::string &outDir);
  41. }