|
Boost-Build : |
From: Ilya Sokolov (fal_delivery_at_[hidden])
Date: 2006-06-08 10:10:19
it was tested with msvc-71, dmc-847, gcc-343 (linux and cygwin) and
gcc-342 (mingw-spec)
cvs -q diff -u -d (in directory J:\w\boost\boost\tools\build\v2\tools)
Index: dmc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/dmc.jam,v
retrieving revision 1.6
diff -u -d -r1.6 dmc.jam
--- dmc.jam 24 Apr 2006 14:09:51 -0000 1.6
+++ dmc.jam 8 Jun 2006 13:14:16 -0000
@@ -15,6 +16,9 @@
import feature generators common ;
import toolset : flags ;
import sequence regex ;
+import "class" : new ;
+import type ;
+import pch_base ;
feature.extend toolset : dmc ;
@@ -55,8 +59,77 @@
generators.register-c-compiler dmc.compile.c++ : CPP : OBJ : <toolset>dmc ;
generators.register-c-compiler dmc.compile.c : C : OBJ : <toolset>dmc ;
+##### Using Precompiled Headers on DMC (Quick Guide) #####
+#
+# Make precompiled mypch.hpp:
+#
+# import pch ;
+# dmc-cpp-pch mypch : [ cast _ pcheader : mypch.hpp ] ;
+# # NOTE: ^^^^^ names should be equal ^^^^^
+#
+# Add dmc-cpp-pch to sources:
+#
+# exe hello
+# : main.cpp hello.cpp
+# : <toolset>dmc,<pch>on:<source>mypch
+# ;
+
+type.register DMC_PCH_T : sym ;
+
+type.register DMC_C_PCH_T : c_sym : DMC_PCH_T ;
+type.register DMC_CPP_PCH_T : cpp_sym : DMC_PCH_T ;
+
+type.set-generated-target-suffix DMC_C_PCH_T : <toolset>dmc : sym ;
+type.set-generated-target-suffix DMC_CPP_PCH_T : <toolset>dmc : sym ;
+
+class dmc-pch-generator : pch-generator
+{
+ import project ;
+ import property-set ;
+
+ rule run ( project name ? : property-set : header )
+ {
+ local header-name = [ $(header).name ] ;
+ local header-basename = $(header-name:B) ;
+ if $(header-basename) != $(name)
+ {
+ local location = [ $(project).project-module ] ;
+ errors.user-error "in" $(location)": base name of header file `"$(header-name)"' should be the same as dmc-pch target name `"$(name)"'" ;
+ }
+
+ local generated =
+ [
+ generator.run $(project) $(name)
+ : $(property-set)
+ : $(header)
+ ]
+ ;
+
+ local precompiled ;
+ for local g in $(generated)
+ {
+ if [ type.is-derived [ $(g).type ] DMC_PCH_T ]
+ {
+ precompiled = $(g) ;
+ }
+ }
+
+ return
+ [ property-set.create <precompiled>$(precompiled) ]
+ $(generated)
+ ;
+ }
+}
+
+generators.register [ new dmc-pch-generator dmc.compile.c.pch : PCHEADER : DMC_C_PCH_T OBJ : <toolset>dmc ] ;
+generators.register [ new dmc-pch-generator dmc.compile.c++.pch : PCHEADER : DMC_CPP_PCH_T OBJ : <toolset>dmc ] ;
+
+flags dmc.compile PRECOMPILED <pch>on : <precompiled> ;
+flags dmc.compile.c PCH <pch>on : -H ;
+flags dmc.compile.c++ PCH <pch>on : -H ;
# Declare flags
+
# dmc optlink has some limitation on the amount of debug-info included. Therefore only linenumbers are enabled in debug builds.
# flags dmc.compile OPTIONS <debug-symbols>on : -g ;
flags dmc.compile OPTIONS <debug-symbols>on : -gl ;
@@ -68,6 +141,7 @@
flags dmc.compile OPTIONS <optimization>space : -o+space ;
flags dmc.compile OPTIONS <exception-handling>on : -Ae ;
flags dmc.compile OPTIONS <rtti>on : -Ar ;
+flags dmc.compile OPTIONS <rtti>on/<pch>on : -HI"typeinfo.h" ;
# FIXME:
# Compiling sources to be linked into a shared lib (dll) the -WD cflag should be used
# Compiling sources to be linked into a static lib (lib) or executable the -WA cflag should be used
@@ -97,38 +171,84 @@
-actions compile.c
+actions compile.c.pch
{
- "$(.root)dmc" -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o"$(<)" "$(>)"
+ "$(.root)dmc" -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -HD"$(<[1]:D)" -HF"$(<[1])" -o"$(<[2])" "$(>)"
}
-actions compile.c++
+actions compile.c++.pch
{
- "$(.root)dmc" -cpp -c -Ab $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o"$(<)" "$(>)"
+ "$(.root)dmc" -cpp -c -Ab $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -HD"$(<[1]:D)" -HF"$(<[1])" -o"$(<[2])" "$(>)"
+}
+
+rule compile.c ( targets + : sources * : properties * )
+{
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
+}
+
+rule compile.c++ ( targets + : sources * : properties * )
+{
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
+}
+
+actions compile.c bind PRECOMPILED
+{
+ "$(.root)dmc" -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" $(PCH) -HD"$(PRECOMPILED:D)" -HH"$(PRECOMPILED:B)" -o"$(<)" "$(>)"
+}
+
+actions compile.c++ bind PRECOMPILED
+{
+ "$(.root)dmc" -cpp -c -Ab $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" $(PCH) -HD"$(PRECOMPILED:D)" -HH"$(PRECOMPILED:B)" -o"$(<)" "$(>)"
+}
actions together piecemeal archive
{
Index: gcc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/gcc.jam,v
retrieving revision 1.76
diff -u -d -r1.76 gcc.jam
--- gcc.jam 24 May 2006 10:37:55 -0000 1.76
+++ gcc.jam 8 Jun 2006 09:29:22 -0000
@@ -1,6 +1,8 @@
# Copyright (c) 2001 David Abrahams.
# Copyright (c) 2002-2003 Rene Rivera.
# Copyright (c) 2002-2003 Vladimir Prus.
+# Copyright (c) 2005 Reece H. Dunn.
+# Copyright (c) 2006 Ilya Sokolov.
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
@@ -144,6 +147,66 @@
generators.register-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ;
generators.register-c-compiler gcc.compile.asm : ASM : OBJ : <toolset>gcc ;
+##### Using Precompiled Headers on GCC (Quick Guide) #####
+#
+# Make precompiled mypch.hpp:
+#
+# import pch ;
+# gcc-cpp-pch mypch : [ cast _ pcheader : mypch.hpp ] ;
+# # NOTE: ^^^^^ names should be equal ^^^^^
+#
+# Add gcc-cpp-pch to sources:
+#
+# exe hello
+# : main.cpp hello.cpp
+# : <toolset>gcc,<pch>on:<source>mypch
+# ;
+
+# real suffixes will be setled later
+type.register GCC_PCH_T : gch ;
+type.register GCC_C_PCH_T : c_gch : GCC_PCH_T ;
+type.register GCC_CPP_PCH_T : cpp_gch : GCC_PCH_T ;
+
+class gcc-pch-generator : pch-generator
+{
+ import project ;
+ import property-set ;
+
+ rule run ( project name ? : property-set : header )
+ {
+ local header-name = [ $(header).name ] ;
+ local header-basename = $(header-name:B) ;
+ if $(header-basename) != $(name)
+ {
+ local location = [ $(project).project-module ] ;
+ errors.user-error "in" $(location)": base name of header file `"$(header-name)"' should be the same as gcc-pch target name `"$(name)"'" ;
+ }
+
+ local header-suffix = [ MATCH "^(.)*" : $(header-name:S) ] ;
+ local pch-suffix = $(header-suffix).gch ;
+
+ type.change-generated-target-suffix GCC_C_PCH_T : <toolset>gcc : $(pch-suffix) ;
+ type.change-generated-target-suffix GCC_CPP_PCH_T : <toolset>gcc : $(pch-suffix) ;
+
+ local precompiled =
+ [
+ generator.run $(project) $(name)
+ : $(property-set)
+ : $(header)
+ ]
+ ;
+
+ return
+ [ property-set.create <precompiled>$(precompiled) ]
+ $(precompiled)
+ ;
+ }
+}
+
+generators.register [ new gcc-pch-generator gcc.compile.c.pch : PCHEADER : GCC_C_PCH_T : <toolset>gcc ] ;
+generators.register [ new gcc-pch-generator gcc.compile.c++.pch : PCHEADER : GCC_CPP_PCH_T : <toolset>gcc ] ;
+
+flags gcc.compile PRECOMPILED <pch>on : <precompiled> ;
# Declare flags and action for compilation
flags gcc.compile OPTIONS <optimization>off : -O0 ;
@@ -205,6 +273,16 @@
flags gcc.compile DEFINES <define> ;
flags gcc.compile INCLUDES <include> ;
+actions compile.c++.pch
+{
+ "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+}
+
+actions compile.c.pch
+{
+ "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+}
+
rule compile.c++
{
# Some extensions are compiled as C++ by default. For others, we need
@@ -214,27 +292,20 @@
{
LANG on $(<) = "-x c++" ;
}
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
}
-
-actions compile.c++
+rule compile.c
{
- "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-128 $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
}
-rule compile.c
+actions compile.c++ bind PRECOMPILED
{
# If we use the name g++ then default file suffix -> language mapping
# does not work. So have to pass -x option. Maybe, we can work around this
# by allowing the user to specify both C and C++ compiler names.
#if $(>:S) != .c
#{
LANG on $(<) = "-x c" ;
#}
+ "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-128 $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PRECOMPILED:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}
-
-actions compile.c
+actions compile.c bind PRECOMPILED
{
"$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}
@@ -302,6 +373,8 @@
flags gcc.link FINDLIBS-ST <find-static-library> ;
flags gcc.link FINDLIBS-SA <find-shared-library> ;
flags gcc.link LIBRARIES <library-file> ;
+flags gcc.link OPTIONS <user-interface>gui : -mwindows ;
+
# For <runtime-link>static we made sure there are no dynamic libraries
# in the link
Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.81
diff -u -d -r1.81 msvc.jam
--- msvc.jam 17 May 2006 12:57:53 -0000 1.81
+++ msvc.jam 8 Jun 2006 09:00:39 -0000
@@ -1,6 +1,7 @@
# Copyright (c) 2003 David Abrahams.
# Copyright (c) 2005 Vladimir Prus.
# Copyright (c) 2005 Alexey Pakhunov.
+# Copyright (c) 2006 Ilya Sokolov.
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
@@ -20,7 +21,6 @@
import rc ;
import midl ;
import mc ;
-import pch ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
@@ -508,7 +508,106 @@
generators.register-standard msvc.compile.mc : MC : H RC : <toolset>msvc ;
generators.override msvc.compile.mc : mc.compile ;
-generators.register [ new pch-generator msvc.compile.pch : PCHEADER : OBJ PCH : <toolset>msvc ] ;
+##### Using Precompiled Headers on MSVC (Quick Guide) #####
+#
+# Make precompiled mypch.hpp:
+#
+# import pch ;
+# msvc-cpp-pch mypch
+# : # sources
+# [ cast _ pcheader : mypch.hpp ]
+# mypch.cpp
+# ;
+#
+# Add msvc-cpp-pch to sources:
+#
+# exe hello
+# : main.cpp hello.cpp
+# : <toolset>msvc,<pch>on:<source>mypch
+# ;
+
+type.register MSVC_PCH_T : pch ;
+
+type.register MSVC_C_PCH_T : c_pch : MSVC_PCH_T ;
+type.register MSVC_CPP_PCH_T : cpp_pch : MSVC_PCH_T ;
+
+#type.set-generated-target-suffix MSVC_CPP_PCH_T : <toolset>msvc : pch ;
+#type.set-generated-target-suffix MSVC_C_PCH_T : <toolset>msvc : pch ;
+
+feature pch-source : : free dependency ; # mypch.cpp
+
+class msvc-pch-generator : pch-generator
+{
+ import property-set ;
+
+ rule run ( project name ? : property-set : source-1 source-2 )
+ {
+ # searching header and source file in the sources
+ local sources = $(source-1) $(source-2) ;
+ local pch-header ;
+ local pch-source ;
+ for local s in $(sources)
+ {
+ if [ type.is-derived [ $(s).type ] PCHEADER ]
+ {
+ pch-header = $(s) ;
+ }
+ else if
+ [ type.is-derived [ $(s).type ] CPP ]
+ || [ type.is-derived [ $(s).type ] C ]
+ {
+ pch-source = $(s) ;
+ }
+ }
+
+ if ! $(pch-header)
+ {
+ errors.user-error "can't build pch without pch-header" ;
+ }
+
+ if ! $(pch-source)
+ {
+ errors.user-error "can't build pch without pch-source" ;
+ }
+
+ local generated =
+ [
+ generator.run $(project) $(name)
+ : [
+ property-set.create
+ <pch-source>$(pch-source) # mypch.cpp
+ [ $(property-set).raw ]
+ ]
+ : $(sources)
+ ]
+ ;
+
+ local precompiled ;
+ for local g in $(generated)
+ {
+ if [ type.is-derived [ $(g).type ] MSVC_PCH_T ]
+ {
+ precompiled = $(g) ;
+ }
+ }
+
+ return
+ [
+ property-set.create
+ <pch-header>$(pch-header) # mypch.hpp
+ <precompiled>$(precompiled) # mypch.pch
+ ]
+ $(generated)
+ ;
+ }
+}
+
+generators.register [ new msvc-pch-generator msvc.compile.c.pch : PCHEADER : MSVC_C_PCH_T OBJ : <toolset>msvc ] ;
+generators.register [ new msvc-pch-generator msvc.compile.c++.pch : PCHEADER : MSVC_CPP_PCH_T OBJ : <toolset>msvc ] ;
+
+flags msvc.compile PRECOMPILED <pch>on : <precompiled> ;
+flags msvc.compile PCH_SOURCE <pch>on : <pch-source> ;
+flags msvc.compile PCH_HEADER <pch>on : <pch-header> ;
#
# Declare flags and action for compilation
@@ -551,8 +650,8 @@
flags msvc.compile CFLAGS <runtime-debugging>off/<runtime-link>static/<threading>multi : /MT ;
flags msvc.compile CFLAGS <runtime-debugging>on/<runtime-link>static/<threading>multi : /MTd ;
-flags msvc.compile.c OPTIONS <cflags> : ;
-flags msvc.compile.c++ OPTIONS <cxxflags> : ;
+flags msvc.compile.c CFLAGS <cflags> : ;
+flags msvc.compile.c++ C++FLAGS <cxxflags> : ;
flags msvc.compile PDB_CFLAG <debug-symbols>on/<debug-store>database : /Fd ; # not used yet
@@ -560,44 +659,48 @@
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 * )
+rule compile.c.pch ( targets + : sources * : properties * )
{
- DEPENDS $(<) : [ on $(<) return $(PCH_HEADER) ] ;
- DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
+ DEPENDS $(<) : [ on $(<) return $(PCH_SOURCE) ] ;
}
-rule compile.c++ ( targets + : sources * : properties * )
+rule compile.c++.pch ( targets + : sources * : properties * )
{
- DEPENDS $(<) : [ on $(<) return $(PCH_HEADER) ] ;
- DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
+ DEPENDS $(<) : [ on $(<) return $(PCH_SOURCE) ] ;
}
-rule compile.pch ( targets + : sources * : properties * )
+# The actions differ only by explicit selection of input language
+actions compile.c.pch bind PCH_SOURCE
{
- DEPENDS $(<) : [ on $(<) return $(PCH_SOURCE) ] ;
+ $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(PCH_SOURCE:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[2]:W)" /Yc"$(>[1]:D=)" -Fp"$(<[1]:W)" /Yl__bjam_pch_symbol
}
+actions compile.c++.pch bind PCH_SOURCE
+{
+ $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(PCH_SOURCE:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[2]:W)" /Yc"$(>[1]:D=)" -Fp"$(<[1]:W)" /Yl__bjam_pch_symbol
+}
-# The actions differ only by explicit selection of input language
-actions compile.c bind PCH_HEADER PCH_FILE
+rule compile.c ( targets + : sources * : properties * )
{
- $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PCH_FILE:W)"
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
+ DEPENDS $(<) : [ on $(<) return $(PCH_HEADER) ] ;
}
-actions compile.c++ bind PCH_HEADER PCH_FILE
+rule compile.c++ ( targets + : sources * : properties * )
{
- $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PCH_FILE:W)"
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
+ DEPENDS $(<) : [ on $(<) return $(PCH_HEADER) ] ;
}
-actions compile.pch bind PCH_SOURCE
+actions compile.c bind PCH_HEADER PRECOMPILED
{
- $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(PCH_SOURCE:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" /Yc"$(>[1]:D=)" -Fp"$(<[2]:W)"
+ $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PRECOMPILED:W)"
}
+actions compile.c++ bind PCH_HEADER PRECOMPILED
+{
+ $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PRECOMPILED:W)"
+}
actions compile.rc
{
@@ -633,17 +736,17 @@
# Declare flags and action for linking
flags msvc.link PDB_LINKFLAG <debug-symbols>on/<debug-store>database : /PDB: ; # not used yet
-flags msvc.link LINKFLAGS <debug-symbols>on : /DEBUG ;
+flags msvc.link OPTIONS <debug-symbols>on : /DEBUG ;
flags msvc.link DEF_FILE <def-file> ;
# The linker disables the default optimizations when using /DEBUG. Whe have
# to enable them manually for release builds with debug symbols.
-flags msvc LINKFLAGS <debug-symbols>on/<runtime-debugging>off : /OPT:REF,ICF ;
+flags msvc.link OPTIONS <debug-symbols>on/<runtime-debugging>off : /OPT:REF,ICF ;
-flags msvc LINKFLAGS <user-interface>console : /subsystem:console ;
-flags msvc LINKFLAGS <user-interface>gui : /subsystem:windows ;
-flags msvc LINKFLAGS <user-interface>wince : /subsystem:windowsce ;
-flags msvc LINKFLAGS <user-interface>native : /subsystem:native ;
-flags msvc LINKFLAGS <user-interface>auto : /subsystem:posix ;
+flags msvc.link OPTIONS <user-interface>console : /subsystem:console ;
+flags msvc.link OPTIONS <user-interface>gui : /subsystem:windows ;
+flags msvc.link OPTIONS <user-interface>wince : /subsystem:windowsce ;
+flags msvc.link OPTIONS <user-interface>native : /subsystem:native ;
+flags msvc.link OPTIONS <user-interface>auto : /subsystem:posix ;
flags msvc.link OPTIONS <linkflags> ;
flags msvc.link LINKPATH <library-path> ;
@@ -701,7 +804,7 @@
{
actions link bind DEF_FILE
{
- $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) /NOLOGO /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
if exist "$(<[1]).manifest" (
mt -nologo -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);1"
)
@@ -709,7 +812,7 @@
actions link.dll bind DEF_FILE
{
- $(.LD) /NOLOGO /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) /NOLOGO /DLL /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
if exist "$(<[1]).manifest" (
mt -nologo -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);2"
)
@@ -719,7 +822,7 @@
{
actions link bind DEF_FILE
{
- $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) /NOLOGO /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
if test -e "$(<[1]).manifest"; then
$(.MT) -nologo -manifest "$(<[1]:W).manifest" "-outputresource:$(<[1]:W);1"
fi
@@ -727,7 +830,7 @@
actions link.dll bind DEF_FILE
{
- $(.LD) /NOLOGO /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
+ $(.LD) /NOLOGO /DLL /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
if test -e "$(<[1]).manifest"; then
$(.MT) -nologo -manifest "$(<[1]:W).manifest" "-outputresource:$(<[1]:W);2"
fi
@@ -827,4 +930,3 @@
register-configuration $(i) : [ default-path $(i) ] ;
}
}
-
Index: pch.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/pch.jam,v
retrieving revision 1.1
diff -u -d -r1.1 pch.jam
--- pch.jam 6 Dec 2005 08:28:02 -0000 1.1
+++ pch.jam 7 Jun 2006 15:08:44 -0000
@@ -1,68 +1,190 @@
-# 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) ;
- }
-}
+# Copyright (c) 2005 Reece H. Dunn.
+# Copyright (c) 2006 Ilya Sokolov
+#
+# 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)
+
+##### Using Precompiled Headers (Quick Guide) #####
+#
+# Make precompiled mypch.hpp:
+#
+# import pch ;
+# cpp-pch mypch
+# : # sources
+# [ cast _ pcheader : mypch.hpp ]
+# : # requiremnts
+# <toolset>msvc:<source>mypch.cpp
+# ;
+#
+# Add cpp-pch to sources:
+#
+# exe hello
+# : main.cpp hello.cpp
+# : <pch>on:<source>mypch
+# ;
+
+import cast ;
+
+toolsets-with-pch-support =
+ msvc
+ gcc
+ dmc
+ ;
+
+#how to combine these rules?
+rule msvc-cpp-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
+{
+ msvc-cpp-pch-t $(name)
+ : $(sources)
+ : $(requirements)
+ <toolset>msvc # for alternative resolution
+ <pch>on
+ : $(default-build)
+ : $(usage-requirements)
+ ;
+
+# how to do it?
+# explicit $(name) ;
+}
+IMPORT $(__name__)
+ : msvc-cpp-pch
+ :
+ : msvc-cpp-pch
+ ;
+
+rule msvc-c-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
+{
+ msvc-c-pch-t $(name)
+ : $(sources)
+ : $(requirements)
+ <toolset>msvc # for alternative resolution
+ <pch>on
+ : $(default-build)
+ : $(usage-requirements)
+ ;
+
+# how to do it?
+# explicit $(name) ;
+}
+IMPORT $(__name__)
+ : msvc-c-pch
+ :
+ : msvc-c-pch
+ ;
+
+rule gcc-cpp-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
+{
+ gcc-cpp-pch-t $(name)
+ : $(sources)
+ : $(requirements)
+ <toolset>gcc # for alternative resolution
+ <pch>on
+ : $(default-build)
+ : $(usage-requirements)
+ ;
+
+# how to do it?
+# explicit $(name) ;
+}
+IMPORT $(__name__)
+ : gcc-cpp-pch
+ :
+ : gcc-cpp-pch
+ ;
+
+rule gcc-c-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
+{
+ gcc-c-pch-t $(name)
+ : $(sources)
+ : $(requirements)
+ <toolset>gcc # for alternative resolution
+ <pch>on
+ : $(default-build)
+ : $(usage-requirements)
+ ;
+
+# how to do it?
+# explicit $(name) ;
+}
+IMPORT $(__name__)
+ : gcc-c-pch
+ :
+ : gcc-c-pch
+ ;
+
+rule dmc-cpp-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
+{
+ dmc-cpp-pch-t $(name)
+ : $(sources)
+ : $(requirements)
+ <toolset>dmc # for alternative resolution
+ <pch>on
+ : $(default-build)
+ : $(usage-requirements)
+ ;
+
+# how to do it?
+# explicit $(name) ;
+}
+IMPORT $(__name__)
+ : dmc-cpp-pch
+ :
+ : dmc-cpp-pch
+ ;
+
+rule dmc-c-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
+{
+ dmc-c-pch-t $(name)
+ : $(sources)
+ : $(requirements)
+ <toolset>dmc # for alternative resolution
+ <pch>on
+ : $(default-build)
+ : $(usage-requirements)
+ ;
+
+# how to do it?
+# explicit $(name) ;
+}
+IMPORT $(__name__)
+ : dmc-c-pch
+ :
+ : dmc-c-pch
+ ;
+
+rule cpp-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
+{
+ for local toolset in $(toolsets-with-pch-support)
+ {
+ $(toolset)-cpp-pch $(name)
+ : $(sources)
+ : $(requirements)
+ : $(default-build)
+ : $(usage-requirements)
+ ;
+ }
+}
+IMPORT $(__name__)
+ : cpp-pch
+ :
+ : cpp-pch
+ ;
+
+rule c-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
+{
+ for local toolset in $(toolsets-with-pch-support)
+ {
+ $(toolset)-c-pch $(name)
+ : $(sources)
+ : $(requirements)
+ : $(default-build)
+ : $(usage-requirements)
+ ;
+ }
+}
+IMPORT $(__name__)
+ : c-pch
+ :
+ : c-pch
+ ;
# Copyright (c) 2005 Reece H. Dunn.
# Copyright (c) 2006 Ilya Sokolov
#
# 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 ;
import generators ;
type.register PCHEADER : pcheader ;
feature.feature pch : # control precompiled header (PCH) generation
on
off
;
feature.feature pch-header : : free dependency ;
feature.feature precompiled : : free dependency ;
class pch-generator : generator
{
rule action-class ( )
{
return compile-action ;
}
}
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