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)
8 import feature : feature ;
11 import toolset : flags ;
17 feature.extend-subfeature toolset intel : platform : darwin ;
19 toolset.inherit-generators intel-darwin
20 <toolset>intel <toolset-intel:platform>darwin
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
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 ;
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
39 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
41 .debug-configuration = true ;
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 * )
50 local condition = [ common.check-init-parameters intel-darwin
51 : version $(version) ] ;
53 command = [ common.get-invocation-command intel-darwin : icc
54 : $(command) : /opt/intel_cc_80/bin ] ;
56 common.handle-options intel-darwin : $(condition) : $(command) : $(options) ;
58 gcc.init-link-flags intel-darwin darwin $(condition) ;
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) ] ;
64 local root = [ feature.get-values <root> : $(options) ] ;
66 if $(command) || $(root)
68 bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ;
73 # Libraries required to run the executable may be in either
74 # $(root)/lib (10.1 and earlier)
76 # $(root)/lib/architecture-name (11.0 and later:
77 local lib_path = $(root)/lib $(root:P)/lib/$(bin:B) ;
78 if $(.debug-configuration)
80 ECHO notice: using intel libraries :: $(condition) :: $(lib_path) ;
82 flags intel-darwin.link RUN_PATH $(condition) : $(lib_path) ;
86 local m = [ MATCH (..).* : $(version) ] ;
87 local n = [ MATCH (.)\\. : $(m) ] ;
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 ;
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 ;
115 local minor = [ MATCH ".*\\.(.).*" : $(version) ] ;
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 ;
125 flags intel-darwin.compile OPTIONS <cflags> ;
126 flags intel-darwin.compile.c++ OPTIONS <cxxflags> ;
127 # flags intel-darwin.compile INCLUDES <include> ;
129 flags intel-darwin.compile OPTIONS <optimization>space : -O1 ; # no specific space optimization flag in icc
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) ;
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 ;
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 ;
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 ;
155 "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
160 "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
163 flags intel-darwin ARFLAGS <archiveflags> ;
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.
172 rule archive ( targets * : sources * : properties * )
174 # Always remove archive and start again. Here's rationale from
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*
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
192 local clean.a = $(targets[1])(clean) ;
193 TEMPORARY $(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) ;
201 actions piecemeal archive
203 "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"
207 flags intel-darwin.link USER_OPTIONS <linkflags> ;
209 # Declare actions for linking
210 rule link ( targets * : sources * : properties * )
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 ;
218 actions link bind LIBRARIES
220 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS)
223 actions link.dll bind LIBRARIES
225 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "$(<[1]:D=)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS)