2015-11-19 21:59:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# get subdirectories list
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-26 01:21:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-15 14:59:02 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-19 21:59:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# get the sources needed to compile gtsam python module
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-26 01:21:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								set(gtsam_python_srcs "")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								foreach(subdir ${SUBDIRS})
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-19 21:59:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									file(GLOB ${subdir}_src "${subdir}/*.cpp")
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-26 01:21:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									list(APPEND gtsam_python_srcs ${${subdir}_src})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								endforeach()
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-15 14:59:02 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-19 21:59:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Create the library
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 22:29:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								add_library(gtsam_python SHARED exportgtsam.cpp ${gtsam_python_srcs})
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-25 03:01:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_toupper)
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 22:29:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								set_target_properties(gtsam_python PROPERTIES
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-09 19:55:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									OUTPUT_NAME                   _gtsampy
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-25 03:01:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    PREFIX                        ""
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ${build_type_toupper}_POSTFIX ""
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									SKIP_BUILD_RPATH              TRUE
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									CLEAN_DIRECT_OUTPUT           1
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 22:29:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-19 14:13:59 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								target_include_directories(gtsam_python SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								target_include_directories(gtsam_python SYSTEM PUBLIC ${NUMPY_INCLUDE_DIRS})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								target_include_directories(gtsam_python SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								target_include_directories(gtsam_python SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								target_include_directories(gtsam_python SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include/)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-25 07:28:16 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								target_link_libraries(gtsam_python
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      ${Boost_PYTHON${BOOST_PYTHON_VERSION_SUFFIX_UPPERCASE}_LIBRARY}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                      ${PYTHON_LIBRARY} gtsam)
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-19 21:59:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Cause the library to be output in the correct directory.
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 20:27:20 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# TODO: Change below to work on different systems (currently works only with Linux)
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-09 19:55:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								set(output_path ${CMAKE_CURRENT_BINARY_DIR}/../gtsam/_gtsampy.so)
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 20:27:20 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								add_custom_command(
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-25 03:01:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									OUTPUT ${output_path}
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 20:27:20 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									DEPENDS gtsam_python
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-25 03:01:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gtsam_python> ${output_path}
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-09 19:55:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									COMMENT "Copying extension module to python/gtsam/_gtsampy.so"
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-02 20:27:20 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-25 03:01:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								add_custom_target(copy_gtsam_python_module ALL DEPENDS ${output_path})
							 |