|
Boost-Build : |
From: Matthew Herrmann (matthew.herrmann_at_[hidden])
Date: 2006-02-27 16:48:12
On Monday 27 February 2006 18:23, boost-build-request_at_[hidden] wrote:
Hi Volodya,
> Hi Matthew,
>
> > I'd like to register a pre-compile test which needs to run before
> > compiling our apps. This is to check for required libraries being
> > installed, paths set up, etc. The unit test output types are not suitable
> > since they takes built executables as a dependency, rather than being an
> > allowable dependency themselves.
> >
> > My approach was to register a file type, say CONFIGURE_CHECK, which would
> > contain a shell script that ran and produced a file on success (and no
> > file and non-zero error code on failure):
> >
> > lib my_library
> >
> > : pre_test.configure_check [ glob *.cpp ]
> >
> > ...
> > ;
> >
> > This fits well with the bjam file-based dependency design, and I could
> > then register a configure_check file type and users would only be forced
> > to re-check config on changes to the script.
> >
> > Question is: how do I make *.configure_check files ignored by the c++
> > compilation steps? Is there a modular way to do this? One hack is to just
> > output a .o (OBJ) file with no defined symbols, but I'd rather not.
>
> Well, don't put 'pre_test.configure_check' to sources:
>
> lib my_library
>
> : [ glob *.cpp ]
> : <dependency>pre_test.configure_check
> ;
>
> Assuming your configure check does not puts files into source directory,
> but only to build directory, this will have the right effect.
>
> In fact, is there any reason why your configure check creates .o files? I'm
> not 100% understand the approach you took.
>
> - Volodya
Thanks for that, that looks like just what I need.
<check.jam>
import type ;
type.register CHECK_SCRIPT : check ;
import generators ;
generators.register-standard check.run_script : CHECK_SCRIPT : OBJ ;
actions run_script
{
echo Running checking script...
rm -f $(<)
$SHELL $(>)
if test $? -eq 0 ; then
touch $(<)
exit 0
else
exit 1
fi
}
</check.jam>
I needed to specify a dependency without changing the behaviour of the items
following.
-- Matthew Herrmann matthew.herrmann_at_[hidden] Vice President, Software Architecture Zomojo Pty Ltd
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk