[Scons-users] Building cppunit with scons (configure and make)

Marc Branchaud marcnarc at xiplink.com
Mon Dec 9 11:19:52 EST 2013


On 13-12-08 08:51 PM, Carl Cerecke wrote:

> Hi,

>

> We have cppunit (cppunit-1.12.1) that we would like to build with scons. It

> uses autoconf currently.

>

> I'm hoping to be able to use a variant_dir build....

>

> I tried to just use scons, but the ./configure step creates a number of files

> which the build requires.

>

> I tried to use the AutoConfigBuilder and MakeBuilder

> from http://www.scons.org/wiki/CustomBuilders, but have had a lot of trouble.

> The ./configure step wants to create files it doesn't need to, and the

> MakeBuilder is giving me weird errors (which I don't have handy right

> now...). I'm thinking that it might have something to do with the symlinks in

> the build directory confusing configure and make.

>

> After a bit of fiddling around, I've managed to get AutoConfigBuilder to run

> configure. I had to add a bunch of lines like so ()to get the symlinks created):

> Depends(configure_targets, Glob('3rdParty/cppunit-1.12.1/*/*'))


Could you post your SCons code? It's hard to diagnose a problem without the
code.

In my experience building autoconfigure things with SCons, you can generally
(but not always) chdir into your variant and run the configure script from
there, e.g.
cd /path/to/variant/dir
/path/to/source/dir/configure

This is the approach I use with cppunit. Unfortunately the AutoConfigBuilder
posted in the wiki doesn't allow for this. I've attached an *untested*
version that supports an AutoConfigScriptDir parameter. Set that to the
absolute path to your cppunit sources, like this:

cppunit_config = AutoConfig(AutoConfigScriptDir = Dir('.').srcnode().abspath)

If you're happy re-writing cppunit's makefiles in SCons, then more power to
you. Me, I just invoke "make install":

cppunit = Make(source = cppunit_config,
target = [ ... ],
MakePath = Dir('.').abspath, # Not the srcnode()
MakeTargets = 'install')

Set the target of the Make call to the installed cppunit library. As you
saw, SCons needs to know about the installed headers too. You must list all
of these explicitly, and use SideEffect() not Precious().

You can control where cppunit installs itself by passing --prefix to the
configure script (with the AutoConfigParams option). Note that the variant
directory where you *build* cppunit isn't where you want cppunit to *install*
itself. You should designate a place in your variant tree for installed
libraries & headers, and use --prefix to point cppunit there.

M.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: AutoConfig.py
Type: text/x-python
Size: 3454 bytes
Desc: not available
Url : http://four.pairlist.net/pipermail/scons-users/attachments/20131209/a69663b6/attachment-0001.py


More information about the Scons-users mailing list