Boost logo

Boost :

Subject: Re: [boost] [build] Default compiler options for a toolset
From: Edward Diener (eldiener_at_[hidden])
Date: 2013-11-18 22:48:33


On 11/18/2013 4:56 PM, Steven Watanabe wrote:
> AMDG
>
> On 11/18/2013 12:48 PM, Edward Diener wrote:
>>
>> Thanks for the information, but interpreting the "action" versus the
>> actual command line generated is difficult for me. Maybe you can help.
>>
>
> b2 just expands all the variables in the action
> to generate the command line.
>
>> As an example here is the action from msvc.jam:
>>
>> actions compile-c-c++ bind PDB_NAME
>> {
>> $(.CC) @"@($(<[1]:W).rsp:E="$(>[1]:W)" -Fo"$(<[1]:W)"
>> $(PDB_CFLAG)"$(PDB_NAME)" -Yu"$(>[3]:D=)" -Fp"$(>[2]:W)" $(CC_RSPLINE))"
>> $(.CC.FILTER)
>> }
>>
>> or maybe
>>
>> actions compile-c-c++-pch
>> {
>> $(.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)$(.nl))"
>> $(.CC.FILTER)
>> }
>>
>> Now here is the actual command line generated from a single compile from
>> running bjam against a preprocessor test using msvc-11.0 with the -d2
>> option, like 'b2 -d2 toolset=msvc-11.0'.
>>
>> "tuple.cpp" -Fo"some_long_path\tuple.obj" -TP /Z7 /Od /Ob0 /W4 /GR
>> /MDd /Zc:forScope /Zc:wchar_t /wd4675 /EHs -c
>>
>> I am trying to discover where these options in the command line come
>> from in the actual action. In particular I am trying to discover what in
>> the action is generating the /EHs option.
>>
>
> Search for /EHs in msvc.jam:
>
> toolset.flags msvc.compile C++FLAGS
> <exception-handling>on/<asynch-exceptions>off/<extern-c-nothrow>off : /EHs ;

There are 4 lines of C++FLAGS

     toolset.flags msvc.compile C++FLAGS
<exception-handling>on/<asynch-exceptions>off/<extern-c-nothrow>off : /EHs ;
     toolset.flags msvc.compile C++FLAGS
<exception-handling>on/<asynch-exceptions>off/<extern-c-nothrow>on : /EHsc ;
     toolset.flags msvc.compile C++FLAGS
<exception-handling>on/<asynch-exceptions>on/<extern-c-nothrow>off : /EHa ;
     toolset.flags msvc.compile C++FLAGS
<exception-handling>on/<asynch-exceptions>on/<extern-c-nothrow>on : /EHac ;

How is a particular one chosen ?

>
> C++FLAGS appears in $(CC_RSPLINE), which is set in get-rspline.
>
> 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)
> $(.nl)\"-I$(INCLUDES:W)\" ] ;
> }


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk