Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-10-02 15:27:30


Alexey Pakhunov wrote:
> Reece Dunn wrote:
>
>>vcvars.bat. I have tested it on versions 6.0, 7.1 and 8.0. I haven't
>>tested with 7.0, but it should work.
>
> 7.0 and 7.1 use identical INCLUDE, LIB and PATH settings.

I thought so, but I just wanted to check.

>>* PlatformSDK is hardcoded. This could be moved into the
>>msplatformsdk.jam file when this becomes available.
>
> I guess we should rely on order of the include directories. It will more
> or less replicate normal VS + PSDK setup.

Ok. I was just thinking that when we have control over these variables,
we can choose to add the native PlatformSDK directories or those from
msplatformsdk.jam. Depending on order also works.

NOTE: The 7.0, 7.1 and 8.0 versions pull in settings for the .NET
"framework SDK" versions 1.0, 1.1 and 2.0 respectively. These should be
in a frameworksdk.jam.

>>* This hasn't been tested with standalone targets such as the 7.1
>>toolkit, embedded VC++ and the compilers in the PlatformSDK distributions.
>
> 7.1 toolkit paths:
> [snip]

Thanks :).

>>* There should really be a path flag/variable associated with each
>>toolset+version, that updates the environment variable when an action is
>>being called (this should be generic for any environment variable, e.g.
>>
>> set-env PATH : $(root)/bin;$(PATH) ;
>
> Do you mean that the 'init' rule will prepare commands for setting up
> the environment and then each block of actions will execute prepared
> commands?

Yes.

>> feature $(condition) : <include>$(root)/include ;
>
> Order-sensitive features should be implemented first. :-)

:)

> We are going to have 5 different variants of these settings once amd64
> and ia64 support will be added. I guess we need some generic code that
> will construct paths by a given version number and target CPU.

That's where I am moving to. That is why I am using $(root), etc. The
main problems are:
* VC6 - does not follow the pattern that VC 7.0, 7.1 and 8.0 do;
* VC7.1toolkit - this only has a single PATH, INCLUDE and LIB setting;
* compilers from the PlatformSDK - I'm not sure how these are configured;
* embedded VC++ - I don't know what to do about this;
* VC8 PocketPC/SmartPhone - I have no idea how VC8 deals with these, I
cannot see any vcvars.bat for configuring these.

There is still room for improvement in the genericity, but the important
thing is to get everything working before simplifying it.

> Another issue - cygwin. We should use path.join and other path rules to
> construct proper paths.

I have tried these with cygwin/bash, but I think they work because of
the $(setup) trick. I definitely agree that we should support NT and CYGWIN.

> There is also the
> 'common.prepend-path-variable-command' rule allowing to construct proper
> 'set PATH' command for both NT and CYGWIN.

Great! :D

>>+ setup = "set PATH="$(path)";%PATH%" ;
>[snip]
>
> We don't need this trick any more.
>
> setup = [ common.prepend-path-variable-command PATH : ... ] ;
> flags msvc.compile SETUP $(condition) : $(setup) ;
>
> actions ...
> {
> $(SETUP)
> cl.exe ... # Note: no prefix
> }

I have added this and it is working very well :).

>>+ # prefix with setup, or quoted path if any
>>+ local prefix = $(setup) ;
>>+ flags msvc.compile .CC $(condition) : $(prefix)$(compiler) ;
>
> Now we can get rid of gluing '$(prefix)$(compiler)' if the separate
> setup command is used as I showed above.

Done :)

>>+ if [ MATCH ^(6\\.) : $(version) ] # VC 6.0
>>+ {
>>+ flags msvc.compile CFLAGS $(condition) : "-I\"$(root)/atl/include\"" ;
> [skip]
>>+ flags msvc LINKFLAGS $(condition) : "-LIBPATH:\"$(root)/PlatformSDK/lib\"" ;
>
> The same comment - some kind of generic code needed.

I agree. My main concern was getting it working. I would also like this
to be something like

featute $(condition) : <include>$(root)/include ;

But I have noted your comment about order-sensitive features :).

Attached is the update. Thanks for the suggestions :).

- Reece
 --------------000009050302080105070503 Content-Type: text/plain;
name="msvc-novcvars.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="msvc-novcvars.diff"

Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.56
diff -u -r1.56 msvc.jam
--- msvc.jam 26 Sep 2005 06:02:41 -0000 1.56
+++ msvc.jam 2 Oct 2005 20:24:19 -0000
@@ -167,10 +167,6 @@

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) ] ;
@@ -192,39 +188,16 @@
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.compile .ASM $(condition) : $(prefix)$(assembler) ;
- 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 ! $(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 ;
@@ -240,9 +213,70 @@
else
{
version = 6.0 ;
- }
+ }
+ }
+
+ # Setup PATH from vcvars.bat
+
+ local path = ;
+
+ if [ MATCH ^(6\\.) : $(version) ] # VC 6.0
+ {
+ path = $(root)/../Common/MSDev98/bin ;
+ path = $(path);$(root)/bin ;
+ path = $(path);$(root)/../Common/WinNT ;
+ path = $(path);$(root)/../Common/Tools ;
+ }
+ else if [ MATCH "(7.1toolkit)" : $(version) ]
+ {
+ path = $(root)/bin ;
+ }
+ else # VC 7.0 and above
+ {
+ path = $(root)/../Common7/IDE ;
+ path = $(path);$(root)/bin ;
+ path = $(path);$(root)/../Common7/Tools ;
+ path = $(path);$(root)/../Common7/Tools/bin/prerelease ;
+ path = $(path);$(root)/../Common7/Tools/bin ;
+ }
+
+ setup = [ common.prepend-path-variable-command PATH : $(path) ] ;
+ flags msvc SETUP $(condition) : $(setup) ;
+
+ # Bind the command line tools to the associated action
+
+ flags msvc.compile .CC $(condition) : $(compiler) ;
+ flags msvc.compile .RC $(condition) : $(resource-compiler) ;
+ flags msvc.compile .ASM $(condition) : $(assembler) ;
+ flags msvc.link .LD $(condition) : $(linker) ;
+ flags msvc.archive .LD $(condition) : $(linker) ;
+
+ # Setup INCLUDE and LIB from vcvars.bat
+
+ if [ MATCH ^(6\\.) : $(version) ] # VC 6.0
+ {
+ flags msvc.compile CFLAGS $(condition) : "-I\"$(root)/atl/include\"" ;
+ flags msvc.compile CFLAGS $(condition) : "-I\"$(root)/mfc/include\"" ;
+ flags msvc LINKFLAGS $(condition) : "-LIBPATH:\"$(root)/mfc/lib\"" ;
+ }
+ else # VC 7.0 and above
+ {
+ flags msvc.compile CFLAGS $(condition) : "-I\"$(root)/atlmfc/include\"" ;
+ flags msvc LINKFLAGS $(condition) : "-LIBPATH:\"$(root)/atlmfc/lib\"" ;
}
-
+
+ flags msvc.compile CFLAGS $(condition) : "-I\"$(root)/include\"" ;
+ flags msvc LINKFLAGS $(condition) : "-LIBPATH:\"$(root)/lib\"" ;
+
+ if ! [ MATCH "(7.1toolkit)" : $(version) ]
+ {
+ flags msvc.compile CFLAGS $(condition) : "-I\"$(root)/PlatformSDK/include/prerelease\"" ;
+ flags msvc.compile CFLAGS $(condition) : "-I\"$(root)/PlatformSDK/include\"" ;
+
+ flags msvc LINKFLAGS $(condition) : "-LIBPATH:\"$(root)/PlatformSDK/lib/prerelease\"" ;
+ flags msvc LINKFLAGS $(condition) : "-LIBPATH:\"$(root)/PlatformSDK/lib\"" ;
+ }
+
# 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.
@@ -392,15 +426,18 @@
# The actions differ only by explicit selection of input language
actions compile.c bind RSP
{
+ $(SETUP)
$(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"$(RSP:W)" -c -Fo"$(<[1]:W)" && $(RM) "$(RSP)"
}
actions compile.c++ bind RSP
{
+ $(SETUP)
$(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(USER_CFLAGS) @"$(RSP:W)" -c -Fo"$(<[1]:W)" && $(RM) "$(RSP)"
}

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

@@ -418,6 +455,7 @@

actions compile.asm
{
+ $(SETUP)
$(.ASM) -nologo -c -coff -Zp4 -Cp -Cx $(USER_ASMFLAGS) -Fo "$(<:W)" "$(>:W)"
}

@@ -474,6 +512,7 @@
actions archive bind RSP
{
if exist "$(<[1])" DEL "$(<[1])"
+ $(SETUP)
$(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(RSP)" && $(RM) "$(RSP)"
}
}
@@ -482,6 +521,7 @@
actions archive bind RSP
{
$(RM) "$(<[1])"
+ $(SETUP)
$(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(RSP)" && $(RM) "$(RSP)"
}
}
@@ -500,12 +540,14 @@

actions link bind DEF_FILE RSP
{
+ $(SETUP)
$(.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
{
+ $(SETUP)
$(.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
}
 --------------000009050302080105070503--


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