|
|
|
|
|
|
|
|
#include <dds/toolchain.hpp> |
|
|
#include <dds/toolchain.hpp> |
|
|
|
|
|
|
|
|
#include <algorithm> |
|
|
#include <algorithm> |
|
|
|
|
|
#include <chrono> |
|
|
#include <iomanip> |
|
|
#include <iomanip> |
|
|
#include <iostream> |
|
|
#include <iostream> |
|
|
#include <mutex> |
|
|
#include <mutex> |
|
|
|
|
|
|
|
|
fs::create_directories(obj_path.parent_path()); |
|
|
fs::create_directories(obj_path.parent_path()); |
|
|
|
|
|
|
|
|
spdlog::info("Compile file: {}", fs::relative(src_path, params.root).string()); |
|
|
spdlog::info("Compile file: {}", fs::relative(src_path, params.root).string()); |
|
|
|
|
|
auto start_time = std::chrono::steady_clock::now(); |
|
|
|
|
|
|
|
|
compile_file_spec spec{src_path, obj_path}; |
|
|
compile_file_spec spec{src_path, obj_path}; |
|
|
spec.enable_warnings = params.enable_warnings; |
|
|
spec.enable_warnings = params.enable_warnings; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto cmd = params.toolchain.create_compile_command(spec); |
|
|
auto cmd = params.toolchain.create_compile_command(spec); |
|
|
auto compile_res = run_proc(cmd); |
|
|
auto compile_res = run_proc(cmd); |
|
|
|
|
|
|
|
|
|
|
|
auto end_time = std::chrono::steady_clock::now(); |
|
|
|
|
|
auto dur_ms = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time); |
|
|
|
|
|
|
|
|
|
|
|
spdlog::info("Compile file: {} - {:n}ms", |
|
|
|
|
|
fs::relative(src_path, params.root).string(), |
|
|
|
|
|
dur_ms.count()); |
|
|
|
|
|
|
|
|
if (!compile_res.okay()) { |
|
|
if (!compile_res.okay()) { |
|
|
spdlog::error("Compilation failed: {}", spec.source_path.string()); |
|
|
spdlog::error("Compilation failed: {}", spec.source_path.string()); |
|
|
spdlog::error("Subcommand FAILED: {}\n{}", quote_command(cmd), compile_res.output); |
|
|
spdlog::error("Subcommand FAILED: {}\n{}", quote_command(cmd), compile_res.output); |