mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 12:42:11 +00:00
159 lines
4.4 KiB
Plaintext
159 lines
4.4 KiB
Plaintext
# Copyright Vladimir Prus 2004.
|
|
# Distributed under the Boost Software License, Version 1.0.
|
|
# (See accompanying file LICENSE_1_0.txt
|
|
# or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
import toolset ;
|
|
import feature ;
|
|
import toolset : flags ;
|
|
import os ;
|
|
import errors ;
|
|
|
|
# This is needed because the rule we import here depend on 'common'
|
|
# That's nasty.
|
|
import common ;
|
|
|
|
import intel ;
|
|
|
|
feature.extend-subfeature toolset intel : platform : win ;
|
|
|
|
import msvc ;
|
|
toolset.inherit-generators intel-win <toolset>intel <toolset-intel:platform>win : msvc ;
|
|
toolset.inherit-flags intel-win : msvc ;
|
|
toolset.inherit-rules intel-win : msvc ;
|
|
|
|
toolset.add-requirements <toolset>intel-win,<runtime-link>shared:<threading>multi ;
|
|
|
|
# Initializes the intel toolset for windows
|
|
rule init ( version ? : # the compiler version
|
|
command * : # the command to invoke the compiler itself
|
|
options * # Additional option: <compatibility>
|
|
# either 'vc6', 'vc7', 'vc7.1'
|
|
# or 'native'(default).
|
|
)
|
|
{
|
|
local compatibility =
|
|
[ feature.get-values <compatibility> : $(options) ] ;
|
|
local condition = [ common.check-init-parameters intel-win
|
|
: version $(version) : compatibility $(compatibility) ] ;
|
|
|
|
command = [ common.get-invocation-command intel-win : icc.exe :
|
|
$(command) ] ;
|
|
|
|
common.handle-options intel-win : $(condition) : $(command) : $(options) ;
|
|
|
|
local root ;
|
|
if $(command)
|
|
{
|
|
root = [ common.get-absolute-tool-path $(command[-1]) ] ;
|
|
root = $(root)/ ;
|
|
}
|
|
|
|
local setup ;
|
|
setup = $(root)/iclvars.bat ;
|
|
setup = "call \""$(setup)"\" > nul " ;
|
|
|
|
if [ os.name ] = NT
|
|
{
|
|
setup = $(setup)"
|
|
" ;
|
|
}
|
|
else
|
|
{
|
|
setup = "cmd /S /C "$(setup)" \"&&\" " ;
|
|
}
|
|
|
|
|
|
flags intel-win.compile .CC $(condition) : $(setup)icl ;
|
|
flags intel-win.link .LD $(condition) : $(setup)xilink ;
|
|
flags intel-win.archive .LD $(condition) : $(setup)xilink /lib ;
|
|
flags intel-win.link .MT $(condition) : mt -nologo ;
|
|
|
|
local m = [ MATCH (.).* : $(version) ] ;
|
|
local major = $(m[1]) ;
|
|
|
|
local C++FLAGS ;
|
|
# Reduce the number of spurious error messages
|
|
C++FLAGS += /Qwn5 /Qwd985 ;
|
|
|
|
# Enable ADL
|
|
C++FLAGS += -Qoption,c,--arg_dep_lookup ; #"c" works for C++, too
|
|
|
|
if $(major) > 5
|
|
{
|
|
C++FLAGS += /Zc:forScope ; # Add support for correct for loop scoping
|
|
}
|
|
|
|
# Add options recognized only by intel7
|
|
if $(major) >= 7
|
|
{
|
|
C++FLAGS += /Qansi_alias ;
|
|
}
|
|
|
|
if $(compatibility) = vc6
|
|
{
|
|
C++FLAGS +=
|
|
# Emulate VC6
|
|
/Qvc6
|
|
|
|
# no wchar_t support in vc6 dinkum library. Furthermore, in vc6
|
|
# compatibility-mode, wchar_t is not a distinct type from unsigned
|
|
# short
|
|
-DBOOST_NO_INTRINSIC_WCHAR_T
|
|
;
|
|
}
|
|
else
|
|
{
|
|
if $(major) > 5
|
|
{
|
|
# Add support for wchar_t
|
|
C++FLAGS += /Zc:wchar_t
|
|
# Tell the dinkumware library about it.
|
|
-D_NATIVE_WCHAR_T_DEFINED
|
|
;
|
|
}
|
|
}
|
|
|
|
|
|
if $(compatibility) && $(compatibility) != native
|
|
{
|
|
C++FLAGS += /Q$(base-vc) ;
|
|
}
|
|
else
|
|
{
|
|
C++FLAGS +=
|
|
-Qoption,cpp,--arg_dep_lookup
|
|
# The following options were intended to disable
|
|
# 'bug-emulation' mode of intel compiler, but later
|
|
# were reported to case ICE with Intel-Win 9.0
|
|
# It's not yet clear which options can be safely used.
|
|
# -Qoption,cpp,--const_string_literals
|
|
# -Qoption,cpp,--new_for_init
|
|
# -Qoption,cpp,--no_implicit_typename
|
|
# -Qoption,cpp,--no_friend_injection
|
|
# -Qoption,cpp,--no_microsoft_bugs
|
|
;
|
|
}
|
|
|
|
flags intel-win CFLAGS $(condition) : $(C++FLAGS) ;
|
|
|
|
if ! $(compatibility)
|
|
{
|
|
# If there's no backend version, assume 7.1.
|
|
compatibility = vc7.1 ;
|
|
}
|
|
|
|
local extract-version = [ MATCH ^vc(.*) : $(compatibility) ] ;
|
|
if ! $(extract-version)
|
|
{
|
|
errors.user-error "Invalid value for compatibility option:"
|
|
$(compatibility) ;
|
|
}
|
|
|
|
msvc.configure-version-specific intel-win : $(extract-version[1]) : $(condition) ;
|
|
}
|
|
|
|
flags intel-win.link LIBRARY_OPTION <toolset>intel : "" ;
|
|
|
|
|