[Scons-users] Building generated code

Ale Strooisma a.strooisma at student.utwente.nl
Wed Mar 9 03:48:41 EST 2016


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?

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

Kind regards,
Ale Strooisma

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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160309/bf2e739f/attachment.html>


More information about the Scons-users mailing list