[CMake] Ruby & Python Binding with SWIG in CMake

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue May 13 05:11:40 EDT 2008


You definitely need a different directory if you are to generate
multiple object files, dependencies are computed based on the .obj
files...

For instance the jpeg library is compiled three times, and need a 8,
12 and 16 subdir, while all the sources are within the parent
directory:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Utilities/itkjpeg/?root=Insight

HTH
-Mathieu

On Tue, May 13, 2008 at 8:43 AM, David Graf <david.graf at 28msec.com> wrote:
>
>  I managed to solve the problem by generating each SWIG module in a separate
> directory. But it is not possible to use one SWIG interface file for every
> module. Thus, I added in every directory a '.i' file that just includes the
> original '.i' file from the upper dir (%include ../test.i).
>
>  David
>
>
>
>
>  Alan W. Irwin wrote:
> 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
>  __________________________
>
>
> _______________________________________________
>  CMake mailing list
>  CMake at cmake.org
>  http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Mathieu


More information about the CMake mailing list