| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | # This file should be used as a template for creating new projects using the CMake tools
 | 
					
						
							|  |  |  | # This project has the following features
 | 
					
						
							|  |  |  | #    - GTSAM linking
 | 
					
						
							|  |  |  | #    - Unit tests via CppUnitLite
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | #    - Scripts
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:12:59 +08:00
										 |  |  | #    - Automatic MATLAB wrapper generation
 | 
					
						
							| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ###################################################################################
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | # To create your own project, replace "example" with the actual name of your project
 | 
					
						
							| 
									
										
										
										
											2019-01-15 07:38:14 +08:00
										 |  |  | cmake_minimum_required(VERSION 3.0)
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | project(example CXX C)
 | 
					
						
							| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | # Include GTSAM CMake tools
 | 
					
						
							|  |  |  | find_package(GTSAMCMakeTools)
 | 
					
						
							|  |  |  | include(GtsamBuildTypes) # Load build type flags and default to Debug mode
 | 
					
						
							|  |  |  | include(GtsamTesting)    # Easy functions for creating unit tests and scripts
 | 
					
						
							|  |  |  | include(GtsamMatlabWrap) # Automatic MATLAB wrapper generation
 | 
					
						
							| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Ensure that local folder is searched before library folders
 | 
					
						
							|  |  |  | include_directories(BEFORE "${PROJECT_SOURCE_DIR}")
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ###################################################################################
 | 
					
						
							|  |  |  | # Find GTSAM components
 | 
					
						
							|  |  |  | find_package(GTSAM REQUIRED) # Uses installed package
 | 
					
						
							| 
									
										
										
										
											2019-02-09 05:18:21 +08:00
										 |  |  | # Note: Since Jan-2019, GTSAMConfig.cmake defines exported CMake targets
 | 
					
						
							|  |  |  | # that automatically do include the include_directories() without the need
 | 
					
						
							|  |  |  | # to call include_directories(), just target_link_libraries(NAME gtsam)
 | 
					
						
							|  |  |  | #include_directories(${GTSAM_INCLUDE_DIR})
 | 
					
						
							| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ###################################################################################
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | # Build static library from common sources
 | 
					
						
							|  |  |  | set(CONVENIENCE_LIB_NAME ${PROJECT_NAME})
 | 
					
						
							| 
									
										
										
										
											2019-05-18 06:29:35 +08:00
										 |  |  | add_library(${CONVENIENCE_LIB_NAME} SHARED example/PrintExamples.h example/PrintExamples.cpp)
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | target_link_libraries(${CONVENIENCE_LIB_NAME} gtsam)
 | 
					
						
							| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-18 06:29:35 +08:00
										 |  |  | # Install library
 | 
					
						
							|  |  |  | install(TARGETS ${CONVENIENCE_LIB_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | ###################################################################################
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | # Build tests (CMake tracks the dependecy to link with GTSAM through our project's static library)
 | 
					
						
							|  |  |  | gtsamAddTestsGlob("example" "tests/test*.cpp" "" "${CONVENIENCE_LIB_NAME}")
 | 
					
						
							| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ###################################################################################
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | # Build scripts (CMake tracks the dependecy to link with GTSAM through our project's static library)
 | 
					
						
							|  |  |  | gtsamAddExamplesGlob("*.cpp" "" "${CONVENIENCE_LIB_NAME}")
 | 
					
						
							| 
									
										
										
										
											2013-12-23 02:01:39 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ###################################################################################
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:14:03 +08:00
										 |  |  | # Build MATLAB wrapper (CMake tracks the dependecy to link with GTSAM through our project's static library)
 | 
					
						
							| 
									
										
										
										
											2014-05-07 10:05:59 +08:00
										 |  |  | wrap_and_install_library("example.h" "${CONVENIENCE_LIB_NAME}" "" "")
 |