[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost-build
Subject:    Re: [Boost-build] Trying to create CxxTest support
From:       "McMillan, Scott" <scott.mcmillan () gd-ais ! com>
Date:       2007-01-26 15:49:10
Message-ID: EC65DCC810869241816315431C3BBEF10BBC41 () vaff01-mail01 ! ad ! gd-ais ! com
[Download RAW message or body]

> But when I try to put this into a cxxtest.jam file in the Boost.build
> tools directory and import it into the Jamfile things stop working.
It
> complains that it does not know what the run-cxxtest rule is.
>=20
> 1) Could someone please clarify the steps needed to turn this into a
> tool I can import into any Jamfile (note that I did include an empty
> init rule but that did not help)?  The documentation in this area
would
> be greatly improved with some concrete examples.

I have solved this first problem by including an IMPORT line.  Here's
the entire contents of my cxxtest.jam (critiques welcome, and there may
be typos as I had to fat-finger this in):


rule init ( ) { }

import testing ;

#----------------------------------------------
# Empty rule needed to get 'make' to work
rule gen-cxxtest-runner ( target : sources + : properties * )
{
}

#----------------------------------------------
# Takes a set of one or more cxxtest header files as $(>)
# and creates a C++ source file in $(<)
#
# Still need to provide a way for user to specify the
# desired flags
#
actions gen-cxxtest-runner
{
   cxxtestgen.pl --abort-on-fail --have-eh --have-std --error-printer -o
$(<) $(>)
}

#----------------------------------------------
# Create a test executable but don't run it
#
rule cxxtest-exe ( target-name :
                   cxxtest-headers + :
                   sources * :
                   requirements * :
                   default-build * :
                   usage-requirements * )
{
   exe $(target-name) :
       $(sources) $(target-name)_runner.cpp :
       $(requirements) : $(default-build) : $(usage-requirements) ;

   make $(target-name)_runner.cpp : $(cxxtest-headers) :
gen-cxxtest-runner ;
}

#----------------------------------------------
rule run-cxxtest ( target-name :
                   cxxtest-headers + :
                   sources * :
                   requirements * :
                   #default-build * :
                   #usage-requirements *
                  )
{
   make $(target-name)_runner.cpp : $(cxxtest-headers) :
gen-cxxtest-runner ;

   unit-test $(target-name) :
             $(target-name)_runner.cpp $(sources) :
             $(requirements) ;
}

#----------------------------------------------
IMPORT $(__name__) : cxxtest-exe run-cxxtest gen-cxxtest-runner
  : : cxxtest-exe run-cxxtest gen-cxxtest-runner ;



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic