]>
Commit | Line | Data |
---|---|---|
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 | ||
44 | # Initializes the intel-darwin toolset | |
45 | # version in mandatory | |
46 | # name (default icc) is used to invoke the specified intel complier | |
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 | ||
58 | gcc.init-link-flags intel-darwin darwin $(condition) ; | |
59 | ||
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) ; | |
70 | ||
71 | if $(root) | |
72 | { | |
73 | # Libraries required to run the executable may be in either | |
74 | # $(root)/lib (10.1 and earlier) | |
75 | # or | |
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 | { | |
80 | ECHO notice: using intel libraries :: $(condition) :: $(lib_path) ; | |
81 | } | |
82 | flags intel-darwin.link RUN_PATH $(condition) : $(lib_path) ; | |
83 | } | |
84 | } | |
85 | ||
86 | local m = [ MATCH (..).* : $(version) ] ; | |
87 | local n = [ MATCH (.)\\. : $(m) ] ; | |
88 | if $(n) { | |
89 | m = $(n) ; | |
90 | } | |
91 | ||
92 | local major = $(m) ; | |
93 | ||
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 | } | |
121 | } | |
122 | ||
123 | SPACE = " " ; | |
124 | ||
125 | flags intel-darwin.compile OPTIONS <cflags> ; | |
126 | flags intel-darwin.compile.c++ OPTIONS <cxxflags> ; | |
127 | # flags intel-darwin.compile INCLUDES <include> ; | |
128 | ||
129 | flags intel-darwin.compile OPTIONS <optimization>space : -O1 ; # no specific space optimization flag in icc | |
130 | ||
131 | # | |
132 | .cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i | |
133 | conroe conroe-xe conroe-l allendale merom | |
134 | merom-xe kentsfield kentsfield-xe penryn wolfdale | |
135 | yorksfield nehalem sandy-bridge ivy-bridge haswell | |
136 | broadwell skylake skylake-avx512 cannonlake ; | |
137 | .cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 | |
138 | athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 | |
139 | bdver4 btver1 btver2 znver1 ; | |
140 | .cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; | |
141 | ||
142 | flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>32 : -m32 ; # -mcmodel=small ; | |
143 | flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>64 : -m64 ; # -mcmodel=large ; | |
144 | ||
145 | flags intel-darwin.compile.c OPTIONS <warnings>off : -w0 ; | |
146 | flags intel-darwin.compile.c OPTIONS <warnings>on : -w1 ; | |
147 | flags intel-darwin.compile.c OPTIONS <warnings>all : -w2 ; | |
148 | ||
149 | flags intel-darwin.compile.c++ OPTIONS <warnings>off : -w0 ; | |
150 | flags intel-darwin.compile.c++ OPTIONS <warnings>on : -w1 ; | |
151 | flags intel-darwin.compile.c++ OPTIONS <warnings>all : -w2 ; | |
152 | ||
153 | actions compile.c | |
154 | { | |
155 | "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
156 | } | |
157 | ||
158 | actions compile.c++ | |
159 | { | |
160 | "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
161 | } | |
162 | ||
163 | flags intel-darwin ARFLAGS <archiveflags> ; | |
164 | ||
165 | # Default value. Mostly for the sake of intel-linux | |
166 | # that inherits from gcc, but does not has the same | |
167 | # logic to set the .AR variable. We can put the same | |
168 | # logic in intel-linux, but that's hardly worth the trouble | |
169 | # as on Linux, 'ar' is always available. | |
170 | .AR = ar ; | |
171 | ||
172 | rule archive ( targets * : sources * : properties * ) | |
173 | { | |
174 | # Always remove archive and start again. Here's rationale from | |
175 | # Andre Hentz: | |
176 | # | |
177 | # I had a file, say a1.c, that was included into liba.a. | |
178 | # I moved a1.c to a2.c, updated my Jamfiles and rebuilt. | |
179 | # My program was crashing with absurd errors. | |
180 | # After some debugging I traced it back to the fact that a1.o was *still* | |
181 | # in liba.a | |
182 | # | |
183 | # Rene Rivera: | |
184 | # | |
185 | # Originally removing the archive was done by splicing an RM | |
186 | # onto the archive action. That makes archives fail to build on NT | |
187 | # when they have many files because it will no longer execute the | |
188 | # action directly and blow the line length limit. Instead we | |
189 | # remove the file in a different action, just before the building | |
190 | # of the archive. | |
191 | # | |
192 | local clean.a = $(targets[1])(clean) ; | |
193 | TEMPORARY $(clean.a) ; | |
194 | NOCARE $(clean.a) ; | |
195 | LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ; | |
196 | DEPENDS $(clean.a) : $(sources) ; | |
197 | DEPENDS $(targets) : $(clean.a) ; | |
198 | common.RmTemps $(clean.a) : $(targets) ; | |
199 | } | |
200 | ||
201 | actions piecemeal archive | |
202 | { | |
203 | "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" | |
204 | "ranlib" -cs "$(<)" | |
205 | } | |
206 | ||
207 | flags intel-darwin.link USER_OPTIONS <linkflags> ; | |
208 | ||
209 | # Declare actions for linking | |
210 | rule link ( targets * : sources * : properties * ) | |
211 | { | |
212 | SPACE on $(targets) = " " ; | |
213 | # Serialize execution of the 'link' action, since | |
214 | # running N links in parallel is just slower. | |
215 | JAM_SEMAPHORE on $(targets) = <s>intel-darwin-link-semaphore ; | |
216 | } | |
217 | ||
218 | actions link bind LIBRARIES | |
219 | { | |
220 | "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) | |
221 | } | |
222 | ||
223 | actions link.dll bind LIBRARIES | |
224 | { | |
225 | "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "$(<[1]:D=)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) | |
226 | } |