[Scons-users] SCons, forced includes and dependencies

Bill Deegan bill at baddogconsulting.com
Sat May 28 19:05:31 EDT 2016


Boris,

What's in helgrind.h ?

-Bill

On Sat, May 28, 2016 at 9:04 AM, Sazonov Boris <bsazonov at gmail.com> wrote:

> Hi.
> In my project I need to use '-include' gcc flag to include a special
> header before every source file. This file contains include and some
> defines to annotate g++ STL implementation, which are necessary to
> check multithreaded code under Helgrind.
>
> First of all, I add '-include' flag for compiler:
>
> env.Append(CPPFLAGS = ['-include', GetAbsolutePath('test/helgrind.h')])
>
> But it doesn't create dependency on this file. And I want all of my
> cpp files to depend on this header. To solve it, I've come up with
> scanner wrapper and overriding object builder in the environment:
>
> def forced_include_scanner(node, env, path, wrapped_scanner):
>   flags = env['CPPFLAGS']
>   print(wrapped_scanner(node, env, path)) # Returns an empty list
>   return map(lambda f: f[1], filter(lambda f: f[0] == '-include',
> zip(flags, flags[1:]))) + wrapped_scanner(node, env, path)
>
> obj_bld = env['BUILDERS']['Object']
> env['BUILDERS']['Object'] = Builder(action = obj_bld.action, suffix =
> obj_bld.suffix, src_suffix = obj_bld.src_suffix, source_scanner =
> SCons.Scanner.Base(function = forced_include_scanner, name =
> "ForcedIncludeScanner", argument = obj_bld.source_scanner))
>
> The problem is that wrapped_scanner(node, env, path) returns an empty list.
> What am I doing wrong?
>
> Thanks in advance!
> Regards,
> Boris Sazonov
> _______________________________________________
> 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/20160528/0b82eb8d/attachment.html>


More information about the Scons-users mailing list