gtsam/python
Ellon Mendes 05f6237f71 Define NO_IMPORT_ARRAY in all cpp files before including NumpyEigenConverter.hpp
This fixes the segmentation fault when converting numpy and Eigen.

The reason is that NumpyEigenConverter.hpp includes numpy/arrayobject.h, and for
the numpy's C-API to work in multiple files we need to define NO_IMPORT_ARRAY
before including numpy/arrayobject.h in all the source files but the one that
defines the module initialization (exportgtsam.cpp in out case), as explained
here:
http://docs.scipy.org/doc/numpy/reference/c-api.array.html#importing-the-api

Note that PY_ARRAY_UNIQUE_SYMBOL, also needed to work multifile, is already
defined on NumpyEigenConverter.hpp.
2015-12-02 13:35:15 +01:00
..
gtsam Move my developments to the handwritten structure of files that existed before 2015-12-02 13:35:15 +01:00
gtsam_tests Reworked python directory structure. Added readme on constructing python module. Added first unit test for point2. Everything needed to get it passing is also here, including some renaming of variables and emitted library names 2015-12-02 13:35:14 +01:00
handwritten Define NO_IMPORT_ARRAY in all cpp files before including NumpyEigenConverter.hpp 2015-12-02 13:35:15 +01:00
CMakeLists.txt Revert python module to use old handwritten files 2015-12-02 13:35:15 +01:00
README.md Markdown readme 2015-12-02 13:35:14 +01:00
setup.py Reworked python directory structure. Added readme on constructing python module. Added first unit test for point2. Everything needed to get it passing is also here, including some renaming of variables and emitted library names 2015-12-02 13:35:14 +01:00

README.md

Python Wrapper and Packaging

This directory contains the basic setup script and directory structure for the gtsam python module. During the build of gtsam, when GTSAM_BUILD_PYTHON is enabled, the following instructions will run.

  • Wrap parses gtsam.h and constructs a cpp file called ${moduleName}_python.cpp
  • This file is then compiled and linked with BoostPython, generating a shared library which can then be imported by python
  • The shared library is then copied to python/gtsam
  • The user can use the setup.py script to build and install a python package, allowing easy importing into a python project. Examples:
    • python setup.py sdist ---- Builds a tarball of the python package which can then be distributed
    • python setup.py install ---- Installs the package into the python dist-packages folder. Can then be imported from any python file.
  • To run the unit tests, you must first install the package on your path (TODO: Make this easier)

TODO: There are many issues with this build system, but these are the basics.