From 1c7cbb302b1c6e41eb0c5cecfc655532f1919cba Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 28 Jul 2017 13:46:26 +0200 Subject: Implement support for linking whole archive --- build2/cc/common.cxx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'build2/cc/common.cxx') diff --git a/build2/cc/common.cxx b/build2/cc/common.cxx index 8dabb07..195c3b7 100644 --- a/build2/cc/common.cxx +++ b/build2/cc/common.cxx @@ -52,10 +52,12 @@ namespace build2 const dir_paths& top_sysd, const file& l, bool la, + lflags lf, const function& proc_impl, // Implementation? const function& proc_lib, // True if system library. const function (l.vars[c_system]) : !p.empty () && sys (top_sysd, p.string ())); - proc_lib (&l, p.string (), s); + proc_lib (&l, p.string (), lf, s); } const scope& bs (t == nullptr || cc ? top_bs : l.base_scope ()); @@ -220,20 +222,20 @@ namespace build2 // if (impl && !c_e_libs.defined () && !x_e_libs.defined ()) { - for (const target* p: l.prerequisite_targets) + for (auto pt: l.prerequisite_targets) { bool a; const file* f; - if ((a = (f = p->is_a ())) || - (a = (f = p->is_a ())) || - ( f = p->is_a ())) + if ((a = (f = pt->is_a ())) || + (a = (f = pt->is_a ())) || + ( f = pt->is_a ())) { if (sysd == nullptr) find_sysd (); if (!li) find_linfo (); process_libraries (act, bs, *li, *sysd, - *f, a, + *f, a, pt.data, proc_impl, proc_lib, proc_opt, true); } } @@ -286,7 +288,7 @@ namespace build2 // .pc files. // if (proc_lib) - proc_lib (nullptr, n.value, sys_simple (n.value)); + proc_lib (nullptr, n.value, 0, sys_simple (n.value)); } else { @@ -316,8 +318,11 @@ namespace build2 // Process it recursively. // + // @@ Where can we get the link flags? Should we try to find them + // in the library's prerequisites? What about installed stuff? + // process_libraries (act, bs, *li, *sysd, - t, t.is_a () || t.is_a (), + t, t.is_a () || t.is_a (), 0, proc_impl, proc_lib, proc_opt, true); } } @@ -336,7 +341,7 @@ namespace build2 // This is something like -lpthread or shell32.lib so should be a // valid path. // - proc_lib (nullptr, n, sys_simple (n)); + proc_lib (nullptr, n, 0, sys_simple (n)); } }; -- cgit v1.1