aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-01-04 15:35:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-01-05 15:10:01 +0200
commit76de594667b370094f5da5c0871c155d788d135e (patch)
tree610d67fc2350a4fdeaa2de7b6583f5da9067bc24 /build2/cc/init.cxx
parentd6427addaf7de41d401dd2a871b4789022e5f7cf (diff)
Initial support for c/cxx runtime/stdlib detection
Diffstat (limited to 'build2/cc/init.cxx')
-rw-r--r--build2/cc/init.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx
index b49de15..258e071 100644
--- a/build2/cc/init.cxx
+++ b/build2/cc/init.cxx
@@ -100,6 +100,11 @@ namespace build2
v.insert<string> ("config.cc.pattern");
v.insert<target_triplet> ("config.cc.target");
+ // Compiler runtime and C standard library.
+ //
+ v.insert<string> ("cc.runtime");
+ v.insert<string> ("cc.stdlib");
+
// Target type, for example, "C library" or "C++ library". Should be set
// on the target by the matching rule to the name of the module (e.g.,
// "c", "cxx"). Currenly only set for libraries and is used to decide
@@ -145,7 +150,7 @@ namespace build2
unique_ptr<module_base>&,
bool first,
bool,
- const variable_map& hints)
+ const variable_map& h)
{
tracer trace ("cc::core_guess_init");
l5 ([&]{trace << "for " << rs.out_path ();});
@@ -162,9 +167,8 @@ namespace build2
{
// These values must be hinted.
//
- rs.assign<string> ("cc.id") = cast<string> (hints["config.cc.id"]);
- rs.assign<string> ("cc.hinter") =
- cast<string> (hints["config.cc.hinter"]);
+ rs.assign<string> ("cc.id") = cast<string> (h["config.cc.id"]);
+ rs.assign<string> ("cc.hinter") = cast<string> (h["config.cc.hinter"]);
}
// config.cc.target
@@ -172,7 +176,7 @@ namespace build2
{
// This value must be hinted.
//
- const auto& t (cast<target_triplet> (hints["config.cc.target"]));
+ const auto& t (cast<target_triplet> (h["config.cc.target"]));
// Also enter as cc.target.{cpu,vendor,system,version,class} for
// convenience of access.
@@ -192,9 +196,15 @@ namespace build2
// This value could be hinted.
//
rs.assign<string> ("cc.pattern") =
- cast_empty<string> (hints["config.cc.pattern"]);
+ cast_empty<string> (h["config.cc.pattern"]);
}
+ // cc.runtime
+ // cc.stdlib
+ //
+ rs.assign ("cc.runtime") = cast<string> (h["cc.runtime"]);
+ rs.assign ("cc.stdlib") = cast<string> (h["cc.stdlib"]);
+
return true;
}