aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-29 10:29:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-29 10:29:59 +0200
commit2b922df93fcea9e3fad8e24b39c7fe579085d3ac (patch)
treec2c8171427fb960b808f0446e30651bb0b9bfe08
parent1ece46928dcd77d47b4875ac7edadb0c6d30c959 (diff)
Refine utility library semantics with "see through" theme
-rw-r--r--build/root.build2
-rw-r--r--build2/buildfile4
-rw-r--r--build2/cc/compile.cxx26
-rw-r--r--build2/cc/link.cxx10
4 files changed, 28 insertions, 14 deletions
diff --git a/build/root.build b/build/root.build
index 0d887ec..e6ca7a8 100644
--- a/build/root.build
+++ b/build/root.build
@@ -11,6 +11,8 @@ ixx{*}: extension = ixx
txx{*}: extension = txx
cxx{*}: extension = cxx
+cxx.poptions =+ "-I$out_root" "-I$src_root"
+
# Load the cli module but only if it's available. This way a distribution
# that includes pre-generated files can be built without installing cli.
# This is also the reason why we need to explicitly spell out individual
diff --git a/build2/buildfile b/build2/buildfile
index 7514984..8c33828 100644
--- a/build2/buildfile
+++ b/build2/buildfile
@@ -10,10 +10,6 @@ libu{b}: {hxx ixx txx cxx}{** -b -b-options -version} \
{hxx ixx cxx}{b-options} {hxx}{version} \
$libs
-cxx.poptions =+ "-I$out_root" "-I$src_root"
-libu{b}: cxx.export.poptions = "-I$out_root" "-I$src_root"
-libu{b}: cxx.export.libs = $libs
-
hxx{version}: in{version} $src_root/file{manifest}
hxx{version}: dist = true
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index c0fc55b..62be69a 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -258,13 +258,18 @@ namespace build2
action act,
linfo li) const
{
+ // See through utility libraries.
+ //
+ auto imp = [] (const file& l, bool la) {return la && l.is_a<libux> ();};
+
auto opt = [&args, this] (
const file& l, const string& t, bool com, bool exp)
{
// Note that in our model *.export.poptions are always "interface",
// even if set on liba{}/libs{}, unlike loptions.
//
- assert (exp);
+ if (!exp) // Ignore libux.
+ return;
const variable& var (
com
@@ -276,6 +281,7 @@ namespace build2
// In case we don't have the "small function object" optimization.
//
+ const function<bool (const file&, bool)> impf (imp);
const function<void (const file&, const string&, bool, bool)> optf (opt);
for (prerequisite_member p: group_prerequisite_members (act, t))
@@ -295,7 +301,7 @@ namespace build2
process_libraries (act, bs, li, sys_lib_dirs,
pt->as<file> (), a, 0, // Hack: lflags unused.
- nullptr, nullptr, optf);
+ impf, nullptr, optf);
}
}
}
@@ -307,10 +313,13 @@ namespace build2
action act,
linfo li) const
{
+ auto imp = [] (const file& l, bool la) {return la && l.is_a<libux> ();};
+
auto opt = [&cs, this] (
const file& l, const string& t, bool com, bool exp)
{
- assert (exp);
+ if (!exp)
+ return;
const variable& var (
com
@@ -322,6 +331,7 @@ namespace build2
// The same logic as in append_lib_options().
//
+ const function<bool (const file&, bool)> impf (imp);
const function<void (const file&, const string&, bool, bool)> optf (opt);
for (prerequisite_member p: group_prerequisite_members (act, t))
@@ -339,7 +349,7 @@ namespace build2
process_libraries (act, bs, li, sys_lib_dirs,
pt->as<file> (), a, 0, // Hack: lflags unused.
- nullptr, nullptr, optf);
+ impf, nullptr, optf);
}
}
}
@@ -354,10 +364,13 @@ namespace build2
action act,
linfo li) const
{
+ auto imp = [] (const file& l, bool la) {return la && l.is_a<libux> ();};
+
auto opt = [&m, this] (
const file& l, const string& t, bool com, bool exp)
{
- assert (exp);
+ if (!exp)
+ return;
const variable& var (
com
@@ -369,6 +382,7 @@ namespace build2
// The same logic as in append_lib_options().
//
+ const function<bool (const file&, bool)> impf (imp);
const function<void (const file&, const string&, bool, bool)> optf (opt);
for (prerequisite_member p: group_prerequisite_members (act, t))
@@ -386,7 +400,7 @@ namespace build2
process_libraries (act, bs, li, sys_lib_dirs,
pt->as<file> (), a, 0, // Hack: lflags unused.
- nullptr, nullptr, optf);
+ impf, nullptr, optf);
}
}
}
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index 1a5424b..25b6a28 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -1038,11 +1038,12 @@ namespace build2
return;
}
- auto imp = [for_install] (const file&, bool la)
+ auto imp = [for_install] (const file& l, bool la)
{
// If we are not installing, then we only need to rpath interface
- // libraries (they will include rpath's for their implementations).
- // Otherwise, we have to do this recursively.
+ // libraries (they will include rpath's for their implementations)
+ // Otherwise, we have to do this recursively. In both cases we also
+ // want to see through utility libraries.
//
// The rpath-link part is tricky: ideally we would like to get only
// implementations and only of shared libraries. We are not interested
@@ -1052,7 +1053,8 @@ namespace build2
// we are going to rpath-link all of them which should be harmless
// except for some noise on the command line.
//
- return for_install ? !la : false;
+ //
+ return (for_install ? !la : false) || l.is_a<libux> ();
};
// Package the data to keep within the 2-pointer small std::function