[C++-sig] Building python modules with Makefile, CMake or SCons

Nicolas Rougier Nicolas.Rougier at loria.fr
Fri Apr 25 16:06:46 CEST 2008


Hello,

I've been experiencing different solutions to build "cross
modules" (where a class B in a module is a subclass of A in another
module) using different tools (namely Makefiles, CMake and SCons) and  I
thought it might interest people to have some simple examples.

The idea is to have a class A in module A and a class B, subclass of A,
in a module B. To make it work, I build first two libraries libmodule_A
and libmodule_B then I build python _module_A and _module_B and link
them against the libraries.

Prefix has been set to /home/local and you should have:
 /home/local/lib in your LD_LIBRARY_PATH
 /home/local/lib/python2.5/site-packages in your PYTHON_PATH


Makefile version :
------------------
make
make install
>>> from boost.makefile.module_B import *
>>> b = B()

CMake version :
---------------
mkdir build
cd build
cmake ..
make
make install
>>> from boost.cmake.module_B import *
>>> b = B()

SCons version :
---------------
scons install
>>> from boost.scons.module_B import *
>>> b = B()


I'm not familiar enough with bjam to propose a version for it,  if
someone knows how to do it...


Nicolas





-------------- next part --------------
A non-text attachment was scrubbed...
Name: boost-cmake.tgz
Type: application/x-compressed-tar
Size: 1334 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080425/8b285b0b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boost-scons.tgz
Type: application/x-compressed-tar
Size: 1061 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080425/8b285b0b/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: boost-makefile.tgz
Type: application/x-compressed-tar
Size: 1135 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080425/8b285b0b/attachment-0002.bin>


More information about the Cplusplus-sig mailing list