[Scons-users] [c++] Automatically choosing sources for linking
Dirk Bächle
tshortik at gmx.de
Wed Aug 27 16:00:04 EDT 2014
Hi Viktor,
On 27.08.2014 10:41, Viktor Dick wrote:
> Hi everyone,
> it has been a few months and I finally came around to attack this
> problem again. I just tried to create an account in the wiki, but got an
> "Unknown action newaccount" error. Well, for the time being let me
> paraphrase my current solution:
>
> I created a Builder that creates a .dep file from a .cpp file, where the
> .dep file contains the list of other .cpp files whose object files
> should also be linked whenever the object file of this file is linked.
this is the point where I, personally, would stop and tell myself that
I'm doing something wrong. ;) You're starting to leave the safe
highways, and get lost bushwhacking...convinced that there simply *has*
to be a shortcut.
> [...]
>
> I do not know how difficult it is to include this in the design of
> SCons, but what we would need is an 'execute this function when you
> think you are ready to build this node (and all dependencies are
> satisfied), but the function may add dependencies and sources, so you
> might need to rebuild the dependency tree and postpone the building of
> this node'.
>
> Is there already such a possibility and I just didn't find it? Or is it
> possible to include it without completely rewriting SCons?
I think that this kind of extension just wouldn't fit the current design
of SCons, so it would definitely get difficult. The whole Taskmaster
process (with all its support for parallel execution, while properly
handling generated files as "side effects" for example) pretty much
relies on the assumption that a Node can be evaluated for whether it's
ready to be built. If it is, there are two possible outcomes: Either the
build succeeds, such that SCons can assume the target file exists and
update internal reference counting for other target nodes that might
wait on the built file to appear. Or, the target couldn't get built...so
the Node gets marked as failed, and for normal builds (without the "-k"
option) SCons stops.
Adding a third option ("node needed an update of its targets") will
require you to get your hands very dirty...so be prepared for some work. ;)
Best regards,
Dirk
More information about the Scons-users
mailing list