Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-12-05 04:33:33


Vladimir Prus wrote:
> Reece,
> can you send me the test project, as well as the current version of your
> patch, so that we'll on the same page without sending huge logs? I'll take a
> look then.

Did you get the e-mail I sent you? I sent it a week or so ago, but
haven't received a reply.

The pch.jam and msvc-pch.diff files add PCH support and test.zip file
contains the tests I am using for it. Alexey's mc toolset support patch
is required to compile the mc project.

I have also attached a patch I previously sent in the message "Response
files issue(s)" that made the modifications you suggested w.r.t. the
common function.

- Reece

*****************************************************************************
** **
** WARNING: This email contains an attachment of a very suspicious type. **
** You are urged NOT to open this attachment unless you are absolutely **
** sure it is legitmate. Opening this attachment may cause irreparable **
** damage to your computer and your files. If you have any questions **
** about the validity of this message, PLEASE SEEK HELP BEFORE OPENING IT. **
** **
** This warning was added by the IU Computer Science Dept. mail scanner. **
*****************************************************************************

Index: common.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/common.jam,v
retrieving revision 1.43
diff -u -r1.43 common.jam
--- common.jam 9 Nov 2005 13:56:41 -0000 1.43
+++ common.jam 15 Nov 2005 23:21:28 -0000
@@ -447,34 +447,6 @@
 }
 
 
-# Returns the list of libraries from the <library> property
-# in their actualized form.
-rule resolve-library-files ( properties * )
-{
- local libraries ;
-
- for local p in $(properties)
- {
- if $(p:G) = <library-file> &&
- ! [ type.is-derived [ $(p:G=).type ] SHARED_LIB ]
- {
- libraries += $(p:G=) ;
- }
- }
-
- # Get real jam targets
-
- local xlibraries ;
-
- for local l in $(libraries)
- {
- xlibraries += [ $(l).actualize ] ;
- }
-
- return $(xlibraries) ;
-}
-
-
 # Return a command which can create a file. If 'r' is result of invocation,
 # then
 # r foobar
Index: cw.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/cw.jam,v
retrieving revision 1.8
diff -u -r1.8 cw.jam
--- cw.jam 9 Nov 2005 13:56:41 -0000 1.8
+++ cw.jam 15 Nov 2005 23:20:19 -0000
@@ -177,53 +177,40 @@
 flags cw.link FINDLIBS_ST <find-static-library> ;
 flags cw.link FINDLIBS_SA <find-shared-library> ;
 flags cw.link LIBRARY_OPTION <toolset>cw : "" : unchecked ;
-
-rule archive ( targets + : sources * : properties * )
-{
- flags cw.link LIBRARIES
- [ common.resolve-library-files properties ] ;
-}
-
-rule link ( targets + : sources * : properties * )
-{
- flags cw.link LIBRARIES
- [ common.resolve-library-files properties ] ;
-}
+flags cw.link LIBRARIES_MENTIONED_BY_FILE : <library-file> ;
 
 rule link.dll ( targets + : sources * : properties * )
 {
- flags cw.link LIBRARIES
- [ common.resolve-library-files properties ] ;
     DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;
 }
 
 if [ os.name ] in NT
 {
- actions archive bind
+ actions archive
    {
       if exist "$(<[1])" DEL "$(<[1])"
- $(.LD) -library -o "$(<[1])" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) -library -o "$(<[1])" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
    }
 }
 else # cygwin
 {
- actions archive bind
+ actions archive
    {
       _bbv2_out_="$(<)"
       if test -f "$_bbv2_out_" ; then
          _bbv2_existing_="$(<:W)"
       fi
- $(.LD) -library -o "$(<:W)" $_bbv2_existing_ @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) -library -o "$(<:W)" $_bbv2_existing_ @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
    }
 }
 
 actions link bind DEF_FILE
 {
- $(.LD) -o "$(<[1]:W)" -L"$(LINKPATH)" $(LINKFLAGS) $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) -o "$(<[1]:W)" -L"$(LINKPATH)" $(LINKFLAGS) $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
 }
 
 actions link.dll bind DEF_FILE
 {
- $(.LD) -o "$(<[1]:W)" -implib "$(<[2]:W)" -L"$(LINKPATH)" $(LINKFLAGS) -f "$(DEF_FILE)" $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) -o "$(<[1]:W)" -implib "$(<[2]:W)" -L"$(LINKPATH)" $(LINKFLAGS) -f "$(DEF_FILE)" $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
 }
 
Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.63
diff -u -r1.63 msvc.jam
--- msvc.jam 9 Nov 2005 13:56:41 -0000 1.63
+++ msvc.jam 15 Nov 2005 23:23:46 -0000
@@ -538,12 +538,12 @@
 flags msvc.compile INCLUDES <include> ;
 
 # The actions differ only by explicit selection of input language
-actions compile.c bind
+actions compile.c
 {
     $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)"
 }
 
-actions compile.c++ bind
+actions compile.c++
 {
     $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(USER_CFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)"
 }
@@ -593,24 +593,11 @@
 flags msvc.link FINDLIBS_ST <find-static-library> ;
 flags msvc.link FINDLIBS_SA <find-shared-library> ;
 flags msvc.link LIBRARY_OPTION <toolset>msvc : "" : unchecked ;
+flags msvc.link LIBRARIES_MENTIONED_BY_FILE : <library-file> ;
 
 
-rule archive ( targets + : sources * : properties * )
-{
- flags msvc.link LIBRARIES
- [ common.resolve-library-files properties ] ;
-}
-
-rule link ( targets + : sources * : properties * )
-{
- flags msvc.link LIBRARIES
- [ common.resolve-library-files properties ] ;
-}
-
 rule link.dll ( targets + : sources * : properties * )
 {
- flags msvc.link LIBRARIES
- [ common.resolve-library-files properties ] ;
     DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;
 }
 
@@ -622,18 +609,18 @@
 {
     # The 'DEL' command would issue a message to stdout
     # if the file does not exist, so need a check.
- actions archive bind
+ actions archive
     {
         if exist "$(<[1])" DEL "$(<[1])"
- $(.LD) /lib /NOLOGO /out:"$(<[1])" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) /lib /NOLOGO /out:"$(<[1])" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
     }
 }
 else
 {
- actions archive bind
+ actions archive
     {
         $(RM) "$(<[1])"
- $(.LD) /lib /NOLOGO /out:"$(<[1])" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) /lib /NOLOGO /out:"$(<[1])" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
     }
 }
         
@@ -651,13 +638,13 @@
 
 actions link bind DEF_FILE
 {
- $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
     $(MANIFEST)$(<[1]).manifest $(OUTPUTRESOURCE)$(<[1]);#2
 }
 
 actions link.dll bind DEF_FILE
 {
- $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
     $(MANIFEST)$(<[1]).manifest $(OUTPUTRESOURCE)$(<[1]);#2
 }

Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.64
diff -u -r1.64 msvc.jam
--- msvc.jam 14 Nov 2005 15:15:06 -0000 1.64
+++ msvc.jam 20 Nov 2005 19:00:36 -0000
@@ -18,6 +18,7 @@
 import common ;
 import "class" : new ;
 import rc ;
+import pch ;
 
 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
 {
@@ -487,6 +488,8 @@
 generators.override msvc.compile.rc : rc.resource-compile ;
 generators.register-standard msvc.compile.asm : ASM : OBJ : <toolset>msvc ;
 
+generators.register [ new pch-generator msvc.compile.pch : PCHEADER : OBJ PCH : <toolset>msvc ] ;
+
 #
 # Declare flags and action for compilation
 #
@@ -537,15 +540,41 @@
 flags msvc.compile UNDEFS <undef> ;
 flags msvc.compile INCLUDES <include> ;
 
+flags msvc.compile PCH_SOURCE <pch-source> ;
+flags msvc.compile PCH_HEADER <pch>on : <pch-header> ;
+flags msvc.compile PCH_FILE <pch>on : <pch-file> ;
+
+rule compile.c ( targets + : sources * : properties * )
+{
+ DEPENDS $(<) : [ on $(<) return $(PCH_HEADER) ] ;
+ DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
+}
+
+rule compile.c++ ( targets + : sources * : properties * )
+{
+ DEPENDS $(<) : [ on $(<) return $(PCH_HEADER) ] ;
+ DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
+}
+
+rule compile.pch ( targets + : sources * : properties * )
+{
+ DEPENDS $(<) : [ on $(<) return $(PCH_SOURCE) ] ;
+}
+
 # The actions differ only by explicit selection of input language
-actions compile.c bind
+actions compile.c bind PCH_HEADER PCH_FILE
+{
+ $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PCH_FILE:W)"
+}
+
+actions compile.c++ bind PCH_HEADER PCH_FILE
 {
- $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)"
+ $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(USER_CFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PCH_FILE:W)"
 }
 
-actions compile.c++ bind
+actions compile.pch bind PCH_SOURCE
 {
- $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(USER_CFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)"
+ $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(USER_CFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(PCH_SOURCE:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" /Yc"$(>[1]:D=)" -Fp"$(<[2]:W)"
 }
 
 actions compile.rc


# Copyright (c) 2005 Reece H. Dunn.
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.txt)

import type ;
import feature : feature ;
import generators ;

##### Using Pre-compiled Headers (Quick Guide) #####
#
# Make mypch.hpp a pre-compiled header (PCH) using mypch.cpp as the source file:
# import cast ;
# pch mypch : [ cast _ pcheader : pch.hpp ] pch.cpp ;
#
# Enable PCHs in a target:
# exe hello : mypch main.cpp hello.cpp ;
# ^^^^^ -- mypch.hpp is a PCH
#
# Don't use PCHs for a specific source:
# obj nopch : nopch.cpp : <pch>off ;
#

type.register PCH : pch ;
type.register PCHEADER : pcheader ;

feature pch : # control precompiled header (PCH) generation
    on # this file has support for using PCHs (if available)
    off # this file doesn't use PCHs
  ;

feature pch-source : : free dependency ; # mypch.cpp
feature pch-header : : free dependency ; # mypch.h[pp]
feature pch-file : : free dependency ; # mypch.pch

class pch-generator : generator
{
    import property-set ;

    rule __init__ ( * : * )
    {
        generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
    }

    rule action-class ( )
    {
        return compile-action ;
    }

    rule run ( project name ? : property-set : sources * )
    {
        local r =
          [ generator.run $(project) $(name) :
            [
              property-set.create
                <pch-source>$(sources[2]) # mypch.cpp
                [ $(property-set).raw ]
            ] : $(sources)
          ] ;

        return
          [ property-set.create
              <pch-header>$(sources[1]) # mypch.h[pp]
              <pch-file>$(r[2]) # mypch.pch
          ] $(r) ;
    }
}



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