| 1 | # Copyright Vladimir Prus 2004.
|
|---|
| 2 | # Distributed under the Boost Software License, Version 1.0.
|
|---|
| 3 | # (See accompanying file LICENSE_1_0.txt
|
|---|
| 4 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|---|
| 5 |
|
|---|
| 6 | # Importing common is needed because the rules we inherit here depend on it.
|
|---|
| 7 | # That is nasty.
|
|---|
| 8 | import common ;
|
|---|
| 9 | import errors ;
|
|---|
| 10 | import feature ;
|
|---|
| 11 | import intel ;
|
|---|
| 12 | import msvc ;
|
|---|
| 13 | import os ;
|
|---|
| 14 | import toolset ;
|
|---|
| 15 | import generators ;
|
|---|
| 16 | import type ;
|
|---|
| 17 | import path ;
|
|---|
| 18 |
|
|---|
| 19 | feature.extend-subfeature toolset intel : platform : win ;
|
|---|
| 20 |
|
|---|
| 21 | toolset.inherit-generators intel-win <toolset>intel <toolset-intel:platform>win : msvc ;
|
|---|
| 22 | toolset.inherit-flags intel-win : msvc : : YLOPTION ;
|
|---|
| 23 | toolset.inherit-rules intel-win : msvc ;
|
|---|
| 24 |
|
|---|
| 25 | # Override default do-nothing generators.
|
|---|
| 26 | generators.override intel-win.compile.c.pch : pch.default-c-pch-generator ;
|
|---|
| 27 | generators.override intel-win.compile.c++.pch : pch.default-cpp-pch-generator ;
|
|---|
| 28 | generators.override intel-win.compile.rc : rc.compile.resource ;
|
|---|
| 29 | generators.override intel-win.compile.mc : mc.compile ;
|
|---|
| 30 |
|
|---|
| 31 | toolset.flags intel-win.compile PCH_SOURCE <pch>on : <pch-source> ;
|
|---|
| 32 |
|
|---|
| 33 | toolset.add-requirements <toolset>intel-win,<runtime-link>shared:<threading>multi ;
|
|---|
| 34 |
|
|---|
| 35 | # Initializes the intel toolset for windows
|
|---|
| 36 | rule init ( version ? : # the compiler version
|
|---|
| 37 | command * : # the command to invoke the compiler itself
|
|---|
| 38 | options * # Additional option: <compatibility>
|
|---|
| 39 | # either 'vc6', 'vc7', 'vc7.1'
|
|---|
| 40 | # or 'native'(default).
|
|---|
| 41 | )
|
|---|
| 42 | {
|
|---|
| 43 | local compatibility =
|
|---|
| 44 | [ feature.get-values <compatibility> : $(options) ] ;
|
|---|
| 45 | local condition = [ common.check-init-parameters intel-win
|
|---|
| 46 | : version $(version) : compatibility $(compatibility) ] ;
|
|---|
| 47 |
|
|---|
| 48 | local m = [ MATCH ([0-9]+).* : $(version) ] ;
|
|---|
| 49 | local major = $(m[1]) ;
|
|---|
| 50 |
|
|---|
| 51 | command = [ common.get-invocation-command intel-win : icl.exe :
|
|---|
| 52 | $(command) ] ;
|
|---|
| 53 |
|
|---|
| 54 | common.handle-options intel-win : $(condition) : $(command) : $(options) ;
|
|---|
| 55 |
|
|---|
| 56 | local root ;
|
|---|
| 57 | if $(command)
|
|---|
| 58 | {
|
|---|
| 59 | root = [ common.get-absolute-tool-path $(command[-1]) ] ;
|
|---|
| 60 | if $(major) >= 12
|
|---|
| 61 | {
|
|---|
| 62 | root = [ path.parent $(root) ] ;
|
|---|
| 63 | }
|
|---|
| 64 | root = $(root)/ ;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | local setup ;
|
|---|
| 68 | setup = [ GLOB $(root) : iclvars_*.bat ] ;
|
|---|
| 69 | if ! $(setup)
|
|---|
| 70 | {
|
|---|
| 71 | setup = $(root)/iclvars.bat ;
|
|---|
| 72 | setup = [ path.native $(setup) ] ;
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | local target_types ;
|
|---|
| 76 | local iclvars_vs_arg ;
|
|---|
| 77 | if $(major) >= 12
|
|---|
| 78 | {
|
|---|
| 79 | if $(compatibility) = vc10
|
|---|
| 80 | {
|
|---|
| 81 | iclvars_vs_arg = vs2010 ;
|
|---|
| 82 | }
|
|---|
| 83 | else if $(compatibility) = vc9
|
|---|
| 84 | {
|
|---|
| 85 | iclvars_vs_arg = vs2008 ;
|
|---|
| 86 | }
|
|---|
| 87 | else if $(compatibility) = vc8
|
|---|
| 88 | {
|
|---|
| 89 | iclvars_vs_arg = vs2005 ;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 | if [ MATCH ^(AMD64) : [ os.environ PROCESSOR_ARCHITECTURE ] ]
|
|---|
| 94 | {
|
|---|
| 95 | target_types = ia32 intel64 ;
|
|---|
| 96 | }
|
|---|
| 97 | else
|
|---|
| 98 | {
|
|---|
| 99 | target_types = ia32 ia32_intel64 ;
|
|---|
| 100 | }
|
|---|
| 101 | }
|
|---|
| 102 | else
|
|---|
| 103 | {
|
|---|
| 104 | target_types = default ;
|
|---|
| 105 | iclvars_vs_arg = $(compatibility) ;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | for local c in $(target_types)
|
|---|
| 109 | {
|
|---|
| 110 | local cpu-conditions ;
|
|---|
| 111 | local setup-call ;
|
|---|
| 112 | if $(major) >= 12
|
|---|
| 113 | {
|
|---|
| 114 | setup-call = "call \""$(setup)"\" $(c) $(iclvars_vs_arg) > nul " ;
|
|---|
| 115 | cpu-conditions = $(condition)/$(.cpu-arch-$(c)) ;
|
|---|
| 116 | }
|
|---|
| 117 | else
|
|---|
| 118 | {
|
|---|
| 119 | setup-call = "call \""$(setup)"\" $(compatibility) > nul " ;
|
|---|
| 120 | cpu-conditions = $(condition) ;
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | if [ os.name ] = NT
|
|---|
| 124 | {
|
|---|
| 125 | setup-call = $(setup-call)"
|
|---|
| 126 | " ;
|
|---|
| 127 | }
|
|---|
| 128 | else
|
|---|
| 129 | {
|
|---|
| 130 | setup-call = "cmd /S /C "$(setup-call)" \"&&\" " ;
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | if $(.debug-configuration)
|
|---|
| 134 | {
|
|---|
| 135 | for local cpu-condition in $(cpu-conditions)
|
|---|
| 136 | {
|
|---|
| 137 | ECHO "notice: [intel-cfg] condition: '$(cpu-condition)', setup: '$(setup-call)'" ;
|
|---|
| 138 | }
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | toolset.flags intel-win.compile .CC $(cpu-conditions) : $(setup-call)icl ;
|
|---|
| 142 | toolset.flags intel-win.link .LD $(cpu-conditions) : $(setup-call)xilink /nologo ;
|
|---|
| 143 | toolset.flags intel-win.archive .LD $(cpu-conditions) : $(setup-call)xilink /lib /nologo ;
|
|---|
| 144 | toolset.flags intel-win.link .MT $(cpu-conditions) : $(setup-call)mt -nologo ;
|
|---|
| 145 | toolset.flags intel-win.compile .MC $(cpu-conditions) : $(setup-call)mc ;
|
|---|
| 146 | toolset.flags intel-win.compile .RC $(cpu-conditions) : $(setup-call)rc ;
|
|---|
| 147 | }
|
|---|
| 148 |
|
|---|
| 149 | # Depending on the settings, running of tests require some runtime DLLs.
|
|---|
| 150 | toolset.flags intel-win RUN_PATH $(condition) : $(root) ;
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 | local C++FLAGS ;
|
|---|
| 154 |
|
|---|
| 155 | C++FLAGS += /nologo ;
|
|---|
| 156 |
|
|---|
| 157 | # Reduce the number of spurious error messages
|
|---|
| 158 | C++FLAGS += /Qwn5 /Qwd985 ;
|
|---|
| 159 |
|
|---|
| 160 | # Enable ADL
|
|---|
| 161 | C++FLAGS += -Qoption,c,--arg_dep_lookup ; #"c" works for C++, too
|
|---|
| 162 |
|
|---|
| 163 | # Disable Microsoft "secure" overloads in Dinkumware libraries since they
|
|---|
| 164 | # cause compile errors with Intel versions 9 and 10.
|
|---|
| 165 | if $(major) < 12
|
|---|
| 166 | {
|
|---|
| 167 | C++FLAGS += -D_SECURE_SCL=0 ;
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | if $(major) > 5
|
|---|
| 171 | {
|
|---|
| 172 | C++FLAGS += /Zc:forScope ; # Add support for correct for loop scoping.
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | # Add options recognized only by intel7 and above.
|
|---|
| 176 | if $(major) >= 7
|
|---|
| 177 | {
|
|---|
| 178 | C++FLAGS += /Qansi_alias ;
|
|---|
| 179 | }
|
|---|
| 180 |
|
|---|
| 181 | if $(compatibility) = vc6
|
|---|
| 182 | {
|
|---|
| 183 | C++FLAGS +=
|
|---|
| 184 | # Emulate VC6
|
|---|
| 185 | /Qvc6
|
|---|
| 186 |
|
|---|
| 187 | # No wchar_t support in vc6 dinkum library. Furthermore, in vc6
|
|---|
| 188 | # compatibility-mode, wchar_t is not a distinct type from unsigned
|
|---|
| 189 | # short.
|
|---|
| 190 | -DBOOST_NO_INTRINSIC_WCHAR_T
|
|---|
| 191 | ;
|
|---|
| 192 | }
|
|---|
| 193 | else
|
|---|
| 194 | {
|
|---|
| 195 | if $(major) > 5
|
|---|
| 196 | {
|
|---|
| 197 | # Add support for wchar_t
|
|---|
| 198 | C++FLAGS += /Zc:wchar_t
|
|---|
| 199 | # Tell the dinkumware library about it.
|
|---|
| 200 | -D_NATIVE_WCHAR_T_DEFINED
|
|---|
| 201 | ;
|
|---|
| 202 | }
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | if $(compatibility) && $(compatibility) != native
|
|---|
| 206 | {
|
|---|
| 207 | C++FLAGS += /Q$(compatibility) ;
|
|---|
| 208 | }
|
|---|
| 209 | else
|
|---|
| 210 | {
|
|---|
| 211 | C++FLAGS +=
|
|---|
| 212 | -Qoption,cpp,--arg_dep_lookup
|
|---|
| 213 | # The following options were intended to disable the Intel compiler's
|
|---|
| 214 | # 'bug-emulation' mode, but were later reported to be causing ICE with
|
|---|
| 215 | # Intel-Win 9.0. It is not yet clear which options can be safely used.
|
|---|
| 216 | # -Qoption,cpp,--const_string_literals
|
|---|
| 217 | # -Qoption,cpp,--new_for_init
|
|---|
| 218 | # -Qoption,cpp,--no_implicit_typename
|
|---|
| 219 | # -Qoption,cpp,--no_friend_injection
|
|---|
| 220 | # -Qoption,cpp,--no_microsoft_bugs
|
|---|
| 221 | ;
|
|---|
| 222 | }
|
|---|
| 223 |
|
|---|
| 224 | toolset.flags intel-win CFLAGS $(condition) : $(C++FLAGS) ;
|
|---|
| 225 | # By default, when creating PCH, intel adds 'i' to the explicitly
|
|---|
| 226 | # specified name of the PCH file. Of course, Boost.Build is not
|
|---|
| 227 | # happy when compiler produces not the file it was asked for.
|
|---|
| 228 | # The option below stops this behaviour.
|
|---|
| 229 | toolset.flags intel-win CFLAGS : -Qpchi- ;
|
|---|
| 230 |
|
|---|
| 231 | if ! $(compatibility)
|
|---|
| 232 | {
|
|---|
| 233 | # If there's no backend version, assume 7.1.
|
|---|
| 234 | compatibility = vc7.1 ;
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 | local extract-version = [ MATCH ^vc(.*) : $(compatibility) ] ;
|
|---|
| 238 | if ! $(extract-version)
|
|---|
| 239 | {
|
|---|
| 240 | errors.user-error "Invalid value for compatibility option:"
|
|---|
| 241 | $(compatibility) ;
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 | msvc.configure-version-specific intel-win : $(extract-version[1]) : $(condition) ;
|
|---|
| 245 | }
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 | if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
|
|---|
| 249 | {
|
|---|
| 250 | .debug-configuration = true ;
|
|---|
| 251 | }
|
|---|
| 252 |
|
|---|
| 253 | # Copied from msvc.jam
|
|---|
| 254 | # Supported CPU architectures.
|
|---|
| 255 | .cpu-arch-ia32 =
|
|---|
| 256 | <architecture>/<address-model>
|
|---|
| 257 | <architecture>/<address-model>32
|
|---|
| 258 | <architecture>x86/<address-model>
|
|---|
| 259 | <architecture>x86/<address-model>32 ;
|
|---|
| 260 |
|
|---|
| 261 | .cpu-arch-intel64 =
|
|---|
| 262 | <architecture>/<address-model>64
|
|---|
| 263 | <architecture>x86/<address-model>64 ;
|
|---|
| 264 |
|
|---|
| 265 | .cpu-arch-ia32_intel64 =
|
|---|
| 266 | <architecture>/<address-model>64
|
|---|
| 267 | <architecture>x86/<address-model>64 ;
|
|---|
| 268 |
|
|---|
| 269 | toolset.flags intel-win.link LIBRARY_OPTION <toolset>intel : "" ;
|
|---|
| 270 |
|
|---|
| 271 | toolset.flags intel-win YLOPTION ;
|
|---|
| 272 |
|
|---|