aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-02-11 09:09:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-02-11 09:09:43 +0200
commit5a0dab628bd807f208a2201b19796410135d1787 (patch)
tree25c10da8162b5ef6b252f8ad9e678b32904adae7 /libbuild2/cc
parent635f75c7b3fbb6053059827c73a4df52733850e0 (diff)
Use lib{} group for installed libraries in make_header_sidebuild()
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/compile-rule.cxx41
1 files changed, 18 insertions, 23 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx
index bd4b481..0c17421 100644
--- a/libbuild2/cc/compile-rule.cxx
+++ b/libbuild2/cc/compile-rule.cxx
@@ -6094,7 +6094,7 @@ namespace build2
// Note that because libraries are not in prerequisite_targets, we have
// to go through prerequisites, similar to append_library_options().
//
- const file* lt (nullptr);
+ const target* lt (nullptr); // Can be lib{}.
{
// Note that any such library would necessarily be an interface
// dependency so we never need to go into implementations.
@@ -6105,9 +6105,9 @@ namespace build2
//
struct data
{
- action a;
- const file& ht;
- const file*& lt;
+ action a;
+ const file& ht;
+ const target*& lt;
} d {a, ht, lt};
auto lib = [&d] (const target* const* lc,
@@ -6120,7 +6120,7 @@ namespace build2
if (d.lt != nullptr)
return;
- const file* l (lc != nullptr ? &(*lc)->as<file> () : nullptr);
+ const target* l (lc != nullptr ? *lc : nullptr); // Can be lib{}.
if (l == nullptr)
return;
@@ -6137,20 +6137,6 @@ namespace build2
const auto& pts (l->prerequisite_targets[d.a]);
if (find (pts.begin (), pts.end (), &d.ht) != pts.end ())
d.lt = l;
-
- // This is a bit of a hack: for the installed case the library
- // prerequisites are matched by file_rule which won't pick the
- // liba/libs{} member (naturally) but will just match the lib{}
- // group. So we also check the group's prerequisite targets. This
- // should be harmless since for now all the importable headers are
- // specified on the group.
- //
- if (d.lt == nullptr && l->group != nullptr)
- {
- const auto& pts (l->group->prerequisite_targets[d.a]);
- if (find (pts.begin (), pts.end (), &d.ht) != pts.end ())
- d.lt = l;
- }
};
for (prerequisite_member p: group_prerequisite_members (a, t))
@@ -6171,11 +6157,18 @@ namespace build2
(la = (f = pt->is_a<libux> ())) ||
( (f = pt->is_a<libs> ())))
{
+ // Note that we are requesting process_libraries() to not pick
+ // the liba/libs{} member of the installed libraries and return
+ // the lib{} group itself instead. This is because, for the
+ // installed case, the library prerequisites (both headers and
+ // interface dependency libraries) are matched by file_rule
+ // which won't pick the liba/libs{} member (naturally) but will
+ // just match the lib{} group.
+ //
process_libraries (
- a, bs, li, sys_lib_dirs,
+ a, bs, nullopt, sys_lib_dirs,
*f, la, 0, // lflags unused.
- imp, lib, nullptr,
- true);
+ imp, lib, nullptr, true /* self */);
}
}
}
@@ -6209,7 +6202,9 @@ namespace build2
//
const target_type& tt (
compile_types (
- lt != nullptr ? link_type (*lt).type : li.type).hbmi);
+ lt != nullptr && !lt->is_a<lib> ()
+ ? link_type (*lt).type
+ : li.type).hbmi);
if (const file* bt = bs.ctx.targets.find<file> (
tt,