From ad4120afce8c7bc4001fc0173a0ff7611ec0198d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 12 Dec 2015 13:46:07 +0200 Subject: Implement installation of prerequisite shared libraries --- build/cxx/install.cxx | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'build/cxx/install.cxx') diff --git a/build/cxx/install.cxx b/build/cxx/install.cxx index e6417a6..f8c2c06 100644 --- a/build/cxx/install.cxx +++ b/build/cxx/install.cxx @@ -17,16 +17,35 @@ namespace build { using namespace bin; - bool install:: - filter (action, target& t, prerequisite_member p) const + target* install:: + filter (action a, target& t, prerequisite_member p) const { - // Don't install executable's prerequisite headers. + if (t.is_a ()) + { + // Don't install executable's prerequisite headers. + // + if (p.is_a () || p.is_a () || p.is_a () || p.is_a ()) + return nullptr; + } + + // If this is a shared library prerequisite, install it as long as it + // is in the same amalgamation as we are. // - if (t.is_a () && - (p.is_a () || p.is_a () || p.is_a () || p.is_a ())) - return false; + if ((t.is_a () || t.is_a ()) && + (p.is_a () || p.is_a ())) + { + target* pt (&p.search ()); + + // If this is the lib{} group, pick a member which we would link. + // + if (lib* l = pt->is_a ()) + pt = &link::link_member (*l, link::link_order (t)); - return true; + if (pt->is_a ()) // Can be liba{}. + return pt->in (t.weak_scope ()) ? pt : nullptr; + } + + return file_rule::filter (a, t, p); } match_result install:: @@ -39,7 +58,6 @@ namespace build // ones building this target. So first run link's match(). // match_result r (link::instance.match (a, t, hint)); - return r ? install::file_rule::match (a, t, "") : r; } -- cgit v1.1