lib_reqs.include_paths.push_back(lib.library_().public_include_dir()); | lib_reqs.include_paths.push_back(lib.library_().public_include_dir()); | ||||
lib_reqs.uses = lib.library_().manifest().uses; | lib_reqs.uses = lib.library_().manifest().uses; | ||||
lib_reqs.links = lib.library_().manifest().links; | lib_reqs.links = lib.library_().manifest().links; | ||||
if (const auto& arc = lib.create_archive()) { | |||||
if (const auto& arc = lib.archive_plan()) { | |||||
lib_reqs.linkable_path = out_root / arc->calc_archive_file_path(toolchain); | lib_reqs.linkable_path = out_root / arc->calc_archive_file_path(toolchain); | ||||
} | } | ||||
} | } | ||||
for (auto&& link : lib.links()) { | for (auto&& link : lib.links()) { | ||||
out << "Links: " << link.namespace_ << "/" << link.name << '\n'; | out << "Links: " << link.namespace_ << "/" << link.name << '\n'; | ||||
} | } | ||||
if (auto&& arc = lib.create_archive()) { | |||||
if (auto&& arc = lib.archive_plan()) { | |||||
out << "Path: " | out << "Path: " | ||||
<< (env.output_root / arc->calc_archive_file_path(env.toolchain)).generic_string() | << (env.output_root / arc->calc_archive_file_path(env.toolchain)).generic_string() | ||||
<< '\n'; | << '\n'; |
inline auto iter_compilations(const build_plan& plan) { | inline auto iter_compilations(const build_plan& plan) { | ||||
auto lib_compiles = // | auto lib_compiles = // | ||||
iter_libraries(plan) // | iter_libraries(plan) // | ||||
| ranges::views::transform(&library_plan::create_archive) // | |||||
| ranges::views::transform(&library_plan::archive_plan) // | |||||
| ranges::views::filter([&](auto&& opt) { return bool(opt); }) // | | ranges::views::filter([&](auto&& opt) { return bool(opt); }) // | ||||
| ranges::views::transform([&](auto&& opt) -> auto& { return opt->compile_files(); }) // | | ranges::views::transform([&](auto&& opt) -> auto& { return opt->compile_files(); }) // | ||||
| ranges::views::join // | | ranges::views::join // |
for (const lm::usage& links : _links) { | for (const lm::usage& links : _links) { | ||||
extend(spec.inputs, env.ureqs.link_paths(links)); | extend(spec.inputs, env.ureqs.link_paths(links)); | ||||
} | } | ||||
if (lib.create_archive()) { | |||||
if (lib.archive_plan()) { | |||||
// The associated library has compiled components. Add the static library a as a linker | // The associated library has compiled components. Add the static library a as a linker | ||||
// input | // input | ||||
spec.inputs.push_back(env.output_root | spec.inputs.push_back(env.output_root | ||||
/ lib.create_archive()->calc_archive_file_path(env.toolchain)); | |||||
/ lib.archive_plan()->calc_archive_file_path(env.toolchain)); | |||||
} | } | ||||
// The main object should be a linker input, of course. | // The main object should be a linker input, of course. |
void build_plan::archive_all(const build_env& env, int njobs) const { | void build_plan::archive_all(const build_env& env, int njobs) const { | ||||
auto okay = parallel_run(iter_libraries(*this), njobs, [&](const library_plan& lib) { | auto okay = parallel_run(iter_libraries(*this), njobs, [&](const library_plan& lib) { | ||||
if (lib.create_archive()) { | |||||
lib.create_archive()->archive(env); | |||||
if (lib.archive_plan()) { | |||||
lib.archive_plan()->archive(env); | |||||
} | } | ||||
}); | }); | ||||
if (!okay) { | if (!okay) { |
* A `create_archive_plan` object, or `nullopt`, depending on if this library has compiled | * A `create_archive_plan` object, or `nullopt`, depending on if this library has compiled | ||||
* components | * components | ||||
*/ | */ | ||||
auto& create_archive() const noexcept { return _create_archive; } | |||||
auto& archive_plan() const noexcept { return _create_archive; } | |||||
/** | /** | ||||
* The executables that should be created by this library | * The executables that should be created by this library | ||||
*/ | */ |