diff --git a/.cproject b/.cproject index 7aa0b3f60..1501cc6af 100644 --- a/.cproject +++ b/.cproject @@ -1656,6 +1656,30 @@ true true + + make + -j2 + check.base + true + true + true + + + make + -j2 + timing.base + true + true + true + + + make + -j2 + base + true + true + true + make -j2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dfd4279a..bfce10a75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,10 +64,10 @@ add_subdirectory(gtsam) add_subdirectory(CppUnitLite) # Build Tests -add_subdirectory(tests) +#add_subdirectory(tests) # Build wrap -add_subdirectory(wrap) +#add_subdirectory(wrap) # Build examples -add_subdirectory(examples) +#add_subdirectory(examples) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index 4240563c1..76e027806 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -3,14 +3,20 @@ set (gtsam_subdirs 3rdparty base - geometry - inference - linear - nonlinear - slam) + # geometry + # inference + # linear + # nonlinear + # slam + ) foreach(subdir ${gtsam_subdirs}) + # Build local library and tests add_subdirectory(${subdir}) + + # link subfolder check to main check + add_dependencies(check check.${subdir}) + add_dependencies(timing timing.${subdir}) endforeach(subdir) #set (ccolamd_srcs diff --git a/gtsam/base/CMakeLists.txt b/gtsam/base/CMakeLists.txt index 43a5c0110..8a316543e 100644 --- a/gtsam/base/CMakeLists.txt +++ b/gtsam/base/CMakeLists.txt @@ -1,80 +1,34 @@ -# 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) +# Build convenience libraries +file(GLOB base_srcs "*.cpp") +add_library(base STATIC ${base_srcs}) -# install headers from 3rdparty libraries -add_subdirectory(3rdparty) +# Install headers +file(GLOB base_headers "*.h") +install(FILES ${base_headers} DESTINATION include/gtsam/base) -# Accumulate gtsam_srcs -set(gtsam_srcs ${ccolamd_srcs}) +add_custom_target(check.base) +add_custom_target(timing.base) -# 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 tests +file(GLOB base_tests_srcs "tests/test*.cpp") +foreach(test_src ${base_tests_srcs}) + get_filename_component(test_base ${test_src} NAME_WE) + set( test_bin base_${test_base} ) + add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_src}) + add_dependencies(check.base ${test_bin}) + add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) + target_link_libraries(${test_bin} CppUnitLite base) + add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) +endforeach(test_src) -# 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) +# Build timing scripts +file(GLOB base_tests_srcs "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(timing.base ${time_bin}) + target_link_libraries(${time_bin} CppUnitLite base) + add_custom_target(${time_base}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) +endforeach(time_src)