]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Distributed under the Boost Software License, Version 1.0. |
2 | # (See accompanying file LICENSE_1_0.txt | |
3 | # or copy at http://www.boost.org/LICENSE_1_0.txt) | |
4 | ||
5 | # This is a generic 'clang' toolset. Depending on the current system, it | |
6 | # forwards either to 'clang-linux' or 'clang-darwin' modules. | |
7 | ||
8 | import feature ; | |
9 | import os ; | |
10 | import toolset ; | |
11fdf7f2 TL |
11 | import sequence ; |
12 | import regex ; | |
13 | import set ; | |
7c673cae FG |
14 | |
15 | feature.extend toolset : clang ; | |
16 | feature.subfeature toolset clang : platform : : propagated link-incompatible ; | |
17 | ||
18 | rule init ( * : * ) | |
19 | { | |
92f5a8d4 TL |
20 | if $(1) = win |
21 | { | |
22 | toolset.using clang-win : | |
23 | $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; | |
24 | } | |
25 | else if [ os.name ] = MACOSX | |
7c673cae FG |
26 | { |
27 | toolset.using clang-darwin : | |
28 | $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; | |
29 | } | |
30 | else | |
31 | { | |
32 | toolset.using clang-linux : | |
33 | $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; | |
34 | } | |
35 | } | |
11fdf7f2 TL |
36 | |
37 | ||
38 | local rule cxxstd-flags ( toolset : condition * : options * ) | |
39 | { | |
40 | toolset.flags $(toolset).compile.c++ OPTIONS $(condition) : $(options) : unchecked ; | |
41 | toolset.flags $(toolset).link OPTIONS $(condition) : $(options) : unchecked ; | |
42 | } | |
43 | ||
44 | local rule version-ge ( lhs : rhs ) | |
45 | { | |
46 | lhs = [ regex.split $(lhs) "[.]" ] ; | |
47 | rhs = [ regex.split $(rhs) "[.]" ] ; | |
48 | return [ sequence.compare $(rhs) : $(lhs) : numbers.less ] ; | |
49 | } | |
50 | ||
51 | # Version specific flags | |
52 | rule init-cxxstd-flags ( toolset : condition * : version ) | |
53 | { | |
54 | local cxxstd = [ feature.values <cxxstd> ] ; | |
55 | local dialects = [ feature.values <cxxstd-dialect> ] ; | |
56 | dialects = [ set.difference $(dialects) : gnu iso ] ; | |
57 | local std ; | |
58 | if [ version-ge $(version) : 3.5 ] { std = 1z ; } | |
59 | else if [ version-ge $(version) : 3.4 ] { std = 14 ; } | |
60 | else if [ version-ge $(version) : 3.3 ] { std = 11 ; } | |
61 | else { std = 03 ; } | |
62 | cxxstd-flags $(toolset) : $(condition)/<cxxstd>latest/<cxxstd-dialect>iso : -std=c++$(std) ; | |
63 | cxxstd-flags $(toolset) : $(condition)/<cxxstd>latest/<cxxstd-dialect>gnu : -std=gnu++$(std) ; | |
64 | cxxstd-flags $(toolset) : $(condition)/<cxxstd>latest/<cxxstd-dialect>$(dialects) : -std=c++$(std) ; | |
65 | } |