[CMake] Ruby & Python Binding with SWIG in CMake

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon May 12 17:41:48 EDT 2008


On 2008-05-12 11:00-0700 David Graf wrote:

> Hello
> 
> I have problems to generate Python and Ruby bindings with SWIG in CMake
> out of one SWIG interface file. In the following example, I have a small
> interface file and a CMake file that should generate Ruby and Python
> bindings. But the Ruby binding is not generated at all and the Python
> binding is broken because the two generation processes produce a library
> file with the same name (_test.so).
> 
> Does someone know how to produce bindings from one interface for several
> languages? I need bindings for Ruby, Python, PHP, Java, C#.
>

Multiple bindings should not be a problem for swig and CMake.  For example,
PLplot implements python and java bindings using swig.  If you want to see
how this example works in detail, look at
http://plplot.svn.sourceforge.net/viewvc/plplot/trunk.  In particular, you
should look at bindings/swig-support/plplotcapi.i (which defines our API for
swig), and CMakeLists.txt files and *.i files in bindings/python and
bindings/java.

Hope that working example helps you to figure out what is wrong for your own
attempt to build multiple bindings using swig and CMake.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list