const auto obj_path = object_file_path(sf.path, params); | const auto obj_path = object_file_path(sf.path, params); | ||||
comps.compilations.push_back(file_compilation{std::move(rules), | comps.compilations.push_back(file_compilation{std::move(rules), | ||||
sf.path, | |||||
sf, | |||||
obj_path, | obj_path, | ||||
params.export_name, | params.export_name, | ||||
params.enable_warnings}); | params.enable_warnings}); | ||||
archive_spec arc; | archive_spec arc; | ||||
for (const auto& comp : compiles.compilations) { | for (const auto& comp : compiles.compilations) { | ||||
arc.input_files.push_back(comp.obj); | |||||
if (comp.source.kind == source_kind::source) { | |||||
arc.input_files.push_back(comp.obj); | |||||
} | |||||
} | } | ||||
// arc.input_files = compile_sources(sources, params, man); | |||||
arc.out_path = params.out_root | arc.out_path = params.out_root | ||||
/ (fmt::format("lib{}{}", params.export_name, params.toolchain.archive_suffix())); | / (fmt::format("lib{}{}", params.export_name, params.toolchain.archive_suffix())); |
spdlog::info("[{}] Compile file: {}", | spdlog::info("[{}] Compile file: {}", | ||||
owner_name, | owner_name, | ||||
fs::relative(file, rules.base_path()).string()); | |||||
fs::relative(source.path, rules.base_path()).string()); | |||||
auto start_time = std::chrono::steady_clock::now(); | auto start_time = std::chrono::steady_clock::now(); | ||||
compile_file_spec spec{file, obj}; | |||||
compile_file_spec spec{source.path, obj}; | |||||
spec.enable_warnings = enable_warnings; | spec.enable_warnings = enable_warnings; | ||||
extend(spec.include_dirs, rules.include_dirs()); | extend(spec.include_dirs, rules.include_dirs()); | ||||
spdlog::info("[{}] Compile file: {} - {:n}ms", | spdlog::info("[{}] Compile file: {} - {:n}ms", | ||||
owner_name, | owner_name, | ||||
fs::relative(file, rules.base_path()).string(), | |||||
fs::relative(source.path, rules.base_path()).string(), | |||||
dur_ms.count()); | dur_ms.count()); | ||||
if (!compile_res.okay()) { | if (!compile_res.okay()) { | ||||
spdlog::error("Compilation failed: {}", file.string()); | |||||
spdlog::error("Compilation failed: {}", 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); | ||||
throw compile_failure("Compilation failed."); | throw compile_failure("Compilation failed."); | ||||
} | } |
#pragma once | #pragma once | ||||
#include <dds/source.hpp> | |||||
#include <dds/toolchain.hpp> | #include <dds/toolchain.hpp> | ||||
#include <dds/util.hpp> | #include <dds/util.hpp> | ||||
struct file_compilation { | struct file_compilation { | ||||
compilation_rules rules; | compilation_rules rules; | ||||
fs::path file; | |||||
source_file source; | |||||
fs::path obj; | fs::path obj; | ||||
std::string owner_name; | std::string owner_name; | ||||
bool enable_warnings = false; | bool enable_warnings = false; |