update readme

release/4.3a0
Duy-Nguyen Ta 2017-05-31 08:58:45 +08:00
parent 6b1c96869f
commit d25c15842c
1 changed files with 5 additions and 25 deletions

View File

@ -72,40 +72,20 @@ WRAPPING YOUR OWN PROJECT THAT USES GTSAM
- Set PYTHONPATH to include ${GTSAM_CYTHON_INSTALL_PATH} - Set PYTHONPATH to include ${GTSAM_CYTHON_INSTALL_PATH}
+ so that it can find gtsam Cython header: gtsam/gtsam.pxd + so that it can find gtsam Cython header: gtsam/gtsam.pxd
- Create your setup.py.in as follows:
```python
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import eigency
include_dirs = ["${CMAKE_SOURCE_DIR}/cpp", "${CMAKE_BINARY_DIR}"]
include_dirs += "${GTSAM_INCLUDE_DIR}".split(";")
include_dirs += eigency.get_includes(include_eigen=False)
setup(
ext_modules=cythonize(Extension(
"your_module_name",
sources=["your_module_name.pyx"],
include_dirs= include_dirs,
libraries=['gtsam'],
library_dirs=["${GTSAM_DIR}/../../"],
language="c++",
extra_compile_args=["-std=c++11"])),
)
```
- In your CMakeList.txt - In your CMakeList.txt
```cmake ```cmake
find_package(GTSAM REQUIRED) # Make sure gtsam's install folder is in your PATH find_package(GTSAM REQUIRED) # Make sure gtsam's install folder is in your PATH
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${GTSAM_DIR}/../GTSAMCMakeTools") set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${GTSAM_DIR}/../GTSAMCMakeTools")
# Wrap # Wrap
include(GtsamCythonWrap) include(GtsamCythonWrap)
wrap_and_install_library_cython("your_project_interface.h" wrap_and_install_library_cython("your_project_interface.h"
"from gtsam.gtsam cimport *" # extra import of gtsam/gtsam.pxd Cython header "from gtsam.gtsam cimport *" # extra import of gtsam/gtsam.pxd Cython header
"path_to_your_setup.py.in"
"your_install_path" "your_install_path"
"libraries_to_link_with_the_cython_module"
"dependencies_which_need_to_be_built_before_the_wrapper"
)
#Optional: install_cython_scripts and install_cython_files. See GtsamCythonWrap.cmake.
``` ```