[Scons-users] Attaching an emitter to an existing builder

Bill Deegan bill at baddogconsulting.com
Wed Jan 27 17:11:09 EST 2021


Jeremy,

Greetings!
You're not the first to mention adding the map file as a side effect. (or
target)
Please go ahead and file and Issue on github for this.
Ideally with a simple example, what the gcc flag is, and what the file
naming/location would be?

So likely the easiest way to add an emitter to Program() would be the
following (not tested)

env.Append(PROGEMITTER = [my_map_emitter])

Give that a try and let us know if it works for you?

Also there's a discord server for scons help if you'd like to ask
questions/get help there.
https://discord.gg/bXVpWAy

Hope that helps!
-Bill

On Wed, Jan 27, 2021 at 1:31 PM Jeremy Elson <jelson at gmail.com> wrote:

> Hi scons gurus,
>
> Is there a way to attach an emitter to a pre-existing builder? I know how
> to create my own custom Builders that have emitters, but I'm trying to add
> an emitter to one of the standard builders that comes with SCons. I see a
> function in Builder called add_emitter, so I tried this:
>
>         def map_emitter(target, source, env):
>             print("emitter is being called")
>
>         env["BUILDERS"]["Program"].add_emitter(
>             suffix = ".map",
>             emitter = map_emitter)
>
> But it throws an exception:
>
> TypeError: 'EmitterProxy' object does not support item assignment
>
> I'm using the standard SCons Program() Builder to build my program. But I
> am also passing a linker option in LINKFLAGS so that when gcc is called at
> the link stage, it generates both the program binary as its main output and
> also an extra file (a .map file) that contains linker symbol metadata. I
> want SCons to understand this side-effect so that if the map file gets
> deleted, scons will run gcc again to regenerate it.
>
> Thanks!
>
> -Jeremy
>
> _______________________________________________
> 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/20210127/1df9cbad/attachment.html>


More information about the Scons-users mailing list