From 4bdf53837e010073de802070d4e6087410662d3e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 24 Aug 2019 17:41:30 +0300 Subject: Move cc build system module to separate library --- libbuild2/cc/module.hxx | 103 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 libbuild2/cc/module.hxx (limited to 'libbuild2/cc/module.hxx') diff --git a/libbuild2/cc/module.hxx b/libbuild2/cc/module.hxx new file mode 100644 index 0000000..43670c3 --- /dev/null +++ b/libbuild2/cc/module.hxx @@ -0,0 +1,103 @@ +// file : libbuild2/cc/module.hxx -*- C++ -*- +// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef LIBBUILD2_CC_MODULE_HXX +#define LIBBUILD2_CC_MODULE_HXX + +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#include + +namespace build2 +{ + namespace cc + { + struct compiler_info; + + class LIBBUILD2_CC_SYMEXPORT config_module: public module_base, + public virtual config_data + { + public: + 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&); + + // Translate the x.std value (if any) to the standard-selecting + // option(s) (if any). May also check/set x.features.* variables on the + // root scope. + // + virtual strings + translate_std (const compiler_info&, scope&, const string*) const = 0; + + strings tstd; + size_t sys_lib_dirs_extra; // First extra path (size if none). + size_t sys_inc_dirs_extra; // First extra path (size if none). + + const compiler_info* ci_; + + private: + // Defined in gcc.cxx. + // + dir_paths + gcc_header_search_paths (const process_path&, scope&) const; + + dir_paths + gcc_library_search_paths (const process_path&, scope&) const; + + // Defined in msvc.cxx. + // + dir_paths + msvc_header_search_paths (const process_path&, scope&) const; + + dir_paths + msvc_library_search_paths (const process_path&, scope&) const; + + private: + bool new_; // See guess() and init() for details. + }; + + class LIBBUILD2_CC_SYMEXPORT module: public module_base, + public virtual common, + link_rule, + compile_rule, + install_rule, + libux_install_rule + { + public: + explicit + module (data&& d) + : common (move (d)), + link_rule (move (d)), + compile_rule (move (d)), + install_rule (move (d), *this), + libux_install_rule (move (d), *this) {} + + void + init (scope&, const location&, const variable_map&); + }; + } +} + +#endif // LIBBUILD2_CC_MODULE_HXX -- cgit v1.1