From e2ba7fa123213fcc5673119b8d993d7967a1fb24 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 7 Sep 2017 18:09:44 +0200 Subject: Implement {c,cxx}.guess modules These can be loaded before {c,cxx} to guess the compiler. Based on this information we can then choose the standard, experimental features, etc. For example: using cxx.guess if ($cxx.id == 'clang') cxx.features.modules = false cxx.std = experimental using cxx --- build2/cc/module.hxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'build2/cc/module.hxx') diff --git a/build2/cc/module.hxx b/build2/cc/module.hxx index c34b0e5..08f573b 100644 --- a/build2/cc/module.hxx +++ b/build2/cc/module.hxx @@ -29,6 +29,15 @@ namespace build2 explicit config_module (config_data&& d) : config_data (move (d)) {} + // We split the configuration process into into two parts: guessing the + // compiler information and the actual configuration. This allows one to + // adjust configuration (say the standard or enabled experimental + // features) base on the compiler information by first loading the + // guess module. + // + void + guess (scope&, const location&, const variable_map&); + void init (scope&, const location&, const variable_map&); @@ -40,8 +49,7 @@ namespace build2 translate_std (const compiler_info&, scope&, const string*) const = 0; strings tstd; - - compiler_id::value_type cid; + compiler_info ci; // Note: some members are moved from. private: dir_paths @@ -49,6 +57,9 @@ namespace build2 dir_paths msvc_library_search_paths (process_path&, scope&) const; // msvc.cxx + + private: + bool new_; // See guess() and init() for details. }; class module: public module_base, public virtual common, -- cgit v1.1