aboutsummaryrefslogtreecommitdiff
path: root/build/cxx/install.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-12 13:46:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-12 13:46:07 +0200
commitad4120afce8c7bc4001fc0173a0ff7611ec0198d (patch)
treeebbc31d03feda96560df437247b63206489a1139 /build/cxx/install.cxx
parentdd4a389117812f0d3b45473d87214d67d0cb4a3a (diff)
Implement installation of prerequisite shared libraries
Diffstat (limited to 'build/cxx/install.cxx')
-rw-r--r--build/cxx/install.cxx34
1 files changed, 26 insertions, 8 deletions
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<exe> ())
+ {
+ // Don't install executable's prerequisite headers.
+ //
+ if (p.is_a<hxx> () || p.is_a<ixx> () || p.is_a<txx> () || p.is_a<h> ())
+ 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<exe> () &&
- (p.is_a<hxx> () || p.is_a<ixx> () || p.is_a<txx> () || p.is_a<h> ()))
- return false;
+ if ((t.is_a<exe> () || t.is_a<libso> ()) &&
+ (p.is_a<lib> () || p.is_a<libso> ()))
+ {
+ target* pt (&p.search ());
+
+ // If this is the lib{} group, pick a member which we would link.
+ //
+ if (lib* l = pt->is_a<lib> ())
+ pt = &link::link_member (*l, link::link_order (t));
- return true;
+ if (pt->is_a<libso> ()) // 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;
}