From c4d4e66c71084fdc8f6fd17b76ebd50094eccf1f Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sun, 26 Oct 2008 18:43:35 +0000 Subject: [PATCH] Fix pch support for Intel on Win32. [SVN r49458] --- src/tools/intel-win.jam | 39 ++++++++++++++++++++++++++++++++++++++- src/tools/msvc.jam | 4 +++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/tools/intel-win.jam b/src/tools/intel-win.jam index 7cefdbe5d..10f08aa24 100644 --- a/src/tools/intel-win.jam +++ b/src/tools/intel-win.jam @@ -12,7 +12,8 @@ import intel ; import msvc ; import os ; import toolset ; - +import generators ; +import type ; feature.extend-subfeature toolset intel : platform : win ; @@ -20,6 +21,14 @@ toolset.inherit-generators intel-win intel win toolset.inherit-flags intel-win : msvc ; toolset.inherit-rules intel-win : msvc ; +# Override default do-nothing generators. +generators.override intel-win.compile.c.pch : pch.default-c-pch-generator ; +generators.override intel-win.compile.c++.pch : pch.default-cpp-pch-generator ; + +toolset.flags intel-win.compile PCH_SOURCE on : ; + +type.set-generated-target-suffix PCH : intel win : pchi ; + toolset.add-requirements intel-win,shared:multi ; # Initializes the intel toolset for windows @@ -159,3 +168,31 @@ rule init ( version ? : # the compiler version } toolset.flags intel-win.link LIBRARY_OPTION intel : "" ; + +.escaped-double-quote = "\"" ; +# Unline msvc, intel-win does not support the -Yl option, so this is a version +# of msvc rules without -Yl +# Also note that intel compiler has totally broken handling of the -Fp option -- +# it always adds 'i' to the provided extension. So, we have to copy the actual +# file produced to the one that Boost.Build expects so that dependency analysis +# works. +actions compile-c-c++-pch +{ + $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" -Fp"$(<[1]:W:S=pch)" $(CC_RSPLINE))" "@($(<[1]:W).cpp:E=#include $(.escaped-double-quote)$(>[1]:D=)$(.escaped-double-quote))" $(.CC.FILTER) + copy "$(<[1]:W:S=pch)i" "$(<[1]:W:S=pch)" +} + +actions compile-c-c++-pch-s +{ + $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" -Fp"$(<[1]:W:S=pch)" $(CC_RSPLINE))" $(.CC.FILTER) + copy "$(<[1]:W:S=pch)i" "$(<[1]:W:S=pch)" +} + +# The compile.c.pch rule that is actually called from the generator for PCH +# is imported by toolset.inherit-rules, but it's not localized, so it will +# use compile-c-c++-pch* defined in msvc. Re-import it localized. +IMPORT msvc : compile.c.pch : intel-win : intel-win.compile.c.pch : localized ; +IMPORT msvc : compile.c++.pch : intel-win : intel-win.compile.c++.pch : localized ; +# This one is used by compile.c++.pch. Of course, this is a mess, but Python port +# will clean this up. +IMPORT msvc : get-rspline : intel-win : get-rspline ; diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index 727f09633..b55c725af 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -352,6 +352,7 @@ rule compile-c-c++ ( targets + : sources * ) # The global .escaped-double-quote variable is used to avoid messing up Emacs # syntax highlighting in the messy N-quoted code below. # +# If you change this rule, make corresponding change in intel-win.jam actions compile-c-c++-pch { $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" -Yl"__bjam_pch_symbol_$(>[1]:D=)" -Fp"$(<[1]:W)" $(CC_RSPLINE))" "@($(<[1]:W).cpp:E=#include $(.escaped-double-quote)$(>[1]:D=)$(.escaped-double-quote))" $(.CC.FILTER) @@ -362,6 +363,7 @@ actions compile-c-c++-pch # built source file for compiling the precompiled headers is expected to be # given as one of the source parameters. # +# If you change this rule, make corresponding change in intel-win.jam actions compile-c-c++-pch-s { $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" -Yl"__bjam_pch_symbol_$(>[1]:D=)" -Fp"$(<[1]:W)" $(CC_RSPLINE))" $(.CC.FILTER) @@ -943,7 +945,7 @@ local rule default-paths ( version ? ) } -local rule get-rspline ( target : lang-opt ) +rule get-rspline ( target : lang-opt ) { CC_RSPLINE on $(target) = [ on $(target) return $(lang-opt) -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) -c $(.nl)-D$(DEFINES)