[Scons-users] Building generated code

Bill Deegan bill at baddogconsulting.com
Tue Mar 8 17:28:19 EST 2016


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


More information about the Scons-users mailing list