unit testing - Passing targets between SConscript files -


i'm trying hierarchical build working in scons. directory structure looks this:

code/sconstruct code/src/sconscript code/src/main.c code/src/foo.c code/src/bar.c code/src/tests/sconscript code/src/tests/test_foo.c code/src/tests/test_bar.c 

test_*.c need linked c files implement functions test, test_foo.c has linked foo.c example. src/sconscript has return number of targets src/tests/sconscript can construct binaries(1 each test). question best way accomplish using return() function? want order of files returned not matter, tuple not do. thought construct dictionary keys being filenames. wanted check there wasn't nicer way this; maybe can structure files differently facilitate cleaner build?

thanks in advance,

instead of passing targets around, consider creating 2 libraries: libfoo , libbar. link libraries in when compiling test_foo , test_bar binaries, referencing them variant_dir. trying pass around targets tends complicated , hard maintain.

in case you're wondering scons variant_dir is, way of placing build output (binaries, libraries, objects, etc) in directory other source code. use variant_dir argument on sconscript() function call, explained here.

instead of having create libraries, can refer source files, mentioned here. here simple example: (notice '#' character means relative root level sconstruct)

   env.program(target='test_foo', ['test_foo.c', '#src/foo.c']) 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -