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

List:       boost-build
Subject:    [Boost-build] Cxxtest help request (again, sorry)
From:       "McMillan, Scott" <scott.mcmillan () gd-ais ! com>
Date:       2007-01-24 16:13:06
Message-ID: EC65DCC810869241816315431C3BBEF10BBC3F () vaff01-mail01 ! ad ! gd-ais ! com
[Download RAW message or body]

All:

 

I have been banging my head against Boost Build V2 to do a seemingly
simple task (at least in the Make world it was).

 

Some background on CxxTest unit test framework:  

 

In CxxTest you subclass from CxxTest base class to define a test suite
class (e.g., call it FooTS) and you preprocess the header file (FooTS.h)
using the cxxtestgen.pl Perl script to generate a C++ source file with
main() defined that will run the test (lets call this runner.cpp).  You
then compile and link FooTS.cpp and runner.cpp into a runner executable.

 

If you have more than one test suite class (e.g. FooTS and BarTS) you
may want to create a single runner that runs both suites so you have to
pass FooTS.h and BarTS.h as inputs to a single invocation of
cxxtestgen.pl to generate a single runner.cpp.  Then you compile and
link FooTS.cpp, BarTS.cpp, and runner.cpp into a runner executable.

 

I've tried to use generators (with minimal success if I am willing to
rename my header files and limit myself to a single test suite), custom
generators (no success), even brute force use of the "make" rule did not
work.  Now I am trying to create a new main target rule with no success
and some guidance would be greatly appreciated because there seems to be
some fundamental concepts about Boost.build that I don't understand.

 

In Jam-speak I would like at least to be able to say the following in my
Jamfile and have it do the right thing:

 

cxxtest-exe runner : FooTS.h BarTS.h : FooTS.cpp BarTS.cpp <other
sources> ;

 

 

So I have created an action that calls the perl script and am trying to
write the cxxtest-exe rule to wrap the exe rule as follows:

 

# Creates a cpp source file by processing a bunch of C++ header files

actions gen-cxxtest-runner-cpp

{

   cxxtestgen.pl -o $(<) $(>)

}

 

rule cxxtest-exe ( target-name :

                   cxxtest-headers + :

                   sources + :

                   requirements * :

                   default-build * :

                   usage-requirements * )

{

   # I have tried invoking the implicit gen-cxxtest-runner-cpp rule here
as well

 

   exe $(target-name) :

       $(sources) [ gen-cxxtest-runner-cpp $(target-name).cpp :
$(cxxtest-headers) ]:

       $(requirements) :

       $(default-build) :

       $(usage-requirements) ;

}

   

I have tried MANY variations on this theme but I encounter many
different problems:

 

-        I can't seem to get the rule to understand that runner.cpp will
be generated by the action

-        in many cases I can't get the runner.cpp to be created in the
correct bin/... subdirectory (this point is important since we do
simultaneous cross-platform builds and each must generate its own
runner.cpp).

-        I have tried to write a gen-cxxtest-runner-cpp RULE to help
without success.

 

I think my problem is that I don't know how to tell the build system
that I need to generate a CPP type target with a specific name from the
cxxtest headers.  I have been reading all of the documentation I can
find, and reading through the last 6 months of posting, but there seems
to be fundamental concepts I am just not able to grasp.  I would be
grateful if someone would help not only with this specific problem but
also by explaining how the solution works.

 

Thanks in advance for your help,

scott

 


[Attachment #3 (text/html)]

<html xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:1099522712;
	mso-list-type:hybrid;
	mso-list-template-ids:1094070560 67698689 67698691 67698693 67698689 67698691 \
67698693 67698689 67698691 67698693;} @list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l1
	{mso-list-id:1860000190;
	mso-list-type:hybrid;
	mso-list-template-ids:-787329772 1087273598 67698691 67698693 67698689 67698691 \
67698693 67698689 67698691 67698693;} @list l1:level1
	{mso-level-start-at:0;
	mso-level-number-format:bullet;
	mso-level-text:-;
	mso-level-tab-stop:24.0pt;
	mso-level-number-position:left;
	margin-left:24.0pt;
	text-indent:-.25in;
	font-family:"Courier New";
	mso-fareast-font-family:"Times New Roman";}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>All:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>I have been banging my head against Boost Build V2
to do a seemingly simple task (at least in the Make world it \
was).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>Some background on CxxTest unit test framework:&nbsp;
<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>In CxxTest you subclass from CxxTest base class to
define a test suite class (e.g., call it FooTS) and you preprocess the header
file (FooTS.h) using the cxxtestgen.pl Perl script to generate a C++ source
file with main() defined that will run the test (lets call this runner.cpp).&nbsp;
You then compile and link FooTS.cpp and runner.cpp into a runner \
executable.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>If you have more than one test suite class (e.g. FooTS
and BarTS) you may want to create a single runner that runs both suites so you
have to pass FooTS.h and BarTS.h as inputs to a single invocation of cxxtestgen.pl
to generate a single runner.cpp.&nbsp; Then you compile and link FooTS.cpp,
BarTS.cpp, and runner.cpp into a runner executable.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>I&#8217;ve tried to use generators (with minimal
success if I am willing to rename my header files and limit myself to a single
test suite), custom generators (no success), even brute force use of the \
&#8220;make&#8221; rule did not work.&nbsp; Now I am trying to create a new main \
target rule with no success and some guidance would be greatly appreciated because \
there seems to be some fundamental concepts about Boost.build that I don&#8217;t
understand.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>In Jam-speak I would like at least to be able to say
the following in my Jamfile and have it do the right \
thing:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>cxxtest-exe runner : FooTS.h BarTS.h : FooTS.cpp
BarTS.cpp &lt;other sources&gt; ;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>So I have created an action that calls the perl
script and am trying to write the cxxtest-exe rule to wrap the exe rule as
follows:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'># Creates a cpp source file by processing a bunch of
C++ header files<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>actions \
gen-cxxtest-runner-cpp<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>{<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp; cxxtestgen.pl &#8211;o $(&lt;) \
$(&gt;)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>}<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>rule cxxtest-exe ( target-name \
:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier \
New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 cxxtest-headers + :<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier \
New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 sources + :<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier \
New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 requirements * :<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier \
New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 default-build * :<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier \
New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 usage-requirements * )<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>{<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp; # I have tried invoking the implicit
gen-cxxtest-runner-cpp rule here as well<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp; exe $(target-name) \
:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;$(sources) [ \
gen-cxxtest-runner-cpp $(target-name).cpp : $(cxxtest-headers) \
]:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(requirements)
> <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$(default-build) :<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
$(usage-requirements) ;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>}<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>I have tried MANY variations on this theme but I
encounter many different problems:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-left:24.0pt;text-indent:-.25in;mso-list:l1 level1 \
lfo2'><![if !supportLists]><font size=2 face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New"'><span \
style='mso-list:Ignore'>-<font size=1 face="Times New Roman"><span style='font:7.0pt \
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></font></span></span></font><![endif]><font size=2 face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New"'>I can&#8217;t seem to get the rule \
to understand that runner.cpp will be generated by the \
action<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:24.0pt;text-indent:-.25in;mso-list:l1 level1 \
lfo2'><![if !supportLists]><font size=2 face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New"'><span \
style='mso-list:Ignore'>-<font size=1 face="Times New Roman"><span style='font:7.0pt \
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></font></span></span></font><![endif]><font size=2 face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New"'>in many cases I can&#8217;t get \
the runner.cpp to be created in the correct bin/... subdirectory (this point is \
important since we do simultaneous cross-platform builds and each must generate its \
own runner.cpp).<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:24.0pt;text-indent:-.25in;mso-list:l1 level1 \
lfo2'><![if !supportLists]><font size=2 face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New"'><span \
style='mso-list:Ignore'>-<font size=1 face="Times New Roman"><span style='font:7.0pt \
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></font></span></span></font><![endif]><font size=2 face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New"'>I have tried to write a \
gen-cxxtest-runner-cpp RULE to help without success.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>I think my problem is that I don&#8217;t know how to
tell the build system that I need to generate a CPP type target with a specific
name from the cxxtest headers.&nbsp; I have been reading all of the
documentation I can find, and reading through the last 6 months of posting, but
there seems to be fundamental concepts I am just not able to grasp.&nbsp; I
would be grateful if someone would help not only with this specific problem but
also by explaining how the solution works.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>Thanks in advance for your \
help,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>scott<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>



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

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