blob: d13a0ff36b08a733b6773e35fb2401c83caa67b7 (
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
|
// file : build2/cc/utility.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
namespace build2
{
namespace cc
{
inline otype
compile_type (const target& t, bool mod)
{
using namespace bin;
return
t.is_a (mod ? bmie::static_type : obje::static_type) ? otype::e :
t.is_a (mod ? bmia::static_type : obja::static_type) ? otype::a :
otype::s;
}
inline ltype
link_type (const target& t)
{
using namespace bin;
bool u (false);
otype o (
t.is_a<exe> () || (u = t.is_a<libue> ()) ? otype::e :
t.is_a<liba> () || (u = t.is_a<libua> ()) ? otype::a :
t.is_a<libs> () || (u = t.is_a<libus> ()) ? otype::s :
static_cast<otype> (0xFF));
return ltype {o, u};
}
inline compile_target_types
compile_types (otype t)
{
using namespace bin;
const target_type* o (nullptr);
const target_type* m (nullptr);
switch (t)
{
case otype::e: o = &obje::static_type; m = &bmie::static_type; break;
case otype::a: o = &obja::static_type; m = &bmia::static_type; break;
case otype::s: o = &objs::static_type; m = &bmis::static_type; break;
}
return compile_target_types {*o, *m};
}
}
}
|