[C++-sig] How to install extensions using bjam(?)

Amos Anderson nitroamos at gmail.com
Thu Oct 22 21:13:21 CEST 2009

Hello --

I'm working on a project which is mixed C++/Python, and we use Boost
functionality in our C++, and we've set up bjam to compile our project
(on OSX). Everything seems to be working quite well.

To use our libraries from python scripts right now, we have to run this first:

export PYTHONPATH=$trunk:$trunk/lib
python $@

which is quite inconvenient. Now obviously I can skip this step by
pasting those two export statements into my .profile, however, at some
point we're going to start distributing this software and it would be
nice if we didn't require the end user to do something like that.

I can't believe that either of these 2 steps are how it's supposed to
work... so how should I be doing it?  Ideally, I want to set something
up so that the end user only has to run 1 (one) command to build &
install. Here are some things I've thought about:

1) Having bjam edit the user's .profile to set up these paths,
possibly by calling a script I write. This doesn't seem like the right
approach to me.

2) It looks like python's distutils is supposed to be able to help,
but it seems like a waste of time to figure out how to get distutils
to compile my code when I already have bjam pretty much figured out.
First, I assume that distutils can put my libraries on an automatic
DYLD_LIBRARY_PATH path that python knows about, because if it can't
then there's no point. But assuming that's not a problem, I can't
figure out how to tell distutils about Extensions that it shouldn't
try to build...

3) bjam includes a way to install libraries into a folder I can name,
but does it have a way to set environment variables? or automatically
figure out the right places to put all the python files? If so, I
can't find it...

4) ?



More information about the Cplusplus-sig mailing list