diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-25 17:40:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-25 17:40:21 +0200 |
commit | 32e04ad4b4a8dec07836b7c9fcf90fe72a006990 (patch) | |
tree | 8a0ce76d3a2f644396348fbf0d3d5d00bab82a0c /build2/bin/rule.cxx | |
parent | 236497a013790c879e9e798bd68083252b43b057 (diff) |
Implement missing pieces in utility libraries support
In particular, we can now build static libraries out of utility libraries.
Diffstat (limited to 'build2/bin/rule.cxx')
-rw-r--r-- | build2/bin/rule.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/build2/bin/rule.cxx b/build2/bin/rule.cxx index 9427697..b609c9a 100644 --- a/build2/bin/rule.cxx +++ b/build2/bin/rule.cxx @@ -37,15 +37,10 @@ namespace build2 // The whole logic is pretty much as if we had our two group members as // our prerequisites. // - bool lib_rule:: - match (action, target& xt, const string&) const + lib_rule::members lib_rule:: + build_members (const scope& rs) { - lib& t (xt.as<lib> ()); - - // Get the library type to build. If not set for a target, this should - // be configured at the project scope by init(). - // - const string& type (cast<string> (t["bin.lib"])); + const string& type (cast<string> (rs["bin.lib"])); bool a (type == "static" || type == "both"); bool s (type == "shared" || type == "both"); @@ -54,8 +49,17 @@ namespace build2 fail << "unknown library type: " << type << info << "'static', 'shared', or 'both' expected"; - t.a = a ? &search<liba> (t, t.dir, t.out, t.name) : nullptr; - t.s = s ? &search<libs> (t, t.dir, t.out, t.name) : nullptr; + return members {a, s}; + } + + bool lib_rule:: + match (action, target& xt, const string&) const + { + lib& t (xt.as<lib> ()); + + members bm (build_members (t.root_scope ())); + t.a = bm.a ? &search<liba> (t, t.dir, t.out, t.name) : nullptr; + t.s = bm.s ? &search<libs> (t, t.dir, t.out, t.name) : nullptr; return true; } |