Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-11-17 17:15:11


Reece Dunn wrote:
> Hi All,
>
> I have attached a patch to add PCH support to the msvc toolset. This is
> most likely the most complex toolset to get PCH support on, so extending
> this for other toolsets should be trivial.

This is a minor revision to correctly use :W where it is needed
(including some places in the previous response file changeover).

- Reece

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 17 Nov 2005 21:38:37 -0000
@@ -18,6 +18,7 @@
 import common ;
 import "class" : new ;
 import rc ;
+import pch ;
 
 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
 {
@@ -487,6 +488,9 @@
 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 : HPP : OBJ PCH : <toolset>msvc ] ;
+
 #
 # Declare flags and action for compilation
 #
@@ -537,15 +541,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:W)" -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:W)" -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]:W)" -Fp"$(<[2]:W)"
 }
 
 actions compile.rc


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