Boost logo

Boost-Build :

From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-08-30 14:45:10


Hi,

I attached the MSVC and MS Platform SDK parts of the patch. All changes
are localized in 'boost/tools/build/v2/tools'. You can see that even
this two parts are quite big. Nevertheless 'msplatformsdk.jam' cannot be
reviewed without 'msvc.jam' and accompanying changes.

What's new:

- Global <cpu-arch> feature and its support with VS8;
- Global <msplatformsdk> feature controls MS PSDK-based builds;
- Autodetection code moved to msvc.jam;
- Setup prefix has been changed for Cygwin. 'vcvars32.bat' can be
called only once per action now - not before each command as before:

$(CONFIG_COMMAND:E=)
$(.CC) ...
$(.MANIFEST) ...

- Default version of "C++ Toolkit" is changed to "7.1toolkit". This
allows to use both VS7.1 and C++ Toolkit simultaneously.

Looking forward to your comments.

PS: I will post 'rc' part of the patch a bit later. It is more of less
independent from other changes. 'midl' and 'mc' parts depend on the
changes I'm posting now. So I can't make .diff for them. We'll get back
to them as soon as we finish with this part.

Best regards/Venlig hilsen,
Alexey Pakhunov.
 --------------000402020904000003020806 Content-Type: text/plain;
name="msvc64.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="msvc64.diff"

? msplatformsdk.jam
Index: builtin.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/builtin.jam,v
retrieving revision 1.176
diff -c -3 -r1.176 builtin.jam
*** builtin.jam 16 Aug 2005 10:59:50 -0000 1.176
--- builtin.jam 30 Aug 2005 18:40:18 -0000
***************
*** 32,37 ****
--- 32,44 ----

feature stdlib : native : propagated composite ;

+ # <msplatformsdk> provides ability to chosse between MS Platform SDK
+ # headers and libraries and standalone MS Platform SDK.
+ feature msplatformsdk : builtin external : propagated ;
+
+ # <cpu-arch> configures target CPU architecture for cross-compiling.
+ feature cpu-arch : i386 amd64 ia64 : propagated ;
+
feature link : shared static : propagated ;
feature runtime-link : shared static : propagated ;
feature runtime-debugging : on off : propagated ;
Index: common.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/common.jam,v
retrieving revision 1.39
diff -c -3 -r1.39 common.jam
*** common.jam 6 Jun 2005 10:21:41 -0000 1.39
--- common.jam 30 Aug 2005 18:40:18 -0000
***************
*** 16,21 ****
--- 16,111 ----
import path ;
import sequence ;
import toolset ;
+ import regex ;
+
+
+ # Configurations
+ #
+ # The following class helps to manage toolset configurations. Each configuration
+ # used 'condition' as a key (for example '<toolset>msvc-8.0') and the list of
+ # options. Options may include any details about the configuration like
+ # 'command', 'path', etc. A configuration may be in one of two states:
+ #
+ # - registered - a configuration is listed but none of toolsets is using it yet;
+ # - used - a configuration is used by a toolset.
+ #
+ # The main difference between the states is that while a configuration is
+ # 'registered' its options can be freely changed. This is useful in particular
+ # for autodetection code - all detected configurations may be safely overwritten
+ # by a user.
+
+ class configurations
+ {
+ import errors : error ;
+
+ rule __init__ ( )
+ {
+ }
+
+ # Registers a configuration
+ rule register ( id )
+ {
+ if $(id) in $(self.used)
+ {
+ error "common: the configuration '$(id)' is in use" ;
+ }
+
+ local retval ;
+
+ if ! $(id) in $(self.all)
+ {
+ self.all += $(id) ;
+
+ # indicate that a new configuration has been added
+ retval = true ;
+ }
+
+ return $(retval) ;
+ }
+
+ # Mark a configuration as 'used'
+ rule use ( id )
+ {
+ if ! $(id) in $(self.all)
+ {
+ error "common: the configuration '$(id)' is not known" ;
+ }
+
+ local retval ;
+
+ if ! $(id) in $(self.used)
+ {
+ self.used += $(id) ;
+
+ # indicate that the configuration has been marked as 'used'
+ retval = true ;
+ }
+
+ return $(retval) ;
+ }
+
+ # Return all registered configurations
+ rule all ( )
+ {
+ return $(self.all) ;
+ }
+
+ # Return all used configurations
+ rule used ( )
+ {
+ return $(self.used) ;
+ }
+
+ rule get ( id : param )
+ {
+ return $(self.$(param).$(id)) ;
+ }
+
+ rule set ( id : param : value * )
+ {
+ self.$(param).$(id) = $(value) ;
+ }
+ }

# The rule checks toolset parameters. Each trailing parameter
***************
*** 30,39 ****
# 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]) ;
--- 120,131 ----
# all the values.
#
# The return value from this rule is a condition to be used for flags settings.
! rule check-init-parameters ( toolset toolset-feature ? : * )
{
+ toolset-feature ?= toolset ;
+
local sig = $(toolset) ;
! local condition = <$(toolset-feature)>$(toolset) ;
for local index in 2 3 4 5 6 7 8 9
{
local name = $($(index)[1]) ;
***************
*** 65,76 ****
{
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 $(t) : $(name) : $(value) ;
}
else
{
--- 157,168 ----
{
if ! $(.declared-subfeature.$(t).$(name))
{
! feature.subfeature $(toolset-feature) $(t) : $(name) : : propagated ;
.declared-subfeature.$(t).$(name) = true ;
}
.had-value.$(toolset).$(name) = true ;
}
! feature.extend-subfeature $(toolset-feature) $(t) : $(name) : $(value) ;
}
else
{
Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.49
diff -c -3 -r1.49 msvc.jam
*** msvc.jam 2 Aug 2005 05:38:42 -0000 1.49
--- msvc.jam 30 Aug 2005 19:00:07 -0000
***************
*** 11,20 ****
import errors : error ;
import feature : feature get-values ;
import path ;
import sequence : unique ;
import common ;
-
import rc ;

if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
--- 11,22 ----
import errors : error ;
import feature : feature get-values ;
import path ;
+ import regex ;
import sequence : unique ;
import common ;
import rc ;
+ import "class" : new ;
+ import msplatformsdk ;

if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
***************
*** 30,35 ****
--- 32,40 ----
# to be seen, though ;-)
;

+ # List of all registered configurations
+ .versions = [ new configurations ] ;
+
RM = [ common.rm-command ] ;

# Initialize the toolset for a specific version. As the result, path to
***************
*** 54,237 ****
# Note: for free VC7.1 tools, we don't correctly find vcvars32.bar when user
# explicitly provides a path.
rule init (
! version ? # the msvc version which is being configured. When omitted
# the tools invoked when no explicit version is given will be configured.
: command *
! # the command to invoke the compiler. If not specified:
! # - if version is given, default location for that version will be searched
! #
! # - if version is not given, default locations for 7.1, 7.0 and 6.* will
! # be searched
! #
! # - if compiler is not found in default locations, PATH will be searched.
: options *
! # options can include <setup>, <compiler>, <linker> and <resource-compiler>
)
! {
! # setup will be used if a path has been specified. If setup is
! # not specified, vcvars32.bat will be used instead.
! setup = [ get-values <setup> : $(options) ] ;
! setup ?= vcvars32.bat ;
! compiler = [ get-values <compiler> : $(options) ] ;
! compiler ?= cl ;
! linker = [ get-values <linker> : $(options) ] ;
! linker ?= link ;
! resource-compiler = [ get-values <resource-compiler> : $(options) ] ;
! resource-compiler ?= rc ;
!
! local condition = [ common.check-init-parameters msvc :
! version $(version) ] ;
!
! # If version is specified, we try to search first in default paths,
! # and only then in PATH.
! command = [ common.get-invocation-command msvc : cl.exe : $(command)
! : [ default-paths $(version) ] : $(version) ] ;
!
! common.handle-options msvc : $(condition) : $(command) : $(options) ;
!
if $(command)
! {
! command = [ common.get-absolute-tool-path $(command[-1]) ] ;
}
! local root = $(command:D) ;
!
! setup = $(root)\\bin\\$(setup) ;
!
! # CONSIDER: What's the point of 'call'. Can we invoke the script directly?
! setup = "call \""$(setup)"\" > nul " ;
!
! if [ os.name ] = NT
{
! setup = $(setup)"
! " ;
}
! else
{
! setup = "cmd /S /C "$(setup)" \"&&\" " ;
}

! # prefix with setup, or quoted path if any
! local prefix = $(setup) ;
!
! flags msvc.compile .CC $(condition) : $(prefix)$(compiler) ;
! flags msvc.compile .RC $(condition) : $(prefix)$(resource-compiler) ;
! flags msvc.link .LD $(condition) : $(prefix)$(linker) ;
! flags msvc.archive .LD $(condition) : $(prefix)$(linker) ;
!
! if ! $(version)
{
! # Even if version is not explicitly specified, try to detect the version
! # from the path.
! if [ MATCH "(Microsoft Visual Studio 8)" : $(command) ]
{
! version = 8.0 ;
! }
! else if [ MATCH "(NET 2003[\/\\]VC7)" : $(command) ] ||
! [ MATCH "(Microsoft Visual C\\+\\+ Toolkit 2003)" : $(command) ]
{
! version = 7.1 ;
}
! else if [ MATCH "(.NET[\/\\]VC7)" : $(command) ]
{
! version = 7.0 ;
}
else
{
! version = 6.0 ;
! }
! }
!
! # Starting with versions 7.0, the msvc compiler have the /Zc:forScope
! # and /Zc:wchar_t options that improve C++ standard conformance, but
! # those options are off by default.
! # If we're sure that msvc version is at 7.*, add those options explicitly.
! # We can be sure either if user specified version 7.* explicitly,
! # or if the installation path contain 7.* (this is checked above).
! if ! [ MATCH ^(6\\.) : $(version) ]
! {
! flags msvc.compile CFLAGS $(condition) : /Zc:forScope /Zc:wchar_t ;
! }
!
! # 8.0 deprecates some of the options
! if ! [ MATCH ^([67]\\.) : $(version) ]
! {
! flags msvc.link MANIFEST $(condition) : "mt -nologo -manifest " ;
! flags msvc.link OUTPUTRESOURCE $(condition) : "-outputresource:" ;
}
- else
- {
- flags msvc.compile CFLAGS $(condition)/<optimization>speed $(condition)/<optimization>space : /Ogiy /Gs ;
- flags msvc.compile CFLAGS $(condition)/<optimization>speed : /Ot ;
- flags msvc.compile CFLAGS $(condition)/<optimization>space : /Os ;
- }
}

- rule default-paths ( version ? )
- {
- local possible-paths ;
-
- local ProgramFiles = [ os.environ ProgramFiles ] ;
- if ! $(ProgramFiles)
- {
- ProgramFiles = "c:\\Program Files" ;
- }

! local version-6-path = $(ProgramFiles)"\\Microsoft Visual Studio\\VC98" ;
! local version-7-path = $(ProgramFiles)"\\Microsoft Visual Studio .NET\\VC7" ;
! local version-7.0-path = $(version-7-path) ;
! local version-7.1-path = $(ProgramFiles)"\\Microsoft Visual Studio .NET 2003\\VC7" ;
! local version-8.0-path = $(ProgramFiles)"\\Microsoft Visual Studio 8" ;

! local VS71COMNTOOLS = [ os.environ VS71COMNTOOLS ] ;
! if $(VS71COMNTOOLS)
{
! # VS71COMNTOOLS is set by VS .NET 2003 to <VSDIR>\Common7\Tools
! version-7.1-path = [ path.make $(VS71COMNTOOLS) ] ;
! version-7.1-path = [ path.parent $(version-7.1-path) ] ;
! version-7.1-path = [ path.parent $(version-7.1-path) ] ;
! version-7.1-path = [ path.join $(version-7.1-path) "VC7" ] ;
! version-7.1-path = [ path.native $(version-7.1-path) ] ;
! }
!
! local VS80COMNTOOLS = [ os.environ VS80COMNTOOLS ] ;

! if $(VS80COMNTOOLS)
! {
! # VS80COMNTOOLS is set by VS .NET 2005 to <VSDIR>\Common7\Tools
! version-8.0-path = [ path.make "$(VS80COMNTOOLS)" ] ;
! version-8.0-path = [ path.parent $(version-8.0-path) ] ;
! version-8.0-path = [ path.parent $(version-8.0-path) ] ;
! version-8.0-path = [ path.join $(version-8.0-path) "VC" ] ;
! version-8.0-path = [ path.native $(version-8.0-path) ] ;
!
}

! # Fixed so we don't add paths without \\bin to all versions.
! # Path without 7.1

if $(version)
{
! local v = [ MATCH ^(6|[^6].*) : $(version) ] ;
! possible-paths += $(version-$(v)-path) ;
}
else
{
! possible-paths += $(version-8.0-path) $(version-7.1-path) $(version-7.0-path) $(version-6-path) ;
! }
!
! # The vcvars32.bat is actually in "bin" directory.
! # (except for free VC7.1 tools)
! possible-paths = $(possible-paths)\\bin ;
!
! local VCToolkitInstallDir = [ os.environ VCToolkitInstallDir ] ;
! if $(VCToolkitInstallDir)
! {
! if $(version) = "7.1" || ! $(version)
{
! # NOTE it's impossible to switch between Toolkit and VS.
! # I wonder is toolkit and VS can be installed together?
! possible-paths += [ path.native [ path.make $(VCToolkitInstallDir) ] ] ;
!
}
}

--- 59,387 ----
# Note: for free VC7.1 tools, we don't correctly find vcvars32.bar when user
# explicitly provides a path.
rule init (
! version ? # the msvc version which is being configured. When omitted
# the tools invoked when no explicit version is given will be configured.
: command *
! # the command to invoke the compiler. If not specified:
! # - if version is given, default location for that version will be searched
! #
! # - if version is not given, default locations for 7.1, 7.0 and 6.* will
! # be searched
! #
! # - if compiler is not found in default locations, PATH will be searched.
: options *
! # options can include <setup>, <compiler>, <linker> and <resource-compiler>
)
! {
if $(command)
! {
! options += <command>$(command) ;
}
!
! configure $(version) : $(options) ;
! }
!
!
! # 'configure' is a newer version of 'init'. The parameter 'command' is passed as
! # a part of the 'options' list.
! rule configure (
! version ? :
! options *
! )
! {
! switch $(version)
{
! case all :
! if $(options)
! {
! error "msvc: options should be empty when 'all' is specified" ;
! }
!
! # use all detected versions
! for local v in [ $(.versions).all ]
! {
! configure-really $(v) ;
! }
!
! case "default" :
! configure-really : $(options) ;
!
! case * :
! configure-really $(version) : $(options) ;
}
! }
!
!
! local rule configure-really (
! version ? :
! options *
! )
! {
! # If no version supplied use the default configuration. Note that condition
! # remains versionless.
! local v = $(version) ;
! if ! $(v)
{
! # take the first detected version
! version = $($(.versions).all[1]) ;
!
! # Note: 'version' can still be empty at this point if no versions were
! # detected.
! version ?= "default" ;
}

! # If non empty 'options' is given use them instead of any autodetected
! # configuration
! if $(options)
! {
! # register a new configuration
! $(.versions).register $(version) ;
! $(.versions).set $(version) : options : $(options) ;
! }
!
! # Mark the configuration as 'used'.
! if [ $(.versions).use $(version) ]
{
! options = [ $(.versions).get $(version) : options ] ;
!
! # Generate condition and save it
! local condition = [ common.check-init-parameters msvc :
! version $(v) ] ;
!
! $(.versions).set $(version) : condition : $(condition) ;
!
!
! # Register Platform SDK configurations
! msplatformsdk.register-toolset msvc : $(condition) ;
!
!
! local command = [ get-values <command> : $(options) ] ;
!
! # If version is specified, try to search first in default paths,
! # and only then in PATH.
! command = [ common.get-invocation-command msvc : cl.exe : $(command)
! : [ default-paths $(version) ] : $(version) ] ;
!
!
! if ! $(version)
{
! # Even if version is not explicitly specified, try to detect the version
! # from the path.
! if [ MATCH "(Microsoft Visual Studio 8)" : $(command) ]
! {
! version = 8.0 ;
! }
! else if [ MATCH "(NET 2003[\/\\]VC7)" : $(command) ]
! {
! version = 7.1 ;
! }
! else if [ MATCH "(Microsoft Visual C\\+\\+ Toolkit 2003)" : $(command) ]
! {
! version = 7.1toolkit ;
! }
! else if [ MATCH "(.NET[\/\\]VC7)" : $(command) ]
! {
! version = 7.0 ;
! }
! else
! {
! version = 6.0 ;
! }
! }
!
!
! # Generate and register setup command
!
! local below-8.0 = [ MATCH ^([67]\\.) : $(version) ] ;
!
! local setup ;
! local arch ;
!
! if $(command)
! {
! command = [ common.get-absolute-tool-path $(command[-1]) ] ;
!
! local parent = [ path.make $(command) ] ;
! parent = [ path.parent $(parent) ] ;
! parent = [ path.native $(parent) ] ;
!
! setup = [ get-values <setup> : $(options) ] ;
!
! if $(below-8.0)
! {
! setup ?= vcvars32.bat ;
! }
! else
! {
! setup ?= vcvarsall.bat ;
! }
!
! # The vccars32.bat is actually in "bin" directory.
! # (except for free VC7.1 tools)
! setup = [ GLOB $(command) $(parent) : $(setup) ] ;
!
! if $(setup)
! {
! # Note Cygwin to Windows translation
! setup = "\""$(setup[1]:W)"\"" ;
!
! if ! $(below-8.0)
! {
! arch = i386 amd64 ia64 ;
! setup = $(setup)" x86" $(setup)" x86_amd64" $(setup)" x86_ia64" ;
! }
! }
! }
!
! if ! $(setup)
! {
! error "msvc: Visual Studio setup script not found" ;
! }
!
! # 'vcvars32.bat cannot be invoken directly on cygwin. Instead we use
! # cmd.exe to execute it and export required environment variables (INCLUDE,
! # LIB, PATH). The following command is used:
! #
! # eval "`cmd.exe /S /C call "vcvars32.bat" "&&" sh -c "export" | egrep "export \<(INCLUDE|LIB|PATH)\>"`"
!
! local prefix = "call " ;
! local suffix = " >nul
! " ;
! if ! [ os.name ] in NT
{
! prefix = "eval \"`cmd.exe /S /C call " ;
! suffix = " \"&&\" sh -c \"export\" | egrep \"export \\<(INCLUDE|LIB|PATH)\\>\"`\"
! " ;
}
!
! command = $(prefix)$(setup)$(suffix) ;
!
! # register setup commands as $(CONFIG_COMMAND)
! if $(below-8.0)
{
! if $(.debug-configuration)
! {
! ECHO "msvc: condition: '$(condition)', command: '$(command)'" ;
! }
!
! common.handle-options msvc : $(condition) : $(command) : $(options) ;
}
else
{
! # VS8 compiles for i386, amd64 and ia64
! for local i in 1 2 3
! {
! if $(arch[$(i)])
! {
! if $(.debug-configuration)
! {
! ECHO "msvc: condition:"
! "'$(condition)/<cpu-arch>$(arch[$(i)])',"
! "command: '$(command[$(i)])'" ;
! }
!
! common.handle-options msvc :
! $(condition)/<cpu-arch>$(arch[$(i)]) : $(command[$(i)]) : $(options) ;
! }
! }
! }
!
!
! # Get tool names (if any) and finish setup
!
! compiler = [ get-values <compiler> : $(options) ] ;
! compiler ?= cl ;
!
! linker = [ get-values <linker> : $(options) ] ;
! linker ?= link ;
!
! resource-compiler = [ get-values <resource-compiler> : $(options) ] ;
! resource-compiler ?= rc ;
!
! flags msvc.compile .CC $(condition) : $(compiler) ;
! flags msvc.compile .RC $(condition) : $(resource-compiler) ;
! flags msvc.link .LD $(condition) : $(linker) ;
! flags msvc.archive .LD $(condition) : $(linker) ;
!
!
! # Starting with versions 7.0, the msvc compiler have the /Zc:forScope
! # and /Zc:wchar_t options that improve C++ standard conformance, but
! # those options are off by default.
! # If we're sure that msvc version is at 7.*, add those options explicitly.
! # We can be sure either if user specified version 7.* explicitly,
! # or if the installation path contain 7.* (this is checked above).
! if ! [ MATCH ^(6\\.) : $(version) ]
! {
! flags msvc.compile CFLAGS $(condition) : /Zc:forScope /Zc:wchar_t ;
! }
!
! if $(version) = 7.0
! {
! # Add -GS (Buffer Security Check) for VC++ 7.0
! flags msvc.compile CFLAGS $(condition) : /GS ;
! }
!
! # 8.0 deprecates some of the options
! if $(below-8.0)
! {
! flags msvc.compile CFLAGS $(condition)/<optimization>speed $(condition)/<optimization>space : /Ogiy /Gs ;
! flags msvc.compile CFLAGS $(condition)/<optimization>speed : /Ot ;
! flags msvc.compile CFLAGS $(condition)/<optimization>space : /Os ;
! }
! else
! {
! flags msvc.link MANIFEST $(condition)/<msplatformsdk>builtin : "mt -nologo -manifest " ;
! flags msvc.link OUTPUTRESOURCE $(condition)/<msplatformsdk>builtin : "-outputresource:" ;
! }
}
}

! # Returns the default installation path for the given version.
! local rule default-path ( version )
! {
! local path ;

! if $(.version-$(version)-path)
{
! # Check environment
! if $(.version-$(version)-env)
! {
! local vc-path = [ os.environ $(.version-$(version)-env) ] ;
! if $(vc-path)
! {
! vc-path = [ path.make $(vc-path) ] ;
! vc-path = [ path.join $(vc-path) $(.version-$(version)-envpath) ] ;
! vc-path = [ path.native $(vc-path) ] ;

! path = $(vc-path) ;
! }
! }
!
! if ! $(path)
! {
! path = [ path.native [ path.join $(.ProgramFiles) $(.version-$(version)-path) ] ] ;
! }
}

! return $(path) ;
! }

+ # Returns either the default installation path (if 'version' is not empty) or list of all
+ # known default paths (if no version is given)
+ rule default-paths ( version ? )
+ {
+ local possible-paths ;
+
if $(version)
{
! default-path += [ default-path $(version) ] ;
}
else
{
! for local i in $(.known-versions)
{
! default-path += [ default-path $(i) ] ;
}
}

***************
*** 296,310 ****
--- 446,467 ----
# The actions differ only by explicit selection of input language
actions compile.c bind RSP
{
+ $(CONFIG_COMMAND:E=)
+ $(CONFIG_MSPSDK:E=)
$(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"$(RSP:W)" -c -Fo"$(<[1]:W)" && $(RM) "$(RSP)"
}
+
actions compile.c++ bind RSP
{
+ $(CONFIG_COMMAND:E=)
+ $(CONFIG_MSPSDK:E=)
$(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(USER_CFLAGS) @"$(RSP:W)" -c -Fo"$(<[1]:W)" && $(RM) "$(RSP)"
}

actions compile.rc
{
+ $(CONFIG_COMMAND:E=)
+ $(CONFIG_MSPSDK:E=)
$(.RC) -l 0x409 -U$(UNDEFS) -D$(DEFINES) -I"$(INCLUDES)" -fo "$(<:W)" "$(>:W)"
}

***************
*** 324,332 ****

flags msvc LINKFLAGS <main-target-type>LIB/<link>shared : /DLL ;

! toolset.flags msvc.link USER_LINKFLAGS <linkflags> ;
! toolset.flags msvc.link LINKPATH <library-path> ;
!

flags msvc.link FINDLIBS_ST <find-static-library> ;
flags msvc.link FINDLIBS_SA <find-shared-library> ;
--- 481,488 ----

flags msvc LINKFLAGS <main-target-type>LIB/<link>shared : /DLL ;

! flags msvc.link USER_LINKFLAGS <linkflags> ;
! flags msvc.link LINKPATH <library-path> ;

flags msvc.link FINDLIBS_ST <find-static-library> ;
flags msvc.link FINDLIBS_SA <find-shared-library> ;
***************
*** 361,366 ****
--- 517,524 ----
actions archive bind RSP
{
if exist "$(<[1])" DEL "$(<[1])"
+ $(CONFIG_COMMAND:E=)
+ $(CONFIG_MSPSDK:E=)
$(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(RSP)" && $(RM) "$(RSP)"
}
}
***************
*** 369,375 ****
actions archive bind RSP
{
$(RM) "$(<[1])"
! $(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(RSP)" && $(RM) "$(RSP)"
}
}

--- 527,535 ----
actions archive bind RSP
{
$(RM) "$(<[1])"
! $(CONFIG_COMMAND:E=)
! $(CONFIG_MSPSDK:E=)
! $(.LD) /lib /NOLOGO /out:"$(<[1]:W)" @"$(RSP:W)" && $(RM) "$(RSP)"
}
}

***************
*** 387,400 ****

actions link bind DEF_FILE RSP
{
$(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(USER_LINKFLAGS) @"$(RSP:W)" && $(RM) "$(RSP)"
! $(MANIFEST)$(<[1]).manifest $(OUTPUTRESOURCE)$(<[1]);#2
}

actions link.dll bind DEF_FILE RSP
{
$(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(USER_LINKFLAGS) @"$(RSP:W)" && $(RM) "$(RSP)"
! $(MANIFEST)$(<[1]).manifest $(OUTPUTRESOURCE)$(<[1]);#2
}

rule compile.c++ ( targets + : sources * : properties * )
--- 547,564 ----

actions link bind DEF_FILE RSP
{
+ $(CONFIG_COMMAND:E=)
+ $(CONFIG_MSPSDK:E=)
$(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(USER_LINKFLAGS) @"$(RSP:W)" && $(RM) "$(RSP)"
! $(MANIFEST)"$(<[1]:W).manifest" "$(OUTPUTRESOURCE)$(<[1]:W);#2"
}

actions link.dll bind DEF_FILE RSP
{
+ $(CONFIG_COMMAND:E=)
+ $(CONFIG_MSPSDK:E=)
$(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(USER_LINKFLAGS) @"$(RSP:W)" && $(RM) "$(RSP)"
! $(MANIFEST)"$(<[1]:W).manifest" "$(OUTPUTRESOURCE)$(<[1]:W);#2"
}

rule compile.c++ ( targets + : sources * : properties * )
***************
*** 408,410 ****
--- 572,652 ----
}

+ #
+ # Autodetection code
+ # tries to detect versions listed as '.known-versions' using registry, environment
+ # and checking default paths. Supports both native Windows and Cygwin.
+ #
+
+ .ProgramFiles = [ path.make [ common.get-program-files-dir ] ] ;
+
+ .known-versions = 8.0 7.1 7.1toolkit 7.0 6.0 ;
+
+ # Default installation paths relative to "Program Files" directory
+ .version-6.0-path = "Microsoft Visual Studio" "VC98" "bin" ;
+ .version-7.0-path = "Microsoft Visual Studio .NET" "VC7" "bin" ;
+ .version-7.1-path = "Microsoft Visual Studio .NET 2003" "VC7" "bin" ;
+ .version-7.1toolkit-path = "Microsoft Visual C++ Toolkit 2003" "bin" ;
+ .version-8.0-path = "Microsoft Visual Studio 8" "VC" "bin" ;
+
+ # Known environment variables
+ .version-7.1-env = VS71COMNTOOLS ;
+ .version-7.1toolkit-env = VCToolkitInstallDir ;
+ .version-8.0-env = VS80COMNTOOLS ;
+
+ # Path to the folder containing "cl.exe" relative to the value of the corresponding
+ # environment variable
+ .version-7.1-envpath = ".." ".." "VC7" "bin" ;
+ .version-7.1toolkit-envpath = "bin" ;
+ .version-8.0-envpath = ".." ".." "VC" "bin" ;
+
+
+ # Validates given path, registers found configuration and prints debug information
+ # about it.
+ local rule register-configuration ( version : path )
+ {
+ local command = [ GLOB $(path) : cl.exe ] ;
+
+ if $(command)
+ {
+ if $(.debug-configuration)
+ {
+ ECHO "notice: msvc-$(version) detected, command: '$(command)'" ;
+ }
+
+ $(.versions).register $(version) ;
+ $(.versions).set $(version) : options : <command>$(command) ;
+ }
+ }
+
+ if [ os.name ] in NT
+ {
+ # Get installation paths from the registry
+
+ for local R in 8.0 7.1 7.0
+ {
+ local vc-path = [ W32_GETREG
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$(R)\\Setup\\VC"
+ : "ProductDir" ] ;
+ local vc-version = $(R) ;
+
+ if $(vc-path)
+ {
+ vc-path = [ path.native [ path.join [ path.make $(vc-path) ] "bin" ] ] ;
+
+ register-configuration $(vc-version) : $(vc-path) ;
+ }
+ }
+ }
+
+
+ # Check environment and default installation paths
+
+ for local i in $(.known-versions)
+ {
+ if ! $(i) in [ $(.versions).all ]
+ {
+ register-configuration $(i) : [ default-path $(i) ] ;
+ }
+ }
+
 --------------000402020904000003020806 Content-Type: text/plain;
name="msplatformsdk.jam"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="msplatformsdk.jam"

#~ Copyright 2005 Alexey Pakhunov.
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
#
# 'msplatformsdk.jam' allows using the latest MS Platform SDK headers, libraries
# and tools together with an older compiler. It works through the feature
# 'msplatformsdk'. The default value is '<msplatformsdk>builtin'. The default
# configuration of a compiler will be used. MS Platform SDK based build can be
# selected via '<msplatformsdk>external'. The value may be accompanied with
# the version specifier.
#
# Usage:
#
# # Use PSDK installation found in the defaul path
# using msplatformsdk ;
#
# # Use PSDK installed in 'foo/bar'
# using msplatformsdk : : <path>foo/bar ;
#
# # Use PSDK installed in 'foo/bar' and specify its version
# using msplatformsdk : 2003 : <path>foo/bar ;
#
# 'using msplatformsdk' adds PSDK-based configurations for all PSDK-aware toolsets.
# There is no difference whether 'using msplatformsdk' issued before or after
# those toolsets were configured.

import "class" : new ;
import common ;
import errors : error ;
import feature : feature get-values ;
import os ;
import path ;
import regex ;
import string ;
import toolset : flags ;

# Developers info:
#
# There are only three interface rules:
# - 'configure' - invoked by 'using msplatformsdk'. Accepts two parameters: 'version' and
# 'options'. Both are optional. 'options' can inlude only '<path>'. Other options are
# not recognized.
#
# - 'init' - the same as 'configure' but compatible with 'toolset.using'.
#
# - 'register-toolset' - this one should be called from 'init' rule of a toolset supporting
# PSDK-based builds. It accepts two mandatory parameters: toolset name and toolset
# condition. The condition returned by the rule 'common.check-init-parameters' which is
# normally used by all toolsets.
#
# The final result of calling 'init' and 'register-toolset' is properly configured 'CONFIG_MSPSDK'
# variable. The variable is expanded (depending on the conditions) to PSDK setup command which
# should be executed before using any tools or issuing any commands that are PSDK-dependent.

if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}

# Global variables
# All registered toolset configurations and PSDK versions.

.toolsets = [ new configurations ] ;
.versions = [ new configurations ] ;

# Initialize 'msplatformsdk' for a specific version. Two special version strings
# are recognized:
#
# - default: stands for the default configuration. If no configuration
# is supplied, this one is used;
# - all: all detected configurations.
#
# The only recognized option is '<path>'. It should be an absolute path to
# the directory where MS Platform SDK installed
# (f.e. "C:\\Program Files\\Microsoft Platform SDK").
#
rule configure (
version ? :
options *
)
{
switch $(version)
{
case all :
for local v in [ $(.versions).all ]
{
register-version $(v) ;
}

case "default" :
register-version : $(options) ;

case * :
register-version $(version) : $(options) ;
}
}

# For 'toolset.using'
rule init (
version ? :
path ? :
options *
)
{
if $(path)
{
options += <path>$(path) ;
}

configure $(version) : $(options) ;
}

local rule register-version (
version ? :
options *
)
{
# If no version supplied use the default configuration. Note that condition
# remains versionless.
local v = $(version) ;
if ! $(v)
{
# take the first detected version
version = $($(.versions).all[1]) ;

# Note: 'version' can still be empty at this point if no versions were
# detected.
version ?= "default" ;
}

if $(options)
{
# register a new configuration
$(.versions).register $(version) ;
$(.versions).set $(version) : path : [ get-values <path> : $(options) ] ;
}

# mark the configuration as 'used'.
if [ $(.versions).use $(version) ]
{
# Generate condition and save it
local condition = [
common.check-init-parameters external msplatformsdk :
version $(v)
] ;

$(.versions).set $(version) : condition : $(condition) ;

# register new configuration with all known toolsets
for local t in [ $(.toolsets).used ]
{
configure-really $(version) : $(t) ;
}
}
}

# Register a single toolset configuration. For instance:
#
# msplatformsdk.register-toolset <toolset>msvc-8.0 ;
#
# All available msplatformsdk configurations will be
# registered for the given toolset.
#
rule register-toolset ( toolset : toolset-condition )
{
$(.toolsets).register $(toolset-condition) ;
$(.toolsets).set $(toolset-condition) : toolset : $(toolset) ;

if [ $(.toolsets).use $(toolset-condition) ]
{
for local v in [ $(.versions).used ]
{
configure-really $(v) : $(toolset-condition) ;
}
}
}

# The same as 'common.path-variable-setting-command' but constructs NT-style path variable
rule nt-path-variable-setting-command ( variable : paths * )
{
# get list of NT paths
local nt-paths = $(paths:W) ;

if [ os.name ] in NT
{
nt-paths = $(nt-paths:J=";") ;
}
else
{
nt-paths = "\""$(nt-paths:J=";")"\"" ;
}

return [ common.variable-setting-command $(variable) : $(nt-paths) ] ;
}

# The same as 'common.prepend-path-variable-command' but constructs NT-style path variable
rule prepend-nt-path-variable-command ( variable : paths * )
{
return
[ nt-path-variable-setting-command
$(variable) :
$(paths) [ os.expand-variable $(variable) ]
] ;
}

# Register a single configuration in one toolset
local rule configure-really ( version : toolset-condition )
{
local path = [ $(.versions).get $(version) : path ] ;

# Validate path
local command = [ GLOB $(path) : SetEnv.Cmd ] ;
if ! $(command)
{
error "$(condition): Platform SDK setup script not found in '$(path)'" ;
}

path = [ path.make $(path) ] ;

# Generate and register setup commands for each of three CPU architecture
local bin = [ path.native [ path.join $(path) Bin ] ] ;
local bin_winnt = [ path.native [ path.join $(path) Bin WinNT ] ] ;
local bin_win64_x86_amd64 = [ path.native [ path.join $(path) Bin Win64 x86 AMD64 ] ] ;
local bin_win64_ia64 = [ path.native [ path.join $(path) Bin Win64 IA64 ] ] ;
local bin_win64 = [ path.native [ path.join $(path) Bin Win64 ] ] ;

local lib = [ path.native [ path.join $(path) Lib ] ] ;
local lib_amd64 = [ path.native [ path.join $(path) Lib AMD64 ] ] ;
local lib_amd64_atlmfc = [ path.native [ path.join $(path) Lib AMD64 atlmfc ] ] ;
local lib_ia64 = [ path.native [ path.join $(path) Lib IA64 ] ] ;
local lib_ia64_mfc = [ path.native [ path.join $(path) Lib IA64 mfc ] ] ;

local "include" = [ path.native [ path.join $(path) Include ] ] ;
local include_crt = [ path.native [ path.join $(path) Include crt ] ] ;
local include_crt_sys = [ path.native [ path.join $(path) Include crt sys ] ] ;
local include_mfc = [ path.native [ path.join $(path) Include mfc ] ] ;
local include_atl = [ path.native [ path.join $(path) Include atl ] ] ;

# escape paths for Cygwin
if ! [ os.name ] in NT
{
bin = [ regex.escape $(bin) : "\\ " : "\\" ] ;
bin_winnt = [ regex.escape $(bin_winnt) : "\\ " : "\\" ] ;
bin_win64_x86_amd64 = [ regex.escape $(bin_win64_x86_amd64) : "\\ " : "\\" ] ;
bin_win64_ia64 = [ regex.escape $(bin_win64_ia64) : "\\ " : "\\" ] ;
bin_win64 = [ regex.escape $(bin_win64) : "\\ " : "\\" ] ;

lib = [ regex.escape $(lib) : "\\" : "\\" ] ;
lib_amd64 = [ regex.escape $(lib_amd64) : "\\" : "\\" ] ;
lib_amd64_atlmfc = [ regex.escape $(lib_amd64_atlmfc) : "\\" : "\\" ] ;
lib_ia64 = [ regex.escape $(lib_ia64) : "\\" : "\\" ] ;
lib_ia64_mfc = [ regex.escape $(lib_ia64_mfc) : "\\" : "\\" ] ;

"include" = [ regex.escape $("include") : "\\" : "\\" ] ;
include_crt = [ regex.escape $(include_crt) : "\\" : "\\" ] ;
include_crt_sys = [ regex.escape $(include_crt_sys) : "\\" : "\\" ] ;
include_mfc = [ regex.escape $(include_mfc) : "\\" : "\\" ] ;
include_atl = [ regex.escape $(include_atl) : "\\" : "\\" ] ;
}

# Generate shell commands for setting PATH, INCLUDE and LIB variables
local arch = i386 amd64 ia64 ;
local setup ;

# i386
setup +=
[ string.join
[ common.prepend-path-variable-command PATH :
$(bin) $(bin_winnt) ]
[ prepend-nt-path-variable-command INCLUDE :
$("include") ]
[ prepend-nt-path-variable-command LIB :
$(lib) ]
] ;

# amd64
setup +=
[ string.join
[ common.prepend-path-variable-command PATH :
$(bin_win64_x86_amd64) $(bin) $(bin_winnt) ]
[ nt-path-variable-setting-command INCLUDE :
$("include") $(include_crt) $(include_crt_sys) $(include_mfc) $(include_atl) ]
[ nt-path-variable-setting-command LIB :
$(lib_amd64) $(lib_amd64_atlmfc) ]
] ;

# ia64
setup +=
[ string.join
[ common.prepend-path-variable-command PATH :
$(bin_win64_ia64) $(bin_win64) $(bin) $(bin_winnt) ]
[ nt-path-variable-setting-command INCLUDE :
$(include_crt) $(include_crt_sys) $(include_mfc) $(include_atl) $("include") ]
[ nt-path-variable-setting-command LIB :
$(lib_ia64) $(lib_ia64_mfc) ]
] ;

local toolset = [ $(.toolsets).get $(toolset-condition) : toolset ] ;
local condition = [ $(.versions).get $(version) : condition ] ;

for local i in 1 2 3
{
if $(.debug-configuration)
{
ECHO "msplatformsdk: condition:"
"'$(condition)/$(toolset-condition)/<cpu-arch>$(arch[$(i)])',"
"setup: '$(setup[$(i)])'" ;
}

flags $(toolset) CONFIG_MSPSDK
$(condition)/$(toolset-condition)/<cpu-arch>$(arch[$(i)]) :
$(setup[$(i)]) :
unchecked ;
}
}

flags msvc LINKFLAGS <msplatformsdk>external/<cpu-arch>amd64 : bufferoverflowu.lib : unchecked ;

# Autodetection code
# Checks default installation path

local path = [ common.get-program-files-dir ] ;
path = [ path.make $(path) ] ;
path = [ path.join $(path) "Microsoft Platform SDK" ] ;
path = [ path.native $(path) ] ;

if [ GLOB $(path) : SetEnv.Cmd ]
{
$(.versions).register "default" ;
$(.versions).set "default" : path : $(path) ;
}
 --------------000402020904000003020806--


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk