]>
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. | |
4 | # (See accompanying file LICENSE_1_0.txt | |
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt) | |
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 | ||
19 | toolset.inherit-generators intel-darwin | |
20 | <toolset>intel <toolset-intel:platform>darwin | |
21 | : gcc | |
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 ; | |
32 | toolset.inherit-flags intel-darwin : gcc | |
33 | : <inlining>off <inlining>on <inlining>full <optimization>space | |
34 | <warnings>off <warnings>all <warnings>on | |
35 | <architecture>x86/<address-model>32 | |
36 | <architecture>x86/<address-model>64 | |
37 | ; | |
38 | ||
39 | if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] | |
40 | { | |
41 | .debug-configuration = true ; | |
42 | } | |
43 | ||
7c673cae FG |
44 | # Initializes the intel-darwin toolset |
45 | # version in mandatory | |
92f5a8d4 | 46 | # name (default icc) is used to invoke the specified intel compiler |
7c673cae FG |
47 | # compile and link options allow you to specify addition command line options for each version |
48 | rule init ( version ? : command * : options * ) | |
49 | { | |
50 | local condition = [ common.check-init-parameters intel-darwin | |
51 | : version $(version) ] ; | |
52 | ||
53 | command = [ common.get-invocation-command intel-darwin : icc | |
54 | : $(command) : /opt/intel_cc_80/bin ] ; | |
55 | ||
56 | common.handle-options intel-darwin : $(condition) : $(command) : $(options) ; | |
57 | ||
7c673cae FG |
58 | # handle <library-path> |
59 | # local library-path = [ feature.get-values <library-path> : $(options) ] ; | |
60 | # flags intel-darwin.link USER_OPTIONS $(condition) : [ feature.get-values <dll-path> : $(options) ] ; | |
61 | ||
62 | local root = [ feature.get-values <root> : $(options) ] ; | |
63 | local bin ; | |
64 | if $(command) || $(root) | |
65 | { | |
66 | bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; | |
67 | root ?= $(bin:D) ; | |
68 | ||
69 | if $(root) | |
70 | { | |
71 | # Libraries required to run the executable may be in either | |
72 | # $(root)/lib (10.1 and earlier) | |
73 | # or | |
74 | # $(root)/lib/architecture-name (11.0 and later: | |
75 | local lib_path = $(root)/lib $(root:P)/lib/$(bin:B) ; | |
76 | if $(.debug-configuration) | |
77 | { | |
11fdf7f2 | 78 | ECHO notice\: using intel libraries "::" $(condition) "::" $(lib_path) ; |
7c673cae FG |
79 | } |
80 | flags intel-darwin.link RUN_PATH $(condition) : $(lib_path) ; | |
81 | } | |
82 | } | |
83 | ||
84 | local m = [ MATCH (..).* : $(version) ] ; | |
85 | local n = [ MATCH (.)\\. : $(m) ] ; | |
86 | if $(n) { | |
87 | m = $(n) ; | |
88 | } | |
89 | ||
90 | local major = $(m) ; | |
91 | ||
92 | if $(major) = "9" { | |
93 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>off : -Ob0 ; | |
94 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>on : -Ob1 ; | |
95 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>full : -Ob2 ; | |
96 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>off : -vec-report0 ; | |
97 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>on : -vec-report1 ; | |
98 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>full : -vec-report5 ; | |
99 | flags intel-darwin.link OPTIONS $(condition)/<runtime-link>static : -static -static-libcxa -lstdc++ -lpthread ; | |
100 | flags intel-darwin.link OPTIONS $(condition)/<runtime-link>shared : -shared-libcxa -lstdc++ -lpthread ; | |
101 | } | |
102 | else { | |
103 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>off : -inline-level=0 ; | |
104 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>on : -inline-level=1 ; | |
105 | flags intel-darwin.compile OPTIONS $(condition)/<inlining>full : -inline-level=2 ; | |
106 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>off : -vec-report0 ; | |
107 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>on : -vec-report1 ; | |
108 | flags intel-darwin.compile OPTIONS $(condition)/<vectorize>full : -vec-report5 ; | |
109 | flags intel-darwin.link OPTIONS $(condition)/<runtime-link>static : -static -static-intel -lstdc++ -lpthread ; | |
110 | flags intel-darwin.link OPTIONS $(condition)/<runtime-link>shared : -shared-intel -lstdc++ -lpthread ; | |
111 | } | |
112 | ||
113 | local minor = [ MATCH ".*\\.(.).*" : $(version) ] ; | |
114 | ||
115 | # wchar_t char_traits workaround for compilers older than 10.2 | |
116 | if $(major) = "9" || ( $(major) = "10" && ( $(minor) = "0" || $(minor) = "1" ) ) { | |
117 | flags intel-darwin.compile DEFINES $(condition) : __WINT_TYPE__=int : unchecked ; | |
118 | } | |
11fdf7f2 TL |
119 | |
120 | # - Ranlib. | |
121 | local ranlib = [ feature.get-values <ranlib> : $(options) ] ; | |
122 | toolset.flags intel-darwin.archive .RANLIB $(condition) : $(ranlib[1]) ; | |
123 | ||
124 | # - Archive builder. | |
125 | local archiver = [ feature.get-values <archiver> : $(options) ] ; | |
126 | toolset.flags intel-darwin.archive .AR $(condition) : $(archiver[1]) ; | |
7c673cae FG |
127 | } |
128 | ||
129 | SPACE = " " ; | |
130 | ||
131 | flags intel-darwin.compile OPTIONS <cflags> ; | |
132 | flags intel-darwin.compile.c++ OPTIONS <cxxflags> ; | |
133 | # flags intel-darwin.compile INCLUDES <include> ; | |
134 | ||
135 | flags intel-darwin.compile OPTIONS <optimization>space : -O1 ; # no specific space optimization flag in icc | |
136 | ||
137 | # | |
138 | .cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i | |
139 | conroe conroe-xe conroe-l allendale merom | |
140 | merom-xe kentsfield kentsfield-xe penryn wolfdale | |
b32b8144 | 141 | yorksfield nehalem sandy-bridge ivy-bridge haswell |
92f5a8d4 | 142 | broadwell skylake skylake-avx512 cannonlake icelake ; |
7c673cae | 143 | .cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 |
b32b8144 FG |
144 | athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 |
145 | bdver4 btver1 btver2 znver1 ; | |
7c673cae FG |
146 | .cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; |
147 | ||
148 | flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>32 : -m32 ; # -mcmodel=small ; | |
149 | flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>64 : -m64 ; # -mcmodel=large ; | |
150 | ||
151 | flags intel-darwin.compile.c OPTIONS <warnings>off : -w0 ; | |
152 | flags intel-darwin.compile.c OPTIONS <warnings>on : -w1 ; | |
153 | flags intel-darwin.compile.c OPTIONS <warnings>all : -w2 ; | |
154 | ||
155 | flags intel-darwin.compile.c++ OPTIONS <warnings>off : -w0 ; | |
156 | flags intel-darwin.compile.c++ OPTIONS <warnings>on : -w1 ; | |
157 | flags intel-darwin.compile.c++ OPTIONS <warnings>all : -w2 ; | |
158 | ||
159 | actions compile.c | |
160 | { | |
161 | "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
162 | } | |
163 | ||
164 | actions compile.c++ | |
165 | { | |
166 | "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
167 | } | |
168 | ||
169 | flags intel-darwin ARFLAGS <archiveflags> ; | |
170 | ||
171 | # Default value. Mostly for the sake of intel-linux | |
172 | # that inherits from gcc, but does not has the same | |
173 | # logic to set the .AR variable. We can put the same | |
174 | # logic in intel-linux, but that's hardly worth the trouble | |
175 | # as on Linux, 'ar' is always available. | |
176 | .AR = ar ; | |
11fdf7f2 | 177 | .RANLIB = ranlib ; |
7c673cae FG |
178 | |
179 | rule archive ( targets * : sources * : properties * ) | |
180 | { | |
181 | # Always remove archive and start again. Here's rationale from | |
182 | # Andre Hentz: | |
183 | # | |
184 | # I had a file, say a1.c, that was included into liba.a. | |
185 | # I moved a1.c to a2.c, updated my Jamfiles and rebuilt. | |
186 | # My program was crashing with absurd errors. | |
187 | # After some debugging I traced it back to the fact that a1.o was *still* | |
188 | # in liba.a | |
189 | # | |
190 | # Rene Rivera: | |
191 | # | |
192 | # Originally removing the archive was done by splicing an RM | |
193 | # onto the archive action. That makes archives fail to build on NT | |
194 | # when they have many files because it will no longer execute the | |
195 | # action directly and blow the line length limit. Instead we | |
196 | # remove the file in a different action, just before the building | |
197 | # of the archive. | |
198 | # | |
199 | local clean.a = $(targets[1])(clean) ; | |
200 | TEMPORARY $(clean.a) ; | |
201 | NOCARE $(clean.a) ; | |
202 | LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ; | |
203 | DEPENDS $(clean.a) : $(sources) ; | |
204 | DEPENDS $(targets) : $(clean.a) ; | |
205 | common.RmTemps $(clean.a) : $(targets) ; | |
206 | } | |
207 | ||
208 | actions piecemeal archive | |
209 | { | |
210 | "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" | |
11fdf7f2 | 211 | "$(.RANLIB)" -cs "$(<)" |
7c673cae FG |
212 | } |
213 | ||
214 | flags intel-darwin.link USER_OPTIONS <linkflags> ; | |
215 | ||
216 | # Declare actions for linking | |
217 | rule link ( targets * : sources * : properties * ) | |
218 | { | |
219 | SPACE on $(targets) = " " ; | |
220 | # Serialize execution of the 'link' action, since | |
221 | # running N links in parallel is just slower. | |
222 | JAM_SEMAPHORE on $(targets) = <s>intel-darwin-link-semaphore ; | |
223 | } | |
224 | ||
225 | actions link bind LIBRARIES | |
226 | { | |
227 | "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) | |
228 | } | |
229 | ||
230 | actions link.dll bind LIBRARIES | |
231 | { | |
232 | "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "$(<[1]:D=)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) | |
233 | } |