Skip to content
Davide Spataro edited this page Jul 11, 2015 · 1 revision

Python bindings are create using the swig tools. To produce python bidings do the followings:

  1. (from the root source tree) cd OpenCAL++-Py

  2. swig -c -python -I./include/swig_interfaces -I../OpenCAL/include -outdir ./lib ./opencal.i

  3. g -shared -fPIC -fopenmp opencal_wrap.cxx ../OpenCAL/source/* -I./ -I../OpenCAL++/include/ -I/usr/include/python2.7/ -o lib/_opencal.so

step (1) prepare the c++ side of the wrapper producing opencal_wrap.h and opencal_wrap.cxx files that are then compiled in a shared library in orer to be imported in python scripts. Step (3) performs the compilation of all the necessary files.

Note that the library should be included in the LD_LIBRARY_PATH in order to be imported in python scripts. (for example export LD_LIBRARY_PATH:$LD_LIBRARY_PATH:<path to _opencal.so>)

Clone this wiki locally