[Scons-users] PCH target file

Bill Deegan bill at baddogconsulting.com
Sun Aug 23 13:00:45 EDT 2015


Ora,

This seems to work fine:

SConstruct:









*env = Environment()env['PCHSTOP'] = 'Precompiled.h'abc =
env.PCH(target='abc.pch',source='Precompiled.cpp')print abcenv['PCH'] =
abc[0]env.SharedLibrary('pch_dll', 'Main.cpp')env.Program('pch_exe',
'Main.cpp')*

Output











*c:\Python27\python.exe
C:\cygwin64\home\William\scons\scons\bootstrap\src\script\scons.pyscons:
Reading SConscript files ...['abc.pch', 'abc.obj']scons: done reading
SConscript files.scons: Building targets ...cl /Foabc.obj /TP /nologo /c
Precompiled.cpp /YcPrecompiled.h /Fpabc.pchPrecompiled.cppcl /FoMain.obj /c
Main.cpp /TP /nologo /YuPrecompiled.h "/Fpabc.pch"Main.cpplink /nologo /dll
/out:pch_dll.dll /implib:pch_dll.lib Main.obj abc.objlink /nologo
/OUT:pch_exe.exe Main.obj abc.objscons: done building targets.*


I tried a few variants including specifying a directory in target and that
worked as well

-Bill

On Sun, Aug 23, 2015 at 12:24 PM, Bill Deegan <bill at baddogconsulting.com>
wrote:

> Ora,
>
> I'll take a look at the code.
> But sounds like variantDir's would be ideal for your usage, and resolve
> this problem for you.
>
> -Bill
>
> On Sun, Aug 23, 2015 at 11:59 AM, Ora <orshalev at gmail.com> wrote:
>
>> I am not using a variant dir.  I send the targets explicitly to the
>> builders.
>>
>> If the builder really doesn't accept a target, I'd rather build my own
>> and send the target as input.
>>
>> I'd just like to ensure I'm not overlooking anything before I do that.
>>
>> Ora
>>
>> On Sun, Aug 23, 2015 at 6:41 PM, Bill Deegan <bill at baddogconsulting.com>
>> wrote:
>>
>>> Ora,
>>>
>>> Are you using VariantDir's (Or variant_dir)?
>>> If so, try using the variantDir's copy of the source file for the pch?
>>>
>>> -Bill
>>>
>>> On Sun, Aug 23, 2015 at 11:14 AM, Ora <orshalev at gmail.com> wrote:
>>>
>>>> Each project is built in a different directory.
>>>>
>>>> My problem is that the PCH builder doesn't seem to accept a 'target',
>>>> and automatically creates the file in the source directory.
>>>>
>>>> I'm currently calling it with the source file as input.
>>>> PCH(source_file).
>>>>
>>>> When I tried sending PCH (target=target_file, source=source_file),
>>>> SCons failed  ('NoneType' object has no attribute 'side_effect').
>>>>
>>>> Is there a way to specify the target?
>>>>
>>>> Thanks,
>>>> Ora
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Aug 20, 2015 at 11:25 PM, Bill Deegan <
>>>> bill at baddogconsulting.com> wrote:
>>>>
>>>>> Ora,
>>>>>
>>>>> Seems like you need to have a different output file name for each
>>>>> project.. and/or build the output file in a variant dir or a different
>>>>> directory.
>>>>>
>>>>> -Bill
>>>>>
>>>>> On Thu, Aug 20, 2015 at 7:51 AM, Ora <orshalev at gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Is it possible to specify the output target in the PCH() builder?
>>>>>>
>>>>>> My problem is as such:
>>>>>>
>>>>>> I have several projects which use the same pre-compiled header file,
>>>>>> but compile it using different command line parameters. Currently, the PCH
>>>>>> file is being output into a common directory, and is therefore recompiled
>>>>>> every time I switch projects.
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Ora
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Scons-users mailing list
>>>>>> Scons-users at scons.org
>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-users at scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150823/d3fb3c7c/attachment.html>


More information about the Scons-users mailing list