Update README, showing how to wrap other projects using gtsam
							parent
							
								
									70552e9f6d
								
							
						
					
					
						commit
						c34349bb7c
					
				|  | @ -51,6 +51,49 @@ Examples: | |||
|       noiseGaussian = dynamic_cast_noiseModel_Gaussian_noiseModel_Base(noiseBase)        | ||||
| ``` | ||||
| 
 | ||||
| WRAPPING YOUR OWN PROJECT THAT USES GTSAM | ||||
| ========================================= | ||||
| 
 | ||||
| - Set PYTHONPATH to include ${GTSAM_CYTHON_TOOLBOX_PATH} | ||||
|   + 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 | ||||
| ```cmake | ||||
| find_package(GTSAM REQUIRED) # Make sure gtsam's install folder is in your PATH | ||||
| set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${GTSAM_DIR}/../GTSAMCMakeTools") | ||||
| # Wrap | ||||
| include(GtsamCythonWrap) | ||||
| wrap_and_install_library_cython("your_project_interface.h" | ||||
|                                 "from gtsam.gtsam cimport *" # extra import of gtsam/gtsam.pxd Cython header | ||||
|                                 "path_to_your_setup.py.in" | ||||
|                                 "your_install_path" | ||||
| ``` | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| KNOWN ISSUES | ||||
| ============ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue