[Scons-users] Building generated code

Bill Deegan bill at baddogconsulting.com
Wed Mar 9 11:23:19 EST 2016


Ale,



On Wed, Mar 9, 2016 at 3:48 AM, Ale Strooisma <
a.strooisma at student.utwente.nl> wrote:

> Hi Bill,
>
> Thanks for your response.
>
> To answer your questions: yes, I am running two passes (or more): first I
> build the code generation framework. At some point the user runs it to
> generate code, then builds the generated software.
> The reason I am not doing this in one pass is that the code generation
> step depends on user input - it is really a separate step, a user
> interaction with the software, not part of the normal build process.
>
> A better solution than my if statement might be to set the Default targets
> to all targets except gen. Downside is that whenever I add a target I also
> need to add it to the defaults list, which is going to go wrong for
> certain. Isn't there some kind of 'NoDefault' option or something similar?
>

Ignore() is somewhat equivalent, though you need to specify which target
should ignore it's dependency.

Perhaps it would make sense to have your user's input go to a file, and
then that file run with  your tools to generate code.
Then code generation would only run when the file changes?
Assuming that the code is always needed by your system?



> Regarding your link: it is clear which files need to be built, so I don't
> think it applies.
>
o.k.

-Bill


>
> On 8 March 2016 at 23:28, Bill Deegan <bill at baddogconsulting.com> wrote:
>
>> Ale,
>>
>>
>> On Tue, Mar 8, 2016 at 6:17 AM, Ale Strooisma <
>> a.strooisma at student.utwente.nl> wrote:
>>
>>> Dear readers,
>>>
>>> my current project consists of two parts: a code generation framework
>>> and a runtime framework that in part consists of code generated by the code
>>> generation framework. Both also use some common parts. This architecture
>>> causes some difficulties with building:
>>>
>>> 1. By default I want to build everything except the generated code -
>>> because it might not be there. How would I do that? Currently I have put
>>> the target in an if statement:
>>>
>>> if 'gen' in COMMAND_LINE_TARGETS:
>>>     env.Program('gen', Glob('.build/gen/*.cpp') + common_source_files)
>>>
>>> The problem with this is that the target is not put in the build tree at
>>> all, instead of just not being executed. One consequence is that this
>>> target is not picked up by 'scons -c' unless I specifically include the
>>> target on the command line.
>>>
>>
>>
>> Why do this at all?
>> Are you currently running two passes of your build?
>> Why would the code not be there?
>> Is there a situation where you don't want to generate the files?
>>
>> Would this apply ?
>> https://bitbucket.org/scons/scons/wiki/DynamicSourceGenerator
>>
>>
>>> 2. A related problem: when I run 'scons -c gen', all the common
>>> sub-targets are cleaned as well, which makes perfect sense. Is there a way
>>> to only clean the files specific to this target?
>>>
>>
>> Not easily.  You could declare all the other files NoClean() when gen is
>> the target.
>>
>>
>> -Bill
>>
>>
>> _______________________________________________
>> 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/20160309/c70dd655/attachment.html>


More information about the Scons-users mailing list