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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -