Boost logo

Boost-Build :

From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-09-18 07:29:52


Hi,

Vladimir Prus wrote:
>>next changes will be:
>>> > 5. new configure rule
>>> > 6. "configure all" syntax
>>> > 7. "version registration" framework
>
>Can you send them all now? I'll still review and commit them
one-by-one >but ti will help me to see the next step.

The attached patch (msvc.diff) implements items 5 and 6 from the list
above. The item 5 has little sense alone since it simply renames
'msvc.init' into 'msvc.configure', removes the parameter 'command' and
makes 'init' to call 'configure'. In other words it is a preparation for
future 'toolset.configure'.

Moreover 6 depends on 5 so I cannot make standalone diffs for 5 and 6.

I also attached msvc_ignore_spaces.diff. It does not show shifted but
unchanged lines. I guess it will make review easier.

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

Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.50
diff -c -3 -r1.50 msvc.jam
*** msvc.jam 2 Sep 2005 07:35:54 -0000 1.50
--- msvc.jam 18 Sep 2005 12:02:47 -0000
***************
*** 13,20 ****
import path ;
import sequence : unique ;
import common ;
-
import rc ;

if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
--- 13,20 ----
import path ;
import sequence : unique ;
import common ;
import rc ;
+ import "class" : new ;

if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
***************
*** 30,35 ****
--- 30,38 ----
# 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,169 ****
# 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 ? )
--- 57,250 ----
# 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) ;
!
! local command = [ get-values <command> : $(options) ] ;
!
!
! # 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 ;
!
! # 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 ? )
***************
*** 203,209 ****
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.
--- 284,290 ----
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.
***************
*** 226,234 ****
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) ] ] ;

--- 307,315 ----
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) ] ] ;

 --------------030207050500010608020105 Content-Type: text/plain;
name="msvc_ignore_spaces.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="msvc_ignore_spaces.diff"

Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.50
diff -c -3 -w -b -B -r1.50 msvc.jam
*** msvc.jam 2 Sep 2005 07:35:54 -0000 1.50
--- msvc.jam 18 Sep 2005 12:02:47 -0000
***************
*** 13,20 ****
import path ;
import sequence : unique ;
import common ;
-
import rc ;

if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
--- 13,20 ----
import path ;
import sequence : unique ;
import common ;
import rc ;
+ import "class" : new ;

if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
***************
*** 30,35 ****
--- 30,38 ----
# 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
***************
*** 68,73 ****
--- 71,156 ----
# 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) ;
+
+ local command = [ get-values <command> : $(options) ] ;
+
+
# 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) ] ;
***************
*** 79,87 ****
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)
--- 162,167 ----
***************
*** 165,170 ****
--- 245,251 ----
flags msvc.compile CFLAGS $(condition)/<optimization>space : /Os ;
}
}
+ }

rule default-paths ( version ? )
{
 --------------030207050500010608020105--


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