[Scons-users] Listing all dependent headers?

Andrew C. Morrow andrew.c.morrow at gmail.com
Mon Oct 21 15:54:41 EDT 2013


Thanks. I was able to get it mostly working, doing something like:

hdrSrcDir = env.Dir("#/src")
hdrVarDir = env.Dir(".")

clientHeaders = [
hdrSrcDir.File("some/where/thing.h"),
hdrSrcDir.File("some/where/else/another_thing.h")]

clientHeaderDeps = set()
for node in clientHeaders:
clientHeaderDeps.add(node)
scanner = node.select_scanner(SourceFileScanner)
if scanner:
for dep in node.get_implicit_deps(env, scanner, path=(hdrSrcDir,
hdrVarDir)):
clientHeaderDeps.add(dep)
clientHeaders = clientHeaderDeps


One complication is that I actually don't wan't to get all of the dependent
headers, only the ones that originate within our 'src' directory (the
project has some bundled libraries for which I don't want headers), and
some of the headers I want to search are generated into the variant dir,
hence the path restriction to get_implciti_deps.

Overall though, this looks like it is working pretty well. The hardest part
was getting out of the mud trying to use the scanner directly, rather than
letting get_implicit_deps do it for me.



On Sun, Oct 20, 2013 at 2:23 PM, Dirk Bächle <tshortik at gmx.de> wrote:


> Hi Andrew,

>

>

> On 20.10.2013 19:34, Andrew C. Morrow wrote:

>

>>

>> I have a C++ header file that is intended for end user consumption, which

>> in turn depends on many other headers. Part of our build process is to

>> install this header and its dependencies to an install directory. But

>> sometimes the hand-rolled list of dependent headers becomes out of date.

>> I'd prefer that this list be auto-generated so it can no longer become

>> stale.

>>

>>

> note that there is also the FindSourceFiles() method, which you could use

> to search all source files automatically. If required,

> filter out the header files only, and then add the remaining Nodes to your

> Install alias. Just as an idea, untested though.

>

>

> I'd hoped that I could easily get the first level of required headers by

>> saying:

>>

>> requiredHeaders = SourceFileScanner(env.File("**user/facing/thing.h"),

>> env)

>>

>>

> The call itself should work like this. Maybe something is wrong in the way

> you setup CPPPATH?

> Please, try a less contrived example first, where all header are on the

> same subfolder level for example. Does it work then?

> Otherwise, a simple example project would help to track this down...

>

> Best regards,

>

> Dirk

>

> ______________________________**_________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/**mailman/listinfo/scons-users<http://four.pairlist.net/mailman/listinfo/scons-users>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131021/3e3bbce5/attachment.html


More information about the Scons-users mailing list