[Scons-users] Custom build flags per FileNode using AddPreAction

Bill Deegan bill at baddogconsulting.com
Wed Apr 17 10:51:26 EDT 2019


Not sure I understand.
What do you mean by "build flags"?
Do you mean items on the compile command line?
Or something else?

On Wed, Apr 17, 2019 at 4:20 AM Ivan Kravets <me at ikravets.com> wrote:

> Hi,
>
> This is Ivan from PlatformIO.Org. Sometimes our users ask if it is
> possible to customize build flags per a source file which was previously
> added to a build process via Program() or StaticLibrary().
>
> SCons has a  useful AddPreAction mechanism and it works. For example,
>
> ```
> def test(env, source, target):
>     print(type(source[0]))
>
> env.AddPreAction("$BUILD_DIR/SomeLibrary/foo.cpp.o", test)
> ```
>
> It will print:
> ```
> <class 'SCons.Node.FS.File'>
> ```
>
> So, it is possible to customize "foo.cpp" with extra flags (for example,
> some macro, etc) having `SCons.Node.FS.File`?
>
> P.S: Similar what we can do with env.Object().
>
> Thanks in advance!
>
> Regards, Ivan.
> _______________________________________________
> 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/20190417/f5961251/attachment.html>


More information about the Scons-users mailing list