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 7import intel ; 8import feature : feature ; 9import os ; 10import toolset ; 11import toolset : flags ; 12import gcc ; 13import common ; 14import errors ; 15import generators ; 16 17feature.extend-subfeature toolset intel : platform : darwin ; 18 19toolset.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 27generators.override intel-darwin.prebuilt : builtin.lib-generator ; 28generators.override intel-darwin.prebuilt : builtin.prebuilt ; 29generators.override intel-darwin.searched-lib-generator : searched-lib-generator ; 30 31toolset.inherit-rules intel-darwin : gcc ; 32toolset.inherit-flags intel-darwin : gcc 33 : <inlining>off <inlining>on <inlining>full <optimization>space 34 <warnings>off <warnings>all <warnings>on 35 <warnings>extra <warnings>pedantic 36 <warnings-as-errors>off <warnings-as-errors>on 37 <architecture>x86/<address-model>32 38 <architecture>x86/<address-model>64 39 ; 40 41if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] 42{ 43 .debug-configuration = true ; 44} 45 46# Initializes the intel-darwin toolset 47# version in mandatory 48# name (default icc) is used to invoke the specified intel compiler 49# compile and link options allow you to specify addition command line options for each version 50rule init ( version ? : command * : options * ) 51{ 52 local condition = [ common.check-init-parameters intel-darwin 53 : version $(version) ] ; 54 55 command = [ common.get-invocation-command intel-darwin : icc 56 : $(command) : /opt/intel_cc_80/bin ] ; 57 58 common.handle-options intel-darwin : $(condition) : $(command) : $(options) ; 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 # - Ranlib. 123 local ranlib = [ feature.get-values <ranlib> : $(options) ] ; 124 toolset.flags intel-darwin.archive .RANLIB $(condition) : $(ranlib[1]) ; 125 126 # - Archive builder. 127 local archiver = [ feature.get-values <archiver> : $(options) ] ; 128 toolset.flags intel-darwin.archive .AR $(condition) : $(archiver[1]) ; 129} 130 131SPACE = " " ; 132 133flags intel-darwin.compile OPTIONS <cflags> ; 134flags intel-darwin.compile.c++ OPTIONS <cxxflags> ; 135# flags intel-darwin.compile INCLUDES <include> ; 136 137flags intel-darwin.compile OPTIONS <optimization>space : -O1 ; # no specific space optimization flag in icc 138 139# 140.cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i 141 conroe conroe-xe conroe-l allendale merom 142 merom-xe kentsfield kentsfield-xe penryn wolfdale 143 yorksfield nehalem sandy-bridge ivy-bridge haswell 144 broadwell skylake skylake-avx512 cannonlake icelake-client 145 icelake-server cascadelake cooperlake tigerlake ; 146.cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 147 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 148 bdver4 btver1 btver2 znver1 znver2 ; 149.cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; 150 151flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>32 : -m32 ; # -mcmodel=small ; 152flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>64 : -m64 ; # -mcmodel=large ; 153 154flags intel-darwin.compile.c OPTIONS <warnings>off : -w0 ; 155flags intel-darwin.compile.c OPTIONS <warnings>on : -w1 ; 156flags intel-darwin.compile.c OPTIONS <warnings>all : -w2 ; 157flags intel-darwin.compile.c OPTIONS <warnings>extra : -w3 ; 158flags intel-darwin.compile.c OPTIONS <warnings>pedantic : -w3 -Wcheck ; 159flags intel-darwin.compile.c OPTIONS <warnings-as-errors>on : -Werror-all ; 160 161flags intel-darwin.compile.c++ OPTIONS <warnings>off : -w0 ; 162flags intel-darwin.compile.c++ OPTIONS <warnings>on : -w1 ; 163flags intel-darwin.compile.c++ OPTIONS <warnings>all : -w2 ; 164flags intel-darwin.compile.c++ OPTIONS <warnings>extra : -w3 ; 165flags intel-darwin.compile.c++ OPTIONS <warnings>pedantic : -w3 -Wcheck ; 166flags intel-darwin.compile.c++ OPTIONS <warnings-as-errors>on : -Werror-all ; 167 168actions compile.c 169{ 170 "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 171} 172 173actions compile.c++ 174{ 175 "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 176} 177 178flags intel-darwin ARFLAGS <archiveflags> ; 179 180# Default value. Mostly for the sake of intel-linux 181# that inherits from gcc, but does not has the same 182# logic to set the .AR variable. We can put the same 183# logic in intel-linux, but that's hardly worth the trouble 184# as on Linux, 'ar' is always available. 185.AR = ar ; 186.RANLIB = ranlib ; 187 188rule archive ( targets * : sources * : properties * ) 189{ 190 # Always remove archive and start again. Here's rationale from 191 # Andre Hentz: 192 # 193 # I had a file, say a1.c, that was included into liba.a. 194 # I moved a1.c to a2.c, updated my Jamfiles and rebuilt. 195 # My program was crashing with absurd errors. 196 # After some debugging I traced it back to the fact that a1.o was *still* 197 # in liba.a 198 # 199 # Rene Rivera: 200 # 201 # Originally removing the archive was done by splicing an RM 202 # onto the archive action. That makes archives fail to build on NT 203 # when they have many files because it will no longer execute the 204 # action directly and blow the line length limit. Instead we 205 # remove the file in a different action, just before the building 206 # of the archive. 207 # 208 local clean.a = $(targets[1])(clean) ; 209 TEMPORARY $(clean.a) ; 210 NOCARE $(clean.a) ; 211 LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ; 212 DEPENDS $(clean.a) : $(sources) ; 213 DEPENDS $(targets) : $(clean.a) ; 214 common.RmTemps $(clean.a) : $(targets) ; 215} 216 217actions piecemeal archive 218{ 219 "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" 220 "$(.RANLIB)" -cs "$(<)" 221} 222 223flags intel-darwin.link USER_OPTIONS <linkflags> ; 224 225# Declare actions for linking 226rule link ( targets * : sources * : properties * ) 227{ 228 SPACE on $(targets) = " " ; 229 # Serialize execution of the 'link' action, since 230 # running N links in parallel is just slower. 231 JAM_SEMAPHORE on $(targets) = <s>intel-darwin-link-semaphore ; 232} 233 234actions link bind LIBRARIES 235{ 236 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) 237} 238 239actions link.dll bind LIBRARIES 240{ 241 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "$(<[1]:D=)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) 242} 243