]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright Vladimir Prus 2004. |
2 | # Copyright Noel Belcourt 2007. | |
3 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 TL |
4 | # (See accompanying file LICENSE.txt |
5 | # or copy at https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae FG |
6 | |
7 | import intel ; | |
8 | import feature : feature ; | |
9 | import os ; | |
10 | import toolset ; | |
11 | import toolset : flags ; | |
12 | import gcc ; | |
13 | import common ; | |
14 | import errors ; | |
15 | import generators ; | |
16 | ||
17 | feature.extend-subfeature toolset intel : platform : darwin ; | |
18 | ||
1e59de90 TL |
19 | toolset.inherit-generators intel-darwin |
20 | <toolset>intel <toolset-intel:platform>darwin | |
21 | : gcc | |
7c673cae FG |
22 | # Don't inherit PCH generators. They were not tested, and probably |
23 | # don't work for this compiler. | |
24 | : gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch | |
25 | ; | |
26 | ||
27 | generators.override intel-darwin.prebuilt : builtin.lib-generator ; | |
28 | generators.override intel-darwin.prebuilt : builtin.prebuilt ; | |
29 | generators.override intel-darwin.searched-lib-generator : searched-lib-generator ; | |
30 | ||
31 | toolset.inherit-rules intel-darwin : gcc ; | |
1e59de90 TL |
32 | toolset.inherit-flags intel-darwin : gcc |
33 | : <inlining>off <inlining>on <inlining>full <optimization>space | |
7c673cae | 34 | <warnings>off <warnings>all <warnings>on |
20effc67 TL |
35 | <warnings>extra <warnings>pedantic |
36 | <warnings-as-errors>off <warnings-as-errors>on | |
7c673cae FG |
37 | <architecture>x86/<address-model>32 |
38 | <architecture>x86/<address-model>64 | |
39 | ; | |
1e59de90 | 40 | |
7c673cae FG |
41 | if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] |
42 | { | |
43 | .debug-configuration = true ; | |
44 | } | |
1e59de90 | 45 | |
7c673cae FG |
46 | # Initializes the intel-darwin toolset |
47 | # version in mandatory | |
92f5a8d4 | 48 | # name (default icc) is used to invoke the specified intel compiler |
7c673cae FG |
49 | # compile and link options allow you to specify addition command line options for each version |
50 | rule init ( version ? : command * : options * ) | |
51 | { | |
52 | local condition = [ common.check-init-parameters intel-darwin | |
53 | : version $(version) ] ; | |
1e59de90 TL |
54 | |
55 | command = [ common.get-invocation-command intel-darwin : icc | |
7c673cae FG |
56 | : $(command) : /opt/intel_cc_80/bin ] ; |
57 | ||
58 | common.handle-options intel-darwin : $(condition) : $(command) : $(options) ; | |
59 | ||
7c673cae FG |
60 | # handle <library-path> |
61 | # local library-path = [ feature.get-values <library-path> : $(options) ] ; | |
62 | # flags intel-darwin.link USER_OPTIONS $(condition) : [ feature.get-values <dll-path> : $(options) ] ; | |
63 | ||
64 | local root = [ feature.get-values <root> : $(options) ] ; | |
65 | local bin ; | |
66 | if $(command) || $(root) | |
67 | { | |
68 | bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; | |
69 | root ?= $(bin:D) ; | |
1e59de90 | 70 | |
7c673cae FG |
71 | if $(root) |
72 | { | |
73 | # Libraries required to run the executable may be in either | |
1e59de90 TL |
74 | # $(root)/lib (10.1 and earlier) |
75 | # or | |
7c673cae FG |
76 | # $(root)/lib/architecture-name (11.0 and later: |
77 | local lib_path = $(root)/lib $(root:P)/lib/$(bin:B) ; | |
78 | if $(.debug-configuration) | |
79 | { | |
11fdf7f2 | 80 | ECHO notice\: using intel libraries "::" $(condition) "::" $(lib_path) ; |
7c673cae FG |
81 | } |
82 | flags intel-darwin.link RUN_PATH $(condition) : $(lib_path) ; | |
1e59de90 | 83 | } |
7c673cae FG |
84 | } |
85 | ||
86 | local m = [ MATCH (..).* : $(version) ] ; | |
87 | local n = [ MATCH (.)\\. : $(m) ] ; | |
88 | if $(n) { | |
89 | m = $(n) ; | |
90 | } | |
91 | ||
92 | local major = $(m) ; | |
1e59de90 | 93 | |
7c673cae FG |
94 | if $(major) = "9" { |
95 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>off : -Ob0 ; | |
96 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>on : -Ob1 ; | |
97 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>full : -Ob2 ; | |
98 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>off : -vec-report0 ; | |
99 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>on : -vec-report1 ; | |
100 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>full : -vec-report5 ; | |
101 | flags intel-darwin.link OPTIONS $(condition)/<runtime-link>static : -static -static-libcxa -lstdc++ -lpthread ; | |
102 | flags intel-darwin.link OPTIONS $(condition)/<runtime-link>shared : -shared-libcxa -lstdc++ -lpthread ; | |
103 | } | |
104 | else { | |
105 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>off : -inline-level=0 ; | |
106 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>on : -inline-level=1 ; | |
107 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>full : -inline-level=2 ; | |
108 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>off : -vec-report0 ; | |
109 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>on : -vec-report1 ; | |
110 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>full : -vec-report5 ; | |
111 | flags intel-darwin.link OPTIONS $(condition)/<runtime-link>static : -static -static-intel -lstdc++ -lpthread ; | |
112 | flags intel-darwin.link OPTIONS $(condition)/<runtime-link>shared : -shared-intel -lstdc++ -lpthread ; | |
113 | } | |
114 | ||
115 | local minor = [ MATCH ".*\\.(.).*" : $(version) ] ; | |
116 | ||
117 | # wchar_t char_traits workaround for compilers older than 10.2 | |
118 | if $(major) = "9" || ( $(major) = "10" && ( $(minor) = "0" || $(minor) = "1" ) ) { | |
119 | flags intel-darwin.compile DEFINES $(condition) : __WINT_TYPE__=int : unchecked ; | |
120 | } | |
11fdf7f2 | 121 | |
11fdf7f2 TL |
122 | # - Archive builder. |
123 | local archiver = [ feature.get-values <archiver> : $(options) ] ; | |
124 | toolset.flags intel-darwin.archive .AR $(condition) : $(archiver[1]) ; | |
7c673cae FG |
125 | } |
126 | ||
127 | SPACE = " " ; | |
128 | ||
129 | flags intel-darwin.compile OPTIONS <cflags> ; | |
130 | flags intel-darwin.compile.c++ OPTIONS <cxxflags> ; | |
131 | # flags intel-darwin.compile INCLUDES <include> ; | |
132 | ||
133 | flags intel-darwin.compile OPTIONS <optimization>space : -O1 ; # no specific space optimization flag in icc | |
134 | ||
1e59de90 | 135 | # |
7c673cae FG |
136 | .cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i |
137 | conroe conroe-xe conroe-l allendale merom | |
138 | merom-xe kentsfield kentsfield-xe penryn wolfdale | |
b32b8144 | 139 | yorksfield nehalem sandy-bridge ivy-bridge haswell |
20effc67 TL |
140 | broadwell skylake skylake-avx512 cannonlake icelake-client |
141 | icelake-server cascadelake cooperlake tigerlake ; | |
7c673cae | 142 | .cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 |
b32b8144 | 143 | athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 |
20effc67 | 144 | bdver4 btver1 btver2 znver1 znver2 ; |
7c673cae FG |
145 | .cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; |
146 | ||
147 | flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>32 : -m32 ; # -mcmodel=small ; | |
148 | flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>64 : -m64 ; # -mcmodel=large ; | |
149 | ||
150 | flags intel-darwin.compile.c OPTIONS <warnings>off : -w0 ; | |
151 | flags intel-darwin.compile.c OPTIONS <warnings>on : -w1 ; | |
152 | flags intel-darwin.compile.c OPTIONS <warnings>all : -w2 ; | |
20effc67 TL |
153 | flags intel-darwin.compile.c OPTIONS <warnings>extra : -w3 ; |
154 | flags intel-darwin.compile.c OPTIONS <warnings>pedantic : -w3 -Wcheck ; | |
155 | flags intel-darwin.compile.c OPTIONS <warnings-as-errors>on : -Werror-all ; | |
7c673cae FG |
156 | |
157 | flags intel-darwin.compile.c++ OPTIONS <warnings>off : -w0 ; | |
158 | flags intel-darwin.compile.c++ OPTIONS <warnings>on : -w1 ; | |
159 | flags intel-darwin.compile.c++ OPTIONS <warnings>all : -w2 ; | |
20effc67 TL |
160 | flags intel-darwin.compile.c++ OPTIONS <warnings>extra : -w3 ; |
161 | flags intel-darwin.compile.c++ OPTIONS <warnings>pedantic : -w3 -Wcheck ; | |
162 | flags intel-darwin.compile.c++ OPTIONS <warnings-as-errors>on : -Werror-all ; | |
7c673cae FG |
163 | |
164 | actions compile.c | |
165 | { | |
166 | "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
167 | } | |
168 | ||
169 | actions compile.c++ | |
170 | { | |
171 | "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
172 | } | |
173 | ||
7c673cae FG |
174 | # Declare actions for linking |
175 | rule link ( targets * : sources * : properties * ) | |
176 | { | |
177 | SPACE on $(targets) = " " ; | |
7c673cae FG |
178 | } |
179 | ||
180 | actions link bind LIBRARIES | |
181 | { | |
182 | "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) | |
183 | } | |
184 | ||
185 | actions link.dll bind LIBRARIES | |
186 | { | |
187 | "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "$(<[1]:D=)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) | |
188 | } |