mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
Improve initialization of intel and sun compilers.
[SVN r23138]
This commit is contained in:
@@ -25,9 +25,12 @@ import path ;
|
||||
# Each parameter name corresponds to subfeature. This rule will declare subfeature
|
||||
# the first time non-empty parameter value is passed, and will extend it with
|
||||
# all the values.
|
||||
#
|
||||
# The return value from this rule is a condition to be used for flags settings.
|
||||
rule check-init-parameters ( toolset : * )
|
||||
{
|
||||
local sig = $(toolset) ;
|
||||
local condition = <toolset>$(toolset) ;
|
||||
for local index in 2 3 4 5 6 7 8 9
|
||||
{
|
||||
local name = $($(index)[1]) ;
|
||||
@@ -35,6 +38,7 @@ rule check-init-parameters ( toolset : * )
|
||||
|
||||
if $(value)-is-specified
|
||||
{
|
||||
condition = $(condition)-$(value) ;
|
||||
if $(.had-unspecified-value.$(toolset).$(name))
|
||||
{
|
||||
errors.user-error
|
||||
@@ -42,12 +46,28 @@ rule check-init-parameters ( toolset : * )
|
||||
"no value was specified in earlier initialization" :
|
||||
"an explicit value is specified now" ;
|
||||
}
|
||||
# The below logic is for intel compiler. It calls this rule
|
||||
# with 'intel-linux' and 'intel-win' as toolset, so we need to
|
||||
# get the base part of toolset name.
|
||||
# We can't pass 'intel' as toolset, because it that case it will
|
||||
# be impossible to register versionles intel-linux and
|
||||
# intel-win of specific version.
|
||||
local t = $(toolset) ;
|
||||
local m = [ MATCH ([^-]*)- : $(toolset) ] ;
|
||||
if $(m)
|
||||
{
|
||||
t = $(m[1]) ;
|
||||
}
|
||||
if ! $(.had-value.$(toolset).$(name))
|
||||
{
|
||||
feature.subfeature toolset $(toolset) : $(name) : : propagated ;
|
||||
if ! $(.declared-subfeature.$(t).$(name))
|
||||
{
|
||||
feature.subfeature toolset $(t) : $(name) : : propagated ;
|
||||
.declared-subfeature.$(t).$(name) = true ;
|
||||
}
|
||||
.had-value.$(toolset).$(name) = true ;
|
||||
}
|
||||
feature.extend-subfeature toolset $(toolset) : $(name) : $(value) ;
|
||||
feature.extend-subfeature toolset $(t) : $(name) : $(value) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -77,8 +97,39 @@ rule check-init-parameters ( toolset : * )
|
||||
errors.user-error $(message[1]) : $(message[2]) : $(message[3]) : $(message[4]) ;
|
||||
}
|
||||
.all-signatures += $(sig) ;
|
||||
|
||||
return $(condition) ;
|
||||
}
|
||||
|
||||
# A helper rule to get the command to invoke some tool. The rule is either passed
|
||||
# a user provided command, it which case it checks it for correctness, or it tries
|
||||
# to find the tool using it's name, the PATH, and additional path.
|
||||
# This rule returns the command to be used when invoking the tool. If we can't
|
||||
# find the tool, a warning is issued.
|
||||
rule get-invocation-command (
|
||||
toolset : tool : user-provided-command ? : additional-paths * )
|
||||
{
|
||||
local command ;
|
||||
if ! $(user-provided-command)
|
||||
{
|
||||
command = [ common.find-tool $(tool) : $(additional-paths) ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
command = [ common.check-tool $(user-provided-command) ] ;
|
||||
}
|
||||
if ! $(command)
|
||||
{
|
||||
ECHO "warning: toolset $(toolset) initialization: can't find tool $(tool)" ;
|
||||
ECHO "warning: initialized from" [ errors.nearest-user-location ] ;
|
||||
# It's possible, in theory, that user-provided command is OK, but we're
|
||||
# not smart enough to understand that.
|
||||
command = $(user-provided-command) ;
|
||||
}
|
||||
return $(command) ;
|
||||
}
|
||||
|
||||
|
||||
# Attempts to find tool (binary) named 'name' in PATH and in 'additiona-paths'.
|
||||
# If found in path, returns 'name'.
|
||||
# If found in additional paths, returns full name. If there are several possibilities,
|
||||
@@ -105,7 +156,7 @@ rule check-tool ( command )
|
||||
{
|
||||
if $(command:D)
|
||||
{
|
||||
if [ path.exist [ path.make $(command) ] ]
|
||||
if [ path.exists $(command) ]
|
||||
{
|
||||
return $(command) ;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import common ;
|
||||
import errors ;
|
||||
|
||||
feature.extend-subfeature toolset intel : platform : linux ;
|
||||
|
||||
toolset.inherit-generators intel-linux
|
||||
<toolset>intel <toolset-intel:platform>linux : gcc ;
|
||||
toolset.inherit-flags intel-linux : gcc
|
||||
@@ -26,25 +27,12 @@ toolset.inherit-rules intel-linux : gcc ;
|
||||
# compile and link options allow you to specify addition command line options for each version
|
||||
rule init ( version ? : name ? : compile_options * : link_options * )
|
||||
{
|
||||
common.check-init-parameters intel-linux : version $(version) ;
|
||||
if ! $(name)
|
||||
{
|
||||
name = [ common.find-tool "icc" : /opt/intel_cc_80/bin ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = [ common.check-tool $(name) ] ;
|
||||
}
|
||||
if ! $(name)
|
||||
{
|
||||
ECHO "warning: intel toolset configuration: could not find compiler " ;
|
||||
ECHO "warning: initialized from" [ errors.nearest-user-location ] ;
|
||||
}
|
||||
|
||||
local condition = <toolset>intel-linux-$(version) ;
|
||||
condition ?= <toolset>intel-linux ;
|
||||
local condition = [ common.check-init-parameters intel-linux
|
||||
: version $(version) ] ;
|
||||
|
||||
feature.extend-subfeature toolset intel : version : $(version) ;
|
||||
name = [ common.get-invocation-command intel-linux : icc
|
||||
: $(name) : /opt/intel_cc_80/bin ] ;
|
||||
|
||||
flags intel-linux CONFIG_NAME $(condition) : $(name) ;
|
||||
flags intel-linux CONFIG_COMPILE $(condition) : $(compile_options) ;
|
||||
flags intel-linux CONFIG_LINK $(condition) : $(link_options) ;
|
||||
|
||||
@@ -15,7 +15,6 @@ import common ;
|
||||
import intel ;
|
||||
|
||||
feature.extend-subfeature toolset intel : platform : win ;
|
||||
feature.subfeature toolset intel : base-vc ;
|
||||
|
||||
import msvc ;
|
||||
toolset.inherit-generators intel-win <toolset>intel <toolset-intel:platform>win : msvc ;
|
||||
@@ -23,32 +22,42 @@ toolset.inherit-flags intel-win : msvc ;
|
||||
toolset.inherit-rules intel-win : msvc ;
|
||||
|
||||
# Initializes the intel toolset for windows
|
||||
rule init ( version : # version is mandatory
|
||||
setup : # patch to the iclvars.bat script
|
||||
base-vc ? # VC version to emulate: either 'vc6', 'vc7' or 'vc7.1'
|
||||
# vc6 is used by default
|
||||
rule init ( version ? : # the compiler version
|
||||
command ? : # the command to invoke the compiler itself
|
||||
compatibility ? # Compatibility mode: either 'vc6', 'vc7', 'vc7.1'
|
||||
# or 'native'.
|
||||
)
|
||||
{
|
||||
base-vc ?= vc6 ;
|
||||
feature.extend-subfeature toolset intel : base-vc : $(base-vc) ;
|
||||
|
||||
feature.extend-subfeature toolset intel : version : $(version) ;
|
||||
|
||||
check-setup $(version) : $(setup) ;
|
||||
local condition = [ common.check-init-parameters intel-win
|
||||
: version $(version) : compatibility $(compatibility) ] ;
|
||||
|
||||
setup = "call \""$(setup)"\" > nul " ;
|
||||
command = [ common.get-invocation-command intel-win : icc.exe :
|
||||
$(command) ] ;
|
||||
|
||||
|
||||
if [ os.name ] = NT
|
||||
{
|
||||
setup = $(setup)"
|
||||
local setup ;
|
||||
if $(command:D)
|
||||
{
|
||||
setup = $(command:D)/iclvars.bat ;
|
||||
setup = "call \""$(setup)"\" > nul " ;
|
||||
|
||||
if [ os.name ] = NT
|
||||
{
|
||||
setup = $(setup)"
|
||||
" ;
|
||||
}
|
||||
else
|
||||
{
|
||||
setup = "cmd /S /C "$(setup)" \"&&\" " ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setup = "cmd /S /C "$(setup)" \"&&\" " ;
|
||||
setup = "" ;
|
||||
}
|
||||
|
||||
local condition = <toolset>intel-win-$(version)-$(base-vc) ;
|
||||
|
||||
|
||||
flags intel-win.compile .CC $(condition) : $(setup)icl ;
|
||||
flags intel-win.link .LD $(condition) : $(setup)xilink ;
|
||||
flags intel-win.archive .LD $(condition) : $(setup)xilink ;
|
||||
@@ -74,7 +83,7 @@ rule init ( version : # version is mandatory
|
||||
C++FLAGS += /Qansi_alias ;
|
||||
}
|
||||
|
||||
if $(base-vc) = vc6
|
||||
if $(compatibility) = vc6
|
||||
{
|
||||
C++FLAGS +=
|
||||
# Emulate VC6
|
||||
@@ -97,7 +106,7 @@ rule init ( version : # version is mandatory
|
||||
;
|
||||
}
|
||||
}
|
||||
if $(base-vc)
|
||||
if $(compatibility) && $(compatibility) != native
|
||||
{
|
||||
C++FLAGS += /Q$(base-vc) ;
|
||||
}
|
||||
@@ -105,13 +114,4 @@ rule init ( version : # version is mandatory
|
||||
|
||||
}
|
||||
|
||||
rule check-setup ( version : setup )
|
||||
{
|
||||
if ! [ GLOB $(setup:D) : $(setup:D=) ]
|
||||
{
|
||||
ECHO warning: toolset intel-win $(version) initialization: ;
|
||||
ECHO warning: couldn't find compiler ;
|
||||
}
|
||||
}
|
||||
|
||||
flags intel-win.link LIBRARY_OPTION <toolset>intel : "" ;
|
||||
|
||||
@@ -13,7 +13,6 @@ import toolset ;
|
||||
|
||||
feature.extend toolset : intel ;
|
||||
feature.subfeature toolset intel : platform : : propagated link-incompatible ;
|
||||
feature.subfeature toolset intel : version : : propagated ;
|
||||
|
||||
rule init ( * : * )
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ import os ;
|
||||
import toolset : flags ;
|
||||
import feature ;
|
||||
import type ;
|
||||
import common ;
|
||||
|
||||
feature.extend toolset : sun ;
|
||||
toolset.inherit sun : unix ;
|
||||
@@ -20,40 +21,15 @@ feature.compose <stdlib>sun-stlport
|
||||
: <cxxflags>-library=stlport4 <linkflags>-library=stlport4
|
||||
;
|
||||
|
||||
# Installation root to use for versionless toolset
|
||||
.root = "/opt/SUNWspro/bin/" ;
|
||||
|
||||
rule init ( version ? : root ? )
|
||||
rule init ( version ? : command ? )
|
||||
{
|
||||
# If version is not provided, change the global variable
|
||||
if ! $(version)
|
||||
{
|
||||
if ! $(root)
|
||||
{
|
||||
# versionless and rootless, we assume that user has CC
|
||||
# in the path, so we try and find it, and set up the
|
||||
# paths accordingly
|
||||
import regex ;
|
||||
import modules ;
|
||||
local SUNCC = [ GLOB [ modules.peek : Path ] [ modules.peek : PATH ] : CC ] ;
|
||||
root = $(SUNCC[1]:D) ; root = $(root:P) ;
|
||||
}
|
||||
if $(root)
|
||||
{
|
||||
toolset.flags sun .root <toolset>sun : $(root)/bin/ ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
feature exetend-subfeature toolset sun : version : $(version) ;
|
||||
local condition = <toolset>sun-$(version) ;
|
||||
root = $(root)/bin/ ;
|
||||
root ?= "" ;
|
||||
toolset.flags sun .root $(condition) : $(root) ;
|
||||
}
|
||||
# this return is needed, because if absent the unversion/unrooted
|
||||
# case doesn't work at all
|
||||
return ;
|
||||
local condition = [
|
||||
common.check-init-parameters sun : version $(version) ] ;
|
||||
|
||||
command = [ common.get-invocation-command sun : CC
|
||||
: $(command) : "/opt/SUNWspro/bin" ] ;
|
||||
|
||||
toolset.flags sun CONFIG_COMMAND $(condition) : $(command) ;
|
||||
}
|
||||
|
||||
# Declare generators
|
||||
@@ -76,12 +52,12 @@ flags sun.compile INCLUDES <include> ;
|
||||
|
||||
actions compile.c
|
||||
{
|
||||
"$(.root)cc" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
"$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
actions compile.c++
|
||||
{
|
||||
"$(.root)CC" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
"$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
# Declare flags and actions for linking
|
||||
@@ -106,7 +82,7 @@ rule link ( targets * : sources * : properties * )
|
||||
|
||||
actions link bind LIBRARIES
|
||||
{
|
||||
"$(.root)CC" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
|
||||
"$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
|
||||
}
|
||||
|
||||
# Slight mods for dlls
|
||||
@@ -117,12 +93,12 @@ rule link.dll ( targets * : sources * : properties * )
|
||||
|
||||
actions link.dll bind LIBRARIES
|
||||
{
|
||||
"$(.root)CC" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" -h$(<[1]:D=) -G "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
|
||||
"$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" -h$(<[1]:D=) -G "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
|
||||
}
|
||||
|
||||
# Declare action for creating static libraries
|
||||
actions piecemeal archive
|
||||
{
|
||||
"$(.root)CC" -xar -o "$(<)" "$(>)"
|
||||
"$(CONFIG_COMMAND)" -xar -o "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user