trying a simpler build script approach
							parent
							
								
									4c54d05da9
								
							
						
					
					
						commit
						64c49bc431
					
				|  | @ -34,7 +34,7 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DEIGEN_NO_DEBUG") | |||
| set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DEIGEN_NO_DEBUG") | ||||
| 
 | ||||
| # Configurable Options | ||||
| 
 | ||||
| # TODO | ||||
| 
 | ||||
| # Pull in tests | ||||
| enable_testing() | ||||
|  |  | |||
|  | @ -15,3 +15,11 @@ foreach(eigen_dir ${eigen_dir_headers_all}) | |||
|         install(FILES Eigen/Eigen/${filename} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/Eigen/Eigen)      | ||||
|     endif() | ||||
| endforeach(eigen_dir) | ||||
| 
 | ||||
| # build convenience library | ||||
| set (ccolamd_srcs  | ||||
|  CCOLAMD/Source/ccolamd.c  | ||||
|  CCOLAMD/Source/ccolamd_global.c | ||||
|  UFconfig/UFconfig.c)  | ||||
| 
 | ||||
| add_library(ccolamd STATIC ${ccolamd_srcs})  | ||||
|  | @ -1,80 +1,85 @@ | |||
| # Build full gtsam library as a single library | ||||
| # and also build tests  | ||||
| set (gtsam_subdirs  | ||||
|     3rdparty | ||||
|     base  | ||||
|     geometry  | ||||
|     inference  | ||||
|     linear  | ||||
|     nonlinear  | ||||
|     slam) | ||||
| 
 | ||||
| foreach(subdir ${gtsam_subdirs}) | ||||
|     add_subdirectory(${subdir}) | ||||
| endforeach(subdir) | ||||
|   | ||||
| set (ccolamd_srcs  | ||||
|  3rdparty/CCOLAMD/Source/ccolamd.c  | ||||
|  3rdparty/CCOLAMD/Source/ccolamd_global.c | ||||
|  3rdparty/UFconfig/UFconfig.c)  | ||||
| 
 | ||||
| # install headers from 3rdparty libraries | ||||
| add_subdirectory(3rdparty) | ||||
| 
 | ||||
| # Accumulate gtsam_srcs | ||||
| set(gtsam_srcs ${ccolamd_srcs}) | ||||
| 
 | ||||
| # Get all sources and headers from each subdirectory | ||||
| foreach(subdir ${gtsam_subdirs}) | ||||
|     message(STATUS "Building ${subdir}") | ||||
|     file(GLOB sub_gtsam_srcs "${subdir}/*.cpp") | ||||
|     list(APPEND gtsam_srcs ${sub_gtsam_srcs}) | ||||
|      | ||||
|     # install headers | ||||
|     file(GLOB sub_gtsam_headers "${subdir}/*.h") | ||||
|     install(FILES ${sub_gtsam_headers} DESTINATION include/gtsam/${subdir}) | ||||
| endforeach(subdir) | ||||
| 
 | ||||
| # build shared and static versions of the library | ||||
| add_library(${PROJECT_NAME}-static STATIC ${gtsam_srcs}) | ||||
| set_target_properties(${PROJECT_NAME}-static PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") | ||||
| set_target_properties(${PROJECT_NAME}-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) | ||||
| set_target_properties(${PROJECT_NAME}-static PROPERTIES | ||||
|  	  VERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
|  	  SOVERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
|  	) | ||||
| install(TARGETS ${PROJECT_NAME}-static ARCHIVE DESTINATION lib) | ||||
| 
 | ||||
| add_library(${PROJECT_NAME}-shared SHARED ${gtsam_srcs}) | ||||
| set_target_properties(${PROJECT_NAME}-shared PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") | ||||
| set_target_properties(${PROJECT_NAME}-shared PROPERTIES CLEAN_DIRECT_OUTPUT 1) | ||||
| set_target_properties(${PROJECT_NAME}-shared PROPERTIES | ||||
|  	  VERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
|  	  SOVERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
|  	) | ||||
|  	 | ||||
| install(TARGETS ${PROJECT_NAME}-shared LIBRARY DESTINATION lib ) | ||||
| 
 | ||||
| # Get all sources and headers from each  | ||||
| foreach(subdir ${gtsam_subdirs}) | ||||
|     # Build tests | ||||
|     file(GLOB tests_srcs "${subdir}/tests/test*.cpp") | ||||
|     foreach(test_src ${tests_srcs}) | ||||
|         get_filename_component(test_base ${test_src} NAME_WE) | ||||
|         set( test_bin ${subdir}_${test_base} ) | ||||
|         add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_src}) | ||||
|         add_dependencies(${test_bin} ${PROJECT_NAME}-static) | ||||
|         add_dependencies(check ${test_bin}) | ||||
|         add_test(${subdir}/${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) | ||||
|         target_link_libraries(${test_bin} CppUnitLite gtsam-static) | ||||
|         add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) | ||||
|     endforeach(test_src) | ||||
|      | ||||
|     # Build timing scripts | ||||
|     file(GLOB time_srcs "${subdir}/tests/time*.cpp")  | ||||
|     foreach(time_src ${time_srcs}) | ||||
|         get_filename_component(time_base ${time_src} NAME_WE) | ||||
|         set( time_bin ${time_base} ) | ||||
|         add_executable(${time_bin} EXCLUDE_FROM_ALL ${time_src}) | ||||
|         add_dependencies(${test_bin} ${PROJECT_NAME}-static) | ||||
|         add_dependencies(timing ${time_bin}) | ||||
|         target_link_libraries(${time_bin} CppUnitLite gtsam-static) | ||||
|         add_custom_target(${time_base}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) | ||||
|     endforeach(time_src) | ||||
| endforeach(subdir) | ||||
| #set (ccolamd_srcs  | ||||
| # 3rdparty/CCOLAMD/Source/ccolamd.c  | ||||
| # 3rdparty/CCOLAMD/Source/ccolamd_global.c | ||||
| # 3rdparty/UFconfig/UFconfig.c)  | ||||
| # | ||||
| ## install headers from 3rdparty libraries | ||||
| #add_subdirectory(3rdparty) | ||||
| # | ||||
| ## Accumulate gtsam_srcs | ||||
| #set(gtsam_srcs ${ccolamd_srcs}) | ||||
| # | ||||
| ## Get all sources and headers from each subdirectory | ||||
| #foreach(subdir ${gtsam_subdirs}) | ||||
| #    message(STATUS "Building ${subdir}") | ||||
| #    file(GLOB sub_gtsam_srcs "${subdir}/*.cpp") | ||||
| #    list(APPEND gtsam_srcs ${sub_gtsam_srcs}) | ||||
| #     | ||||
| #    # install headers | ||||
| #    file(GLOB sub_gtsam_headers "${subdir}/*.h") | ||||
| #    install(FILES ${sub_gtsam_headers} DESTINATION include/gtsam/${subdir}) | ||||
| #endforeach(subdir) | ||||
| # | ||||
| ## build shared and static versions of the library | ||||
| #add_library(${PROJECT_NAME}-static STATIC ${gtsam_srcs}) | ||||
| #set_target_properties(${PROJECT_NAME}-static PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") | ||||
| #set_target_properties(${PROJECT_NAME}-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) | ||||
| #set_target_properties(${PROJECT_NAME}-static PROPERTIES | ||||
| # 	  VERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
| # 	  SOVERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
| # 	) | ||||
| #install(TARGETS ${PROJECT_NAME}-static ARCHIVE DESTINATION lib) | ||||
| # | ||||
| #add_library(${PROJECT_NAME}-shared SHARED ${gtsam_srcs}) | ||||
| #set_target_properties(${PROJECT_NAME}-shared PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") | ||||
| #set_target_properties(${PROJECT_NAME}-shared PROPERTIES CLEAN_DIRECT_OUTPUT 1) | ||||
| #set_target_properties(${PROJECT_NAME}-shared PROPERTIES | ||||
| # 	  VERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
| # 	  SOVERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
| # 	) | ||||
| # 	 | ||||
| #install(TARGETS ${PROJECT_NAME}-shared LIBRARY DESTINATION lib ) | ||||
| # | ||||
| ## Get all sources and headers from each  | ||||
| #foreach(subdir ${gtsam_subdirs}) | ||||
| #    # Build tests | ||||
| #    file(GLOB tests_srcs "${subdir}/tests/test*.cpp") | ||||
| #    foreach(test_src ${tests_srcs}) | ||||
| #        get_filename_component(test_base ${test_src} NAME_WE) | ||||
| #        set( test_bin ${subdir}_${test_base} ) | ||||
| #        add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_src}) | ||||
| #        add_dependencies(${test_bin} ${PROJECT_NAME}-static) | ||||
| #        add_dependencies(check ${test_bin}) | ||||
| #        add_test(${subdir}/${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) | ||||
| #        target_link_libraries(${test_bin} CppUnitLite gtsam-static) | ||||
| #        add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) | ||||
| #    endforeach(test_src) | ||||
| #     | ||||
| #    # Build timing scripts | ||||
| #    file(GLOB time_srcs "${subdir}/tests/time*.cpp")  | ||||
| #    foreach(time_src ${time_srcs}) | ||||
| #        get_filename_component(time_base ${time_src} NAME_WE) | ||||
| #        set( time_bin ${time_base} ) | ||||
| #        add_executable(${time_bin} EXCLUDE_FROM_ALL ${time_src}) | ||||
| #        add_dependencies(${test_bin} ${PROJECT_NAME}-static) | ||||
| #        add_dependencies(timing ${time_bin}) | ||||
| #        target_link_libraries(${time_bin} CppUnitLite gtsam-static) | ||||
| #        add_custom_target(${time_base}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) | ||||
| #    endforeach(time_src) | ||||
| #endforeach(subdir) | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,80 @@ | |||
| # Build full gtsam library as a single library | ||||
| # and also build tests  | ||||
| set (gtsam_subdirs  | ||||
|     base  | ||||
|     geometry  | ||||
|     inference  | ||||
|     linear  | ||||
|     nonlinear  | ||||
|     slam) | ||||
|   | ||||
| set (ccolamd_srcs  | ||||
|  3rdparty/CCOLAMD/Source/ccolamd.c  | ||||
|  3rdparty/CCOLAMD/Source/ccolamd_global.c | ||||
|  3rdparty/UFconfig/UFconfig.c)  | ||||
| 
 | ||||
| # install headers from 3rdparty libraries | ||||
| add_subdirectory(3rdparty) | ||||
| 
 | ||||
| # Accumulate gtsam_srcs | ||||
| set(gtsam_srcs ${ccolamd_srcs}) | ||||
| 
 | ||||
| # Get all sources and headers from each subdirectory | ||||
| foreach(subdir ${gtsam_subdirs}) | ||||
|     message(STATUS "Building ${subdir}") | ||||
|     file(GLOB sub_gtsam_srcs "${subdir}/*.cpp") | ||||
|     list(APPEND gtsam_srcs ${sub_gtsam_srcs}) | ||||
|      | ||||
|     # install headers | ||||
|     file(GLOB sub_gtsam_headers "${subdir}/*.h") | ||||
|     install(FILES ${sub_gtsam_headers} DESTINATION include/gtsam/${subdir}) | ||||
| endforeach(subdir) | ||||
| 
 | ||||
| # build shared and static versions of the library | ||||
| add_library(${PROJECT_NAME}-static STATIC ${gtsam_srcs}) | ||||
| set_target_properties(${PROJECT_NAME}-static PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") | ||||
| set_target_properties(${PROJECT_NAME}-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) | ||||
| set_target_properties(${PROJECT_NAME}-static PROPERTIES | ||||
|  	  VERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
|  	  SOVERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
|  	) | ||||
| install(TARGETS ${PROJECT_NAME}-static ARCHIVE DESTINATION lib) | ||||
| 
 | ||||
| add_library(${PROJECT_NAME}-shared SHARED ${gtsam_srcs}) | ||||
| set_target_properties(${PROJECT_NAME}-shared PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") | ||||
| set_target_properties(${PROJECT_NAME}-shared PROPERTIES CLEAN_DIRECT_OUTPUT 1) | ||||
| set_target_properties(${PROJECT_NAME}-shared PROPERTIES | ||||
|  	  VERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
|  	  SOVERSION "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
|  	) | ||||
|  	 | ||||
| install(TARGETS ${PROJECT_NAME}-shared LIBRARY DESTINATION lib ) | ||||
| 
 | ||||
| # Get all sources and headers from each  | ||||
| foreach(subdir ${gtsam_subdirs}) | ||||
|     # Build tests | ||||
|     file(GLOB tests_srcs "${subdir}/tests/test*.cpp") | ||||
|     foreach(test_src ${tests_srcs}) | ||||
|         get_filename_component(test_base ${test_src} NAME_WE) | ||||
|         set( test_bin ${subdir}_${test_base} ) | ||||
|         add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_src}) | ||||
|         add_dependencies(${test_bin} ${PROJECT_NAME}-static) | ||||
|         add_dependencies(check ${test_bin}) | ||||
|         add_test(${subdir}/${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) | ||||
|         target_link_libraries(${test_bin} CppUnitLite gtsam-static) | ||||
|         add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) | ||||
|     endforeach(test_src) | ||||
|      | ||||
|     # Build timing scripts | ||||
|     file(GLOB time_srcs "${subdir}/tests/time*.cpp")  | ||||
|     foreach(time_src ${time_srcs}) | ||||
|         get_filename_component(time_base ${time_src} NAME_WE) | ||||
|         set( time_bin ${time_base} ) | ||||
|         add_executable(${time_bin} EXCLUDE_FROM_ALL ${time_src}) | ||||
|         add_dependencies(${test_bin} ${PROJECT_NAME}-static) | ||||
|         add_dependencies(timing ${time_bin}) | ||||
|         target_link_libraries(${time_bin} CppUnitLite gtsam-static) | ||||
|         add_custom_target(${time_base}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) | ||||
|     endforeach(time_src) | ||||
| endforeach(subdir) | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue