[Scons-users] dependency tracking across sub directories

William Deegan bill at baddogconsulting.com
Sun Oct 21 21:59:13 EDT 2012


Ram,

On Oct 21, 2012, at 4:49 PM, Ram Bhamidipaty <rambham at gmail.com> wrote:


> I have a source setup like this:

>

> <root>

> <root>SConstruct

>

> <root>/lib1/lib1.c

>

> <root>/bin1/bin1.c

>

> The binary bin1 depends on the library lib1.

>

> What is a good way to track this? I currently have SConscript files in

> each sub directory. The problem I am running into is that the

> SConscript file in the bin directory needs to depend on the library

> Node object. But how I get that object into the SConscript file.

>

> I suppose I could have the lib1/SConstript file return an object and

> then that could be passed to the bin1/SConscript - but that seems

> wrong - then the SConscript files themselves will have dependencies

> (need to do lib/SConscript before bin/SConscript). Seems messy.

>

> Is it better to have everything in the one SConscruct file?


Assuming you set the directory that your library is built into in your env['LIBPATH'] list, then you should just be able to specify the library(ies) in the LIBS in your program statement.

Hmm. I was just looking at the documents and we don't have a good example in them.


so if you build your library into libdir then in your bin1 dir's SConscript
env.Program('bin',['bin1.c'],LIBDIR=['../libdir'],LIBS=['lib1'])

-Bill



More information about the Scons-users mailing list