Optimize multiple module loads
This commit is contained in:
parent
19cd67c1fa
commit
f18022d006
@ -19,61 +19,64 @@ namespace build2
|
|||||||
init (scope& rs,
|
init (scope& rs,
|
||||||
scope& bs,
|
scope& bs,
|
||||||
const location& l,
|
const location& l,
|
||||||
bool,
|
bool first,
|
||||||
bool,
|
bool,
|
||||||
module_init_extra&)
|
module_init_extra&)
|
||||||
{
|
{
|
||||||
tracer trace ("autoconf::init");
|
tracer trace ("autoconf::init");
|
||||||
l5 ([&]{trace << "for " << bs;});
|
l5 ([&]{trace << "for " << bs;});
|
||||||
|
|
||||||
// Load in.base (in.* variables, in{} target type).
|
if (first)
|
||||||
//
|
|
||||||
load_module (rs, rs, "in.base", l);
|
|
||||||
|
|
||||||
// Enter variables.
|
|
||||||
//
|
|
||||||
{
|
{
|
||||||
// All the variables we enter are qualified so go straight for the
|
// Load in.base (in.* variables, in{} target type).
|
||||||
// public variable pool.
|
|
||||||
//
|
//
|
||||||
auto& vp (rs.var_pool (true /* public */));
|
load_module (rs, rs, "in.base", l);
|
||||||
|
|
||||||
// Configuration file flavor. Valid values are `autoconf` (default),
|
// Enter variables.
|
||||||
// `cmake`, and `meson`.
|
|
||||||
//
|
//
|
||||||
vp.insert<string> ("autoconf.flavor");
|
{
|
||||||
|
// All the variables we enter are qualified so go straight for the
|
||||||
|
// public variable pool.
|
||||||
|
//
|
||||||
|
auto& vp (rs.var_pool (true /* public */));
|
||||||
|
|
||||||
// Built-in checks prefix.
|
// Configuration file flavor. Valid values are `autoconf` (default),
|
||||||
//
|
// `cmake`, and `meson`.
|
||||||
vp.insert<string> ("autoconf.prefix");
|
//
|
||||||
|
vp.insert<string> ("autoconf.flavor");
|
||||||
|
|
||||||
// Substitution map (an alias for in.substitutions).
|
// Built-in checks prefix.
|
||||||
//
|
//
|
||||||
vp.insert_alias (*vp.find ("in.substitutions"),
|
vp.insert<string> ("autoconf.prefix");
|
||||||
"autoconf.substitutions");
|
|
||||||
|
|
||||||
// Alias map. The key is the new name and the value is the aliased
|
// Substitution map (an alias for in.substitutions).
|
||||||
// (old) name.
|
//
|
||||||
|
vp.insert_alias (*vp.find ("in.substitutions"),
|
||||||
|
"autoconf.substitutions");
|
||||||
|
|
||||||
|
// Alias map. The key is the new name and the value is the aliased
|
||||||
|
// (old) name.
|
||||||
|
//
|
||||||
|
// Note that this map is only consulted when resolving build-in
|
||||||
|
// checks and the names should include the prefix, if any.
|
||||||
|
//
|
||||||
|
vp.insert<map<string, string>> ("autoconf.aliases");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register the rule.
|
||||||
//
|
//
|
||||||
// Note that this map is only consulted when resolving build-in checks
|
// @@ TODO: this will be ambiguous, for example, version.in rule. Note
|
||||||
// and the names should include the prefix, if any.
|
// also that if we register it for cc{}, then it will always take
|
||||||
|
// precedence over version.in, which is probably something we don't
|
||||||
|
// want. In fact, we would have liked it to be of lower precedence
|
||||||
|
// since version.in will only match if there is dependency on
|
||||||
|
// manifest.
|
||||||
//
|
//
|
||||||
vp.insert<map<string, string>> ("autoconf.aliases");
|
rs.insert_rule<file> (perform_update_id, "autoconf.in", rule_);
|
||||||
|
rs.insert_rule<file> (perform_clean_id, "autoconf.in", rule_);
|
||||||
|
rs.insert_rule<file> (configure_update_id, "autoconf.in", rule_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the rule.
|
|
||||||
//
|
|
||||||
// @@ TODO: this will be ambiguous, for example, version.in rule. Note
|
|
||||||
// also that if we register it for cc{}, then it will always take
|
|
||||||
// precedence over version.in, which is probably something we don't
|
|
||||||
// want. In fact, we would have liked it to be of lower precedence
|
|
||||||
// since version.in will only match if there is dependency on
|
|
||||||
// manifest.
|
|
||||||
//
|
|
||||||
rs.insert_rule<file> (perform_update_id, "autoconf.in", rule_);
|
|
||||||
rs.insert_rule<file> (perform_clean_id, "autoconf.in", rule_);
|
|
||||||
rs.insert_rule<file> (configure_update_id, "autoconf.in", rule_);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user