diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-06-16 09:43:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-06-16 10:51:49 +0200 |
commit | af73b1603d851dcb2ce7ae84bd57df0c2f9a716d (patch) | |
tree | 2c59bbf5ecdb2b5cec2f8f656ee3f7b13bc1b97b /libbuild2/bin/utility.hxx | |
parent | ecfae2da0b23631cee3e723a562f64f8aace6879 (diff) |
Add $bin.link_member() function
Given a linker output target type ("exe", "lib[as]", or "libu[eas]") return
the target type of lib{} group member ("liba" or "libs") that will be picked
when linking a lib{} group to this target type.
Diffstat (limited to 'libbuild2/bin/utility.hxx')
-rw-r--r-- | libbuild2/bin/utility.hxx | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libbuild2/bin/utility.hxx b/libbuild2/bin/utility.hxx index 91b51f8..5d7eed4 100644 --- a/libbuild2/bin/utility.hxx +++ b/libbuild2/bin/utility.hxx @@ -19,10 +19,16 @@ namespace build2 // @@ Here we conflate the term "link" to mean both linker output and // linking of a library. - // Linker output type from binary (exe{}, lib*{}) target. + // Linker output type from a target (exe{}, lib*{}). // ltype - link_type (const target&); + link_type (const target_type&); + + inline ltype + link_type (const target& t) + { + return link_type (t.type ()); + } // Library group (lib{}) members to build according to the bin.lib value. // @@ -39,12 +45,12 @@ namespace build2 // directory have to have the same link order. // LIBBUILD2_BIN_SYMEXPORT lorder - link_order (const scope& base, otype); + link_order (const scope& bs, otype); inline linfo - link_info (const scope& base, otype ot) + link_info (const scope& bs, otype ot) { - return linfo {ot, link_order (base, ot)}; + return linfo {ot, link_order (bs, ot)}; } // Given the link order return the library member to link. That is, liba{} @@ -56,6 +62,14 @@ namespace build2 LIBBUILD2_BIN_SYMEXPORT const target* link_member (const libx&, action, linfo, bool existing = false); + // As above but return otype::a or otype::s as well as an indication if + // the member is available. + // + // @@ TODO: support utility libraries (see above version). + // + pair<otype, bool> + link_member (lmembers, linfo); + // Lookup the bin.pattern value and split it into the pattern and the // search paths. // |