From 0d34b2f7692aba066213c038b810623c216b6980 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 27 Nov 2017 11:42:35 +0200 Subject: Add {c,cxx}.class variables Compiler class describes a set of compilers that follow more or less the same command line interface. Compilers that don't belong to any of the existing classes are in classes of their own (say, Sun CC would be on its own if we were to support it). Currently defined compiler classes: gcc gcc, clang, clang-apple, icc (on non-Windows) msvc msvc, clang-cl, icc (Windows) --- build2/cc/guess.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'build2/cc/guess.cxx') diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx index da5be97..627283f 100644 --- a/build2/cc/guess.cxx +++ b/build2/cc/guess.cxx @@ -18,7 +18,7 @@ namespace build2 value () const -> value_type { if (type == "gcc") return gcc; - if (type == "clang") return clang; + if (type == "clang") return variant.empty () ? clang : clang_apple; if (type == "msvc") return msvc; if (type == "icc") return icc; @@ -26,6 +26,17 @@ namespace build2 return gcc; } + string + to_string (compiler_class cl) + { + switch (cl) + { + case compiler_class::gcc: return "gcc"; + case compiler_class::msvc: return "msvc"; + } + return string (); // Never reached. + } + // Pre-guess the compiler type based on the compiler executable name. // Return empty string if can't make a guess (for example, because the // compiler name is a generic 'c++'). Note that it only guesses the type, @@ -501,6 +512,7 @@ namespace build2 return compiler_info { move (gr.path), move (gr.id), + compiler_class::gcc, move (v), move (gr.signature), move (gr.checksum), // Calculated on whole -v output. @@ -617,6 +629,7 @@ namespace build2 return compiler_info { move (gr.path), move (gr.id), + compiler_class::gcc, move (v), move (gr.signature), move (gr.checksum), // Calculated on whole -v output. @@ -836,6 +849,7 @@ namespace build2 return compiler_info { move (gr.path), move (gr.id), + compiler_class::gcc, //@@ TODO: msvc on Windows? move (v), move (gr.signature), cs.string (), @@ -1059,6 +1073,7 @@ namespace build2 return compiler_info { move (gr.path), move (gr.id), + compiler_class::msvc, move (v), move (gr.signature), cs.string (), @@ -1107,6 +1122,7 @@ namespace build2 break; } case compiler_id::clang: + case compiler_id::clang_apple: { assert (id.variant.empty () || id.variant == "apple"); r = guess_clang (xl, xc, c_coptions, x_coptions, move (gr)); -- cgit v1.1