aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/module.hxx
blob: a6a1115c43ba183e7df41eb3157c5327e98618ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// file      : build2/cc/module.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BUILD2_CC_MODULE_HXX
#define BUILD2_CC_MODULE_HXX

#include <build2/types.hxx>
#include <build2/utility.hxx>

#include <build2/module.hxx>
#include <build2/variable.hxx>

#include <build2/cc/common.hxx>

#include <build2/cc/compile.hxx>
#include <build2/cc/link.hxx>
#include <build2/cc/install.hxx>

namespace build2
{
  namespace cc
  {
    struct compiler_info;

    class config_module: public module_base, public virtual config_data
    {
    public:
      explicit
      config_module (config_data&& d) : config_data (move (d)) {}

      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;

      compiler_id::value_type cid;

    private:
      dir_paths
      gcc_library_search_paths (process_path&, scope&) const; // gcc.cxx

      dir_paths
      msvc_library_search_paths (process_path&, scope&) const; // msvc.cxx
    };

    class module: public module_base, protected virtual common,
                  link,
                  compile,
                  file_install,
                  alias_install
    {
    public:
      explicit
      module (data&& d)
          : common (move (d)),
            link (move (d)),
            compile (move (d)),
            file_install (move (d), *this),
            alias_install (move (d), *this) {}

      void
      init (scope&, const location&, const variable_map&);
    };
  }
}

#endif // BUILD2_CC_MODULE_HXX