diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-27 14:45:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-27 14:45:05 +0200 |
commit | bf959a7fc119f9156c4b84c9d0a10900d9153f8d (patch) | |
tree | d19b96238f58e305d936d186901edd1cf98e0c93 /build2/cc/utility.cxx | |
parent | 24f74ea70a19ccd7bcb489853fc73a972ab8638f (diff) |
Initial infrastructure for utility libraries
Diffstat (limited to 'build2/cc/utility.cxx')
-rw-r--r-- | build2/cc/utility.cxx | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/build2/cc/utility.cxx b/build2/cc/utility.cxx index 7a03b54..fa5061e 100644 --- a/build2/cc/utility.cxx +++ b/build2/cc/utility.cxx @@ -39,34 +39,50 @@ namespace build2 } const target& - link_member (const bin::lib& l, action a, lorder lo) + link_member (const bin::libx& x, action a, linfo li) { - // Make sure group members are resolved. - // - group_view gv (resolve_group_members (a, l)); - assert (gv.members != nullptr); - - bool ls (true); - switch (lo) + if (const libu* u = x.is_a<libu> ()) { - case lorder::a: - case lorder::a_s: - ls = false; // Fall through. - case lorder::s: - case lorder::s_a: + otype ot (li.type); + return search (*u, + ot == otype::e ? libue::static_type : + ot == otype::a ? libua::static_type : + libus::static_type, + u->dir, u->out, u->name); + } + else + { + const lib& l (x.as<lib> ()); + + // Make sure group members are resolved. + // + group_view gv (resolve_group_members (a, l)); + assert (gv.members != nullptr); + + lorder lo (li.order); + + bool ls (true); + switch (lo) { - if (ls ? l.s == nullptr : l.a == nullptr) + case lorder::a: + case lorder::a_s: + ls = false; // Fall through. + case lorder::s: + case lorder::s_a: { - if (lo == lorder::a_s || lo == lorder::s_a) - ls = !ls; - else - fail << (ls ? "shared" : "static") << " variant of " << l - << " is not available"; + if (ls ? l.s == nullptr : l.a == nullptr) + { + if (lo == lorder::a_s || lo == lorder::s_a) + ls = !ls; + else + fail << (ls ? "shared" : "static") << " variant of " << l + << " is not available"; + } } } - } - return *(ls ? static_cast<const target*> (l.s) : l.a); + return *(ls ? static_cast<const target*> (l.s) : l.a); + } } } } |