diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-11 15:14:19 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-11 15:14:19 +0200 |
commit | cd10a583ad1f3c299383c07fd8c6ccd6e3199e6b (patch) | |
tree | acf33fe1a9c03fadf8e96ea1b78a89ff7de95372 /libbuild2/cc/module.cxx | |
parent | 60a95915aa1fda93d308158416071ba39286d41c (diff) |
Add ${c,cxx}.lib_{poptions,libs,rpaths}() functions
These functions can be used to query library metadata for options and
libraries that should be used when compiling/linking dependent targets,
similar to how cc::{compile,link}_rule do it. With this support it should
be possible to more or less re-create their semantics in ad hoc recipes.
Diffstat (limited to 'libbuild2/cc/module.cxx')
-rw-r--r-- | libbuild2/cc/module.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libbuild2/cc/module.cxx b/libbuild2/cc/module.cxx index 4b4f5e2..14182a2 100644 --- a/libbuild2/cc/module.cxx +++ b/libbuild2/cc/module.cxx @@ -6,6 +6,7 @@ #include <iomanip> // left, setw() #include <libbuild2/scope.hxx> +#include <libbuild2/function.hxx> #include <libbuild2/diagnostics.hxx> #include <libbuild2/bin/target.hxx> @@ -677,6 +678,18 @@ namespace build2 { tracer trace (x, "init"); + context& ctx (rs.ctx); + + // Register the module function family if this is the first instance of + // this modules. + // + if (!function_family::defined (ctx.functions, x)) + { + function_family f (ctx.functions, x); + compile_rule::functions (f, x); + link_rule::functions (f, x); + } + // Load cc.core. Besides other things, this will load bin (core) plus // extra bin.* modules we may need. // @@ -798,13 +811,12 @@ namespace build2 bool s (tsys != "emscripten"); auto& r (rs.rules); + const compile_rule& cr (*this); + const link_rule& lr (*this); // We register for configure so that we detect unresolved imports // during configuration rather that later, e.g., during update. // - const compile_rule& cr (*this); - const link_rule& lr (*this); - r.insert<obje> (perform_update_id, x_compile, cr); r.insert<obje> (perform_clean_id, x_compile, cr); r.insert<obje> (configure_update_id, x_compile, cr); |