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

34 lines
1.2KB

  1. #include "./compile_file.hpp"
  2. #include <dds/proc.hpp>
  3. #include <dds/util/algo.hpp>
  4. #include <dds/util/signal.hpp>
  5. #include <dds/util/time.hpp>
  6. #include <spdlog/spdlog.h>
  7. #include <string>
  8. #include <vector>
  9. using namespace dds;
  10. compile_command_info compile_file_plan::generate_compile_command(build_env_ref env) const noexcept {
  11. compile_file_spec spec{_source.path, calc_object_file_path(env)};
  12. spec.enable_warnings = _rules.enable_warnings();
  13. extend(spec.include_dirs, _rules.include_dirs());
  14. for (const auto& use : _rules.uses()) {
  15. extend(spec.external_include_dirs, env.ureqs.include_paths(use));
  16. }
  17. extend(spec.definitions, _rules.defs());
  18. return env.toolchain.create_compile_command(spec);
  19. }
  20. fs::path compile_file_plan::calc_object_file_path(const build_env& env) const noexcept {
  21. // `relpath` is just the path from the root of the source directory to the source file.
  22. auto relpath = fs::relative(_source.path, _source.basis_path);
  23. // The full output directory is prefixed by `_subdir`
  24. auto ret = env.output_root / _subdir / relpath;
  25. ret.replace_filename(relpath.filename().string() + env.toolchain.object_suffix());
  26. return fs::weakly_canonical(ret);
  27. }