aboutsummaryrefslogtreecommitdiff
path: root/build/native.cxx
blob: 42b6cf346c7e1c1eaa16c50a0765000611559af2 (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
// file      : build/native.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#include <build/native>

using namespace std;

namespace build
{
  const target_type obja::static_type
  {
    typeid (obja),
    "obja",
    &file::static_type,
    &member_target_factory<obja, obj>,
    file::static_type.search
  };

  const target_type objso::static_type
  {
    typeid (objso),
    "objso",
    &file::static_type,
    &member_target_factory<objso, obj>,
    file::static_type.search
  };

  static target*
  obj_factory (dir_path d, string n, const string* e)
  {
    target* a (targets.find (obja::static_type, d, n));
    target* so (targets.find (objso::static_type, d, n));

    obj* t (new obj (move (d), move (n), e));

    if ((t->a = static_cast<obja*> (a)))
      a->group = t;

    if ((t->so = static_cast<objso*> (so)))
      so->group = t;

    return t;
  }

  const target_type obj::static_type
  {
    typeid (obj),
    "obj",
    &target::static_type,
    &obj_factory,
    target::static_type.search
  };

  const target_type exe::static_type
  {
    typeid (exe),
    "exe",
    &file::static_type,
    &target_factory<exe>,
    file::static_type.search
  };

  const target_type lib::static_type
  {
    typeid (lib),
    "lib",
    &file::static_type,
    &target_factory<lib>,
    file::static_type.search
  };
}