summaryrefslogtreecommitdiff
path: root/libs/log/build/log-architecture.jam
blob: 785dda0f5c6078af5db1429ea523d991c23abfa0 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# log-architecture.jam
#
# Copyright 2012 Steven Watanabe
# Copyright 2013 Andrey Semashev
#
# Distributed under the Boost Software License Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

import configure ;
import project ;
import path ;
import property ;
import feature ;

local here = [ modules.binding $(__name__) ] ;

feature.feature log-architecture : : free ;
feature.feature log-address-model : : free ;
feature.feature log-instruction-set : : free ;

project.push-current [ project.current ] ;
project.load [ path.join [ path.make $(here:D) ] ../../config/checks/architecture ] ;
project.pop-current ;

rule deduce-address-model ( properties * )
{
    local address_model = [ feature.get-values "address-model" : $(properties) ] ;
    if $(address_model)
    {
        return <log-address-model>$(address_model) ;
    }
    else
    {
        if [ configure.builds /boost/architecture//32 : $(properties) : 32-bit ]
        {
            return <log-address-model>32 ;
        }
        else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ]
        {
            return <log-address-model>64 ;
        }
    }
}

rule address-model ( )
{
    return <conditional>@log-architecture.deduce-address-model ;
}

rule deduce-architecture ( properties * )
{
    local architecture = [ feature.get-values "architecture" : $(properties) ] ;
    if $(architecture)
    {
        return <log-architecture>$(architecture) ;
    }
    else
    {
        if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ]
        {
            return <log-architecture>x86 ;
        }
        else if [ configure.builds /boost/architecture//arm : $(properties) : arm ]
        {
            return <log-architecture>arm ;
        }
        else if [ configure.builds /boost/architecture//mips1 : $(properties) : mips1 ]
        {
            return <log-architecture>mips1 ;
        }
        else if [ configure.builds /boost/architecture//power : $(properties) : power ]
        {
            return <log-architecture>power ;
        }
        else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ]
        {
            return <log-architecture>sparc ;
        }
    }
}

rule architecture ( )
{
    return <conditional>@log-architecture.deduce-architecture ;
}

rule deduce-instruction-set ( properties * )
{
    local result ;
    local instruction_set = [ feature.get-values "instruction-set" : $(properties) ] ;

    if $(instruction_set)
    {
        result = <log-instruction-set>$(instruction_set) ;
    }
    else
    {
        if <log-architecture>x86 in $(properties) && <log-address-model>32 in $(properties)
        {
            # We build for Pentium Pro and later CPUs by default. This is used as the target in many Linux distributions, and Windows and OS X also seem to not support older CPUs.
            result = <log-instruction-set>i686 ;
        }
    }

    return $(result) ;
}

rule instruction-set ( )
{
    return <conditional>@log-architecture.deduce-instruction-set ;
}