From 75cbc1ed373514cee02c02a2205a3c8ff8e36606 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 12 Nov 2008 14:16:35 +0000 Subject: [PATCH] Simplify PCH handling on intel-win, by using -Qpchi- to stop it to messing up with specified output PCH names. [SVN r49699] --- v2/build/toolset.jam | 11 ++++++----- v2/tools/intel-win.jam | 44 +++++++----------------------------------- v2/tools/msvc.jam | 10 +++------- 3 files changed, 16 insertions(+), 49 deletions(-) diff --git a/v2/build/toolset.jam b/v2/build/toolset.jam index 8d2be4d08..1ffe08fe7 100644 --- a/v2/build/toolset.jam +++ b/v2/build/toolset.jam @@ -417,15 +417,16 @@ rule inherit-generators ( toolset properties * : base : generators-to-ignore * ) # When such flag settings must be inherited, define a rule in base toolset # module and call it as needed. # -rule inherit-flags ( toolset : base : prohibited-properties * ) +rule inherit-flags ( toolset : base : prohibited-properties * : prohibited-vars * ) { for local f in $(.module-flags.$(base)) { local rule-or-module = $(.rule-or-module.$(f)) ; - if [ set.difference - $(.$(rule-or-module).condition.$(f)) : - $(prohibited-properties) - ] || ! $(.$(rule-or-module).condition.$(f)) + if ( [ set.difference + $(.$(rule-or-module).condition.$(f)) : + $(prohibited-properties) ] + || ! $(.$(rule-or-module).condition.$(f)) + ) && ( ! $(.$(rule-or-module).variable.$(f)) in $(prohibited-vars) ) { local rule_ = [ MATCH "[^.]*\.(.*)" : $(rule-or-module) ] ; local new-rule-or-module ; diff --git a/v2/tools/intel-win.jam b/v2/tools/intel-win.jam index a87c481ae..4eb3367aa 100644 --- a/v2/tools/intel-win.jam +++ b/v2/tools/intel-win.jam @@ -18,7 +18,7 @@ import type ; feature.extend-subfeature toolset intel : platform : win ; toolset.inherit-generators intel-win intel win : msvc ; -toolset.inherit-flags intel-win : msvc ; +toolset.inherit-flags intel-win : msvc : : YLOPTION ; toolset.inherit-rules intel-win : msvc ; # Override default do-nothing generators. @@ -27,8 +27,6 @@ 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 @@ -147,6 +145,11 @@ rule init ( version ? : # the compiler version } toolset.flags intel-win CFLAGS $(condition) : $(C++FLAGS) ; + # By default, when creating PCH, intel adds 'i' to the explicitly + # specified name of the PCH file. Of course, Boost.Build is not + # happy when compiler produces not the file it was asked for. + # The option below stops this behaviour. + toolset.flags intel-win CFLAGS : -Qpchi- ; if ! $(compatibility) { @@ -169,37 +172,4 @@ 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]:S=.pch:W)" $(CC_RSPLINE))" "@($(<[1]:W).cpp:E=#include $(.escaped-double-quote)$(>[1]:D=)$(.escaped-double-quote))" $(.CC.FILTER) -} - -actions compile-c-c++-pch-s -{ - $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" -Fp"$(<[1]:S=.pch:W)" $(CC_RSPLINE))" $(.CC.FILTER) -} - -# We also need to mess with pch vs. pchi here. -actions compile-c-c++ -{ - $(.CC) @"@($(<[1]:W).rsp:E="$(>[1]:W)" -Fo"$(<[1]:W)" -Yu"$(>[3]:D=)" -Fp"$(>[2]:S=.pch:W)" $(CC_RSPLINE))" $(.CC.FILTER) -} - - -# 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 ; -IMPORT msvc : compile.c : intel-win : intel-win.compile.c : localized ; -IMPORT msvc : compile.c++ : intel-win : intel-win.compile.c++ : 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 ; +toolset.flags intel-win YLOPTION ; diff --git a/v2/tools/msvc.jam b/v2/tools/msvc.jam index 583582e68..c181e085f 100644 --- a/v2/tools/msvc.jam +++ b/v2/tools/msvc.jam @@ -332,6 +332,7 @@ rule compile.c.pch ( targets + : sources * : properties * ) } } +toolset.flags msvc YLOPTION : "-Yl" ; # Action for running the C/C++ compiler without using precompiled headers. # @@ -347,29 +348,24 @@ rule compile-c-c++ ( targets + : sources * ) DEPENDS $(<[1]) : [ on $(<[1]) return $(PCH_FILE) ] ; } - # Action for running the C/C++ compiler using precompiled headers. In addition # to whatever else it needs to compile, this action also adds a temporary source # .cpp file used to compile the precompiled headers themselves. # # 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) + $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" $(YLOPTION)"__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) } # Action for running the C/C++ compiler using precompiled headers. An already # 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) + $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" $(YLOPTION)"__bjam_pch_symbol_$(>[1]:D=)" -Fp"$(<[1]:W)" $(CC_RSPLINE))" $(.CC.FILTER) }