2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 01:32:12 +00:00

Simplify PCH handling on intel-win, by using -Qpchi- to stop it

to messing up with specified output PCH names.


[SVN r49699]
This commit is contained in:
Vladimir Prus
2008-11-12 14:16:35 +00:00
parent bb8c997c17
commit 75cbc1ed37
3 changed files with 16 additions and 49 deletions

View File

@@ -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 ;

View File

@@ -18,7 +18,7 @@ import type ;
feature.extend-subfeature toolset intel : platform : win ;
toolset.inherit-generators intel-win <toolset>intel <toolset-intel:platform>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 <pch>on : <pch-source> ;
type.set-generated-target-suffix PCH : <toolset>intel <toolset-intel:platform>win : pchi ;
toolset.add-requirements <toolset>intel-win,<runtime-link>shared:<threading>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 <toolset>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 ;

View File

@@ -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)
}