• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# log-architecture.jam
2#
3# Copyright 2012 Steven Watanabe
4# Copyright 2013 Andrey Semashev
5#
6# Distributed under the Boost Software License Version 1.0. (See
7# accompanying file LICENSE_1_0.txt or copy at
8# http://www.boost.org/LICENSE_1_0.txt)
9
10import configure ;
11import project ;
12import path ;
13import property ;
14import feature ;
15
16local here = [ modules.binding $(__name__) ] ;
17
18feature.feature log-architecture : : free ;
19feature.feature log-address-model : : free ;
20feature.feature log-instruction-set : : free ;
21
22project.push-current [ project.current ] ;
23project.load [ path.join [ path.make $(here:D) ] ../../config/checks/architecture ] ;
24project.pop-current ;
25
26rule deduce-address-model ( properties * )
27{
28    local address_model = [ feature.get-values "address-model" : $(properties) ] ;
29    if $(address_model)
30    {
31        return <log-address-model>$(address_model) ;
32    }
33    else
34    {
35        if [ configure.builds /boost/architecture//32 : $(properties) : 32-bit ]
36        {
37            return <log-address-model>32 ;
38        }
39        else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ]
40        {
41            return <log-address-model>64 ;
42        }
43    }
44}
45
46rule address-model ( )
47{
48    return <conditional>@log-architecture.deduce-address-model ;
49}
50
51rule deduce-architecture ( properties * )
52{
53    local architecture = [ feature.get-values "architecture" : $(properties) ] ;
54    if $(architecture)
55    {
56        return <log-architecture>$(architecture) ;
57    }
58    else
59    {
60        if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ]
61        {
62            return <log-architecture>x86 ;
63        }
64        else if [ configure.builds /boost/architecture//arm : $(properties) : arm ]
65        {
66            return <log-architecture>arm ;
67        }
68        else if [ configure.builds /boost/architecture//mips1 : $(properties) : mips1 ]
69        {
70            return <log-architecture>mips1 ;
71        }
72        else if [ configure.builds /boost/architecture//power : $(properties) : power ]
73        {
74            return <log-architecture>power ;
75        }
76        else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ]
77        {
78            return <log-architecture>sparc ;
79        }
80    }
81}
82
83rule architecture ( )
84{
85    return <conditional>@log-architecture.deduce-architecture ;
86}
87
88rule deduce-instruction-set ( properties * )
89{
90    local result ;
91    local instruction_set = [ feature.get-values "instruction-set" : $(properties) ] ;
92
93    if $(instruction_set)
94    {
95        result = <log-instruction-set>$(instruction_set) ;
96    }
97    else
98    {
99        if <log-architecture>x86 in $(properties) && <log-address-model>32 in $(properties)
100        {
101            # 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.
102            result = <log-instruction-set>i686 ;
103        }
104    }
105
106    return $(result) ;
107}
108
109rule instruction-set ( )
110{
111    return <conditional>@log-architecture.deduce-instruction-set ;
112}
113