aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-23 06:43:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-23 06:43:00 +0200
commit3e9c6f5d168387e6e5d9240b9e0e201f661da913 (patch)
treef80cbea98a6e6ce582c4cce88c88679f3f8aaa6e /build2/cc/init.cxx
parent960b9a32557ad054707cc1540441057808db2d8f (diff)
Add cc.config in addition to cc
Diffstat (limited to 'build2/cc/init.cxx')
-rw-r--r--build2/cc/init.cxx75
1 files changed, 56 insertions, 19 deletions
diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx
index 63341d5..474db70 100644
--- a/build2/cc/init.cxx
+++ b/build2/cc/init.cxx
@@ -282,45 +282,82 @@ namespace build2
return true;
}
- bool
- init (scope& r,
- scope& b,
- const location& loc,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&)
+ // The cc module is an "alias" for c and cxx. Its intended use is to make
+ // sure that the C/C++ configuration is captured in an amalgamation rather
+ // than subprojects.
+ //
+ static inline bool
+ init_alias (tracer& trace,
+ const char* c,
+ const char* c_loaded,
+ const char* cxx,
+ const char* cxx_loaded,
+ scope& r,
+ scope& b,
+ const location& loc,
+ const variable_map& hints)
{
- tracer trace ("cc::init");
l5 ([&]{trace << "for " << b.out_path ();});
- // This module is an "alias" for c.config and cxx.config. Its intended
- // use is to make sure that the C/C++ configuration is captured in an
- // amalgamation rather than subprojects.
- //
// We want to order the loading to match what user specified on the
// command line (config.c or config.cxx). This way the first loaded
// module (with user-specified config.*) will hint the compiler to the
// second.
//
- bool lc (!cast_false<bool> (b["c.config.loaded"]));
- bool lp (!cast_false<bool> (b["cxx.config.loaded"]));
+ bool lc (!cast_false<bool> (b[c_loaded]));
+ bool lp (!cast_false<bool> (b[cxx_loaded]));
// If none of them are already loaded, load c first only if config.c
// is specified.
//
if (lc && lp && r["config.c"])
{
- load_module ("c.config", r, b, loc);
- load_module ("cxx.config", r, b, loc);
+ load_module (c, r, b, loc, false, hints);
+ load_module (cxx, r, b, loc, false, hints);
}
else
{
- if (lp) load_module ("cxx.config", r, b, loc);
- if (lc) load_module ("c.config", r, b, loc);
+ if (lp) load_module (cxx, r, b, loc, false, hints);
+ if (lc) load_module (c, r, b, loc, false, hints);
}
return true;
}
+
+ bool
+ config_init (scope& r,
+ scope& b,
+ const location& loc,
+ unique_ptr<module_base>&,
+ bool,
+ bool,
+ const variable_map& hints)
+ {
+ tracer trace ("cc::config_init");
+ return init_alias (trace,
+ "c.config", "c.config.loaded",
+ "cxx.config", "cxx.config.loaded",
+ r, b,
+ loc,
+ hints);
+ }
+
+ bool
+ init (scope& r,
+ scope& b,
+ const location& loc,
+ unique_ptr<module_base>&,
+ bool,
+ bool,
+ const variable_map& hints)
+ {
+ tracer trace ("cc::init");
+ return init_alias (trace,
+ "c", "c.loaded",
+ "cxx", "cxx.loaded",
+ r, b,
+ loc,
+ hints);
+ }
}
}