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 <architecture>x86/<address-model>32 36 <architecture>x86/<address-model>64 37 ; 38 39if [ 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 compiler 47# compile and link options allow you to specify addition command line options for each version 48rule 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 # 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 { 78 ECHO notice\: using intel libraries "::" $(condition) "::" $(lib_path) ; 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 } 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]) ; 127} 128 129SPACE = " " ; 130 131flags intel-darwin.compile OPTIONS <cflags> ; 132flags intel-darwin.compile.c++ OPTIONS <cxxflags> ; 133# flags intel-darwin.compile INCLUDES <include> ; 134 135flags 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 141 yorksfield nehalem sandy-bridge ivy-bridge haswell 142 broadwell skylake skylake-avx512 cannonlake icelake ; 143.cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 144 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 145 bdver4 btver1 btver2 znver1 ; 146.cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; 147 148flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>32 : -m32 ; # -mcmodel=small ; 149flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>64 : -m64 ; # -mcmodel=large ; 150 151flags intel-darwin.compile.c OPTIONS <warnings>off : -w0 ; 152flags intel-darwin.compile.c OPTIONS <warnings>on : -w1 ; 153flags intel-darwin.compile.c OPTIONS <warnings>all : -w2 ; 154 155flags intel-darwin.compile.c++ OPTIONS <warnings>off : -w0 ; 156flags intel-darwin.compile.c++ OPTIONS <warnings>on : -w1 ; 157flags intel-darwin.compile.c++ OPTIONS <warnings>all : -w2 ; 158 159actions compile.c 160{ 161 "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 162} 163 164actions compile.c++ 165{ 166 "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" 167} 168 169flags 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 ; 177.RANLIB = ranlib ; 178 179rule 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 208actions piecemeal archive 209{ 210 "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" 211 "$(.RANLIB)" -cs "$(<)" 212} 213 214flags intel-darwin.link USER_OPTIONS <linkflags> ; 215 216# Declare actions for linking 217rule 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 225actions link bind LIBRARIES 226{ 227 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) 228} 229 230actions 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} 234