We've been using this for a while and it has been working, but we tried creating a release build for the first time, and ran into trouble (we had only been building debug builds).
It appears that, when variant=release, the <define>BOOST_TEST_DYN_LINK and <define>BOOST_TEST_MODULE=$(...) are being lost in the property set. When I try to debug it (by adding:
echo "Property set: " [ $(property-set).str ] ;
to the run rule in the generator), it shows those <define>s when I run with variant=debug, but not with variant=release.
I'm afraid what's going on with the generator is rather obscure to me -- I can't find documentation that helps me understand it. Is there something else I must be doing to ensure that the <define>s get passed in for both cases? or is there some kind of bug here?
As a refresher, here's a snippit of what I've currently got:
type.register TSS_TEST ;
class tss-test-generator : generator
{
import "class" : new ;
rule __init__ ( * : * )
{
generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
}
rule run ( project name ? : property-set : sources * )
{
echo "Property set: " [ $(property-set).str ] ;
local type ;
if [ $(property-set).get <toolset-gcc:version> ] = ppc
{
type = LINK ;
}
else
{
type = RUN ;
}
return [ generators.construct $(project) $(name) : $(type) : $(property-set) : $(sources) ] ;
}
}
generators.register [ new tss-test-generator tss.test : : TSS_TEST ] ;
# a helper rule to wrap the build stuff common to all boost.test test cases
rule run-test ( target : source : requirements * : properties * )
{
tss-test $(target) : $(source) boost_prg_exec_monitor $(requirements) : $(properties) : <define>BOOST_TEST_DYN_LINK <define>BOOST_TEST_MODULE=$(source:B) ;
}
We invoke the run-test rule something like this:
run-test foobar.test.test : foobar.test.cpp : : <testing.arg>--log_format=HRF <testing.arg>--log_level=warning ;
Ultimately, it fails to link because of "undefined reference to main" which is what you get if BOOST_TEST_DYN_LINK and BOOST_TEST_MODULE aren't defined.
Thank you,
Andrew