diff --git a/.cproject b/.cproject index 3dbe58c87..b87d5e5a2 100644 --- a/.cproject +++ b/.cproject @@ -21,7 +21,7 @@ - + diff --git a/.project b/.project index 8ab25e91b..9856df2ea 100644 --- a/.project +++ b/.project @@ -23,7 +23,7 @@ org.eclipse.cdt.make.core.buildArguments - -j2 -j5 + -j5 org.eclipse.cdt.make.core.buildCommand diff --git a/CMakeLists.txt b/CMakeLists.txt index 0888638c2..b1cc13234 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON) option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" ON) option(GTSAM_BUILD_EXAMPLES "Enable/Disable building of examples" ON) option(GTSAM_BUILD_WRAP "Enable/Disable building of matlab wrap utility (necessary for matlab interface)" ON) +option(GTSAM_BUILD_CONVENIENCE_LIBRARIES "Enable/Disable using convenience librares for tests" ON) option(GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS "Enable/Disable linking tests against the convenince libraries for faster debugging" ON) @@ -46,10 +47,12 @@ option(GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS # FIXME: breaks generation and install of matlab toolbox #set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE) -# Pull in tests -enable_testing() -include(Dart) -include(CTest) +# Pull in infrastructure +if (GTSAM_BUILD_TESTS) + enable_testing() + include(Dart) + include(CTest) +endif() # Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index 71cf8448b..0ca316b36 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -20,14 +20,20 @@ set (3rdparty_srcs 3rdparty/CCOLAMD/Source/ccolamd.c 3rdparty/CCOLAMD/Source/ccolamd_global.c 3rdparty/UFconfig/UFconfig.c) -add_library(ccolamd STATIC ${3rdparty_srcs}) +if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + message(STATUS "Building Convenience Library: ccolamd") + add_library(ccolamd STATIC ${3rdparty_srcs}) +endif() # assemble core libaries foreach(subdir ${gtsam_subdirs}) # Build convenience libraries file(GLOB subdir_srcs "${subdir}/*.cpp") - add_library(${subdir} STATIC ${subdir_srcs}) set(${subdir}_srcs ${subdir_srcs}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + message(STATUS "Building Convenience Library: ${subdir}") + add_library(${subdir} STATIC ${subdir_srcs}) + endif() # Build local library and tests message(STATUS "Building ${subdir}") diff --git a/gtsam/base/CMakeLists.txt b/gtsam/base/CMakeLists.txt index 8ca43e1c2..f13e0b4f5 100644 --- a/gtsam/base/CMakeLists.txt +++ b/gtsam/base/CMakeLists.txt @@ -3,11 +3,15 @@ file(GLOB base_headers "*.h") install(FILES ${base_headers} DESTINATION include/gtsam/base) # Components to link tests in this subfolder against -set(base_local_libs - CppUnitLite - ${Boost_LIBRARIES} - base -) +if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + set(base_local_libs + CppUnitLite + base) +else() + set(base_local_libs + CppUnitLite + gtsam-static) +endif() # Build tests if (GTSAM_BUILD_TESTS) @@ -20,8 +24,11 @@ if (GTSAM_BUILD_TESTS) add_executable(${test_bin} ${test_src}) add_dependencies(check.base ${test_bin}) add_dependencies(check ${test_bin}) - add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) - target_link_libraries(${test_bin} ${base_local_libs}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${test_bin} ${base_local_libs}) + endif() + add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin} ) + target_link_libraries(${test_bin} ${base_local_libs} ${Boost_LIBRARIES}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) endif(GTSAM_BUILD_TESTS) @@ -37,7 +44,10 @@ if (GTSAM_BUILD_TIMING) add_executable(${time_bin} ${time_src}) add_dependencies(timing.base ${time_bin}) add_dependencies(timing ${time_bin}) - target_link_libraries(${time_bin} ${base_local_libs}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${time_bin} ${base_local_libs}) + endif() + target_link_libraries(${time_bin} ${base_local_libs} ${Boost_LIBRARIES}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) endforeach(time_src) endif(GTSAM_BUILD_TIMING) diff --git a/gtsam/geometry/CMakeLists.txt b/gtsam/geometry/CMakeLists.txt index 52a691ea0..46a9e17ac 100644 --- a/gtsam/geometry/CMakeLists.txt +++ b/gtsam/geometry/CMakeLists.txt @@ -1,17 +1,23 @@ -# link back to base -add_dependencies(geometry base) - # Install headers file(GLOB geometry_headers "*.h") install(FILES ${geometry_headers} DESTINATION include/gtsam/geometry) # Components to link tests in this subfolder against -set(geometry_local_libs - geometry - base - ${Boost_LIBRARIES} - CppUnitLite -) +if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + set(geometry_local_libs + geometry + base + CppUnitLite + ) + # link back to base + add_dependencies(geometry base) +else() + set(geometry_local_libs + CppUnitLite + gtsam-static + ) +endif() + # Build tests if (GTSAM_BUILD_TESTS) @@ -24,8 +30,11 @@ if (GTSAM_BUILD_TESTS) add_executable(${test_bin} ${test_src}) add_dependencies(check.geometry ${test_bin}) add_dependencies(check ${test_bin}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${test_bin} gtsam-static) + endif() add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) - target_link_libraries(${test_bin} ${geometry_local_libs}) + target_link_libraries(${test_bin} ${geometry_local_libs} ${Boost_LIBRARIES}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) endif(GTSAM_BUILD_TESTS) @@ -41,7 +50,10 @@ if (GTSAM_BUILD_TIMING) add_executable(${time_bin} ${time_src}) add_dependencies(timing.geometry ${time_bin}) add_dependencies(timing ${time_bin}) - target_link_libraries(${time_bin} ${geometry_local_libs}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${time_bin} gtsam-static) + endif() + target_link_libraries(${time_bin} ${geometry_local_libs} ${Boost_LIBRARIES}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) endforeach(time_src) endif(GTSAM_BUILD_TIMING) diff --git a/gtsam/inference/CMakeLists.txt b/gtsam/inference/CMakeLists.txt index 37986bb8b..0c72d647b 100644 --- a/gtsam/inference/CMakeLists.txt +++ b/gtsam/inference/CMakeLists.txt @@ -1,19 +1,23 @@ -# link back to previous convenience library -add_dependencies(inference base) - # Install headers file(GLOB inference_headers "*.h") install(FILES ${inference_headers} DESTINATION include/gtsam/inference) # Components to link tests in this subfolder against -set(inference_local_libs - inference - geometry - base - ccolamd - CppUnitLite - ${Boost_LIBRARIES} -) +if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + set(inference_local_libs + inference + geometry + base + ccolamd + CppUnitLite) + # link back to previous convenience library + add_dependencies(inference base) +else() + set(inference_local_libs + CppUnitLite + gtsam-static + ) +endif() # Build tests if(GTSAM_BUILD_TESTS) @@ -26,8 +30,11 @@ if(GTSAM_BUILD_TESTS) add_executable(${test_bin} ${test_src}) add_dependencies(check.inference ${test_bin}) add_dependencies(check ${test_bin}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${test_bin} ${inference_local_libs}) + endif() add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) - target_link_libraries(${test_bin} ${inference_local_libs}) + target_link_libraries(${test_bin} ${inference_local_libs} ${Boost_LIBRARIES}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) endif(GTSAM_BUILD_TESTS) @@ -43,7 +50,10 @@ if(GTSAM_BUILD_TIMING) add_executable(${time_bin} ${time_src}) add_dependencies(timing.inference ${time_bin}) add_dependencies(timing ${time_bin}) - target_link_libraries(${time_bin} ${inference_local_libs}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${time_bin} ${inference_local_libs}) + endif() + target_link_libraries(${time_bin} ${inference_local_libs} ${Boost_LIBRARIES}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) endforeach(time_src) endif(GTSAM_BUILD_TIMING) diff --git a/gtsam/linear/CMakeLists.txt b/gtsam/linear/CMakeLists.txt index 899de41c3..ad9157775 100644 --- a/gtsam/linear/CMakeLists.txt +++ b/gtsam/linear/CMakeLists.txt @@ -1,20 +1,25 @@ -# link back to base -add_dependencies(linear inference) - # Install headers file(GLOB linear_headers "*.h") install(FILES ${linear_headers} DESTINATION include/gtsam/linear) # Components to link tests in this subfolder against -set(linear_local_libs - linear - inference - geometry - base - ccolamd - CppUnitLite - ${Boost_LIBRARIES} -) +if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + set(linear_local_libs + linear + inference + geometry + base + ccolamd + CppUnitLite) + # link back to base + add_dependencies(linear inference) + +else() + set(linear_local_libs + CppUnitLite + gtsam-static + ) +endif() # Build tests if (GTSAM_BUILD_TESTS) @@ -27,8 +32,11 @@ if (GTSAM_BUILD_TESTS) add_executable(${test_bin} ${test_src}) add_dependencies(check.linear ${test_bin}) add_dependencies(check ${test_bin}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${test_bin} ${linear_local_libs}) + endif() add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) - target_link_libraries(${test_bin} ${linear_local_libs}) + target_link_libraries(${test_bin} ${linear_local_libs} ${Boost_LIBRARIES}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) endif (GTSAM_BUILD_TESTS) @@ -44,7 +52,10 @@ if (GTSAM_BUILD_TIMING) add_executable(${time_bin} ${time_src}) add_dependencies(timing.linear ${time_bin}) add_dependencies(timing ${time_bin}) - target_link_libraries(${time_bin} ${linear_local_libs}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${time_bin} ${linear_local_libs}) + endif() + target_link_libraries(${time_bin} ${linear_local_libs} ${Boost_LIBRARIES}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) endforeach(time_src) endif (GTSAM_BUILD_TIMING) diff --git a/gtsam/nonlinear/CMakeLists.txt b/gtsam/nonlinear/CMakeLists.txt index 6d917ffc5..7762437e7 100644 --- a/gtsam/nonlinear/CMakeLists.txt +++ b/gtsam/nonlinear/CMakeLists.txt @@ -1,21 +1,25 @@ -# link back to base -add_dependencies(nonlinear linear) - # Install headers file(GLOB nonlinear_headers "*.h") install(FILES ${nonlinear_headers} DESTINATION include/gtsam/nonlinear) # Components to link tests in this subfolder against -set(nonlinear_local_libs - nonlinear - linear - inference - geometry - base - ccolamd - CppUnitLite - ${Boost_LIBRARIES} -) +if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + set(nonlinear_local_libs + nonlinear + linear + inference + geometry + base + ccolamd + CppUnitLite) + # link back to base + add_dependencies(nonlinear linear) +else() + set(nonlinear_local_libs + CppUnitLite + gtsam-static + ) +endif() # Build tests if (GTSAM_BUILD_TESTS) @@ -28,8 +32,11 @@ if (GTSAM_BUILD_TESTS) add_executable(${test_bin} ${test_src}) add_dependencies(check.nonlinear ${test_bin}) add_dependencies(check ${test_bin}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${test_bin} ${nonlinear_local_libs} ) + endif() add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) - target_link_libraries(${test_bin} ${nonlinear_local_libs}) + target_link_libraries(${test_bin} ${nonlinear_local_libs} ${Boost_LIBRARIES}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) endif (GTSAM_BUILD_TESTS) @@ -45,7 +52,10 @@ if (GTSAM_BUILD_TIMING) add_executable(${time_bin} ${time_src}) add_dependencies(timing.nonlinear ${time_bin}) add_dependencies(timing ${time_bin}) - target_link_libraries(${time_bin} ${nonlinear_local_libs}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${time_bin} ${nonlinear_local_libs} ) + endif() + target_link_libraries(${time_bin} ${nonlinear_local_libs} ${Boost_LIBRARIES}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) endforeach(time_src) endif (GTSAM_BUILD_TIMING) diff --git a/gtsam/slam/CMakeLists.txt b/gtsam/slam/CMakeLists.txt index 2354aa96c..d78dc0d5a 100644 --- a/gtsam/slam/CMakeLists.txt +++ b/gtsam/slam/CMakeLists.txt @@ -1,22 +1,27 @@ -# link back to base -add_dependencies(slam nonlinear) - # Install headers file(GLOB slam_headers "*.h") install(FILES ${slam_headers} DESTINATION include/gtsam/slam) # Components to link tests in this subfolder against -set(slam_local_libs - slam - nonlinear - linear - inference - geometry - base - ccolamd - CppUnitLite - ${Boost_LIBRARIES} -) +if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + set(slam_local_libs + slam + nonlinear + linear + inference + geometry + base + ccolamd + CppUnitLite) + + # link back to base + add_dependencies(slam nonlinear geometry) +else() + set(slam_local_libs + CppUnitLite + gtsam-static + ) +endif() # Build tests if (GTSAM_BUILD_TESTS) @@ -30,7 +35,10 @@ if (GTSAM_BUILD_TESTS) add_dependencies(check.slam ${test_bin}) add_dependencies(check ${test_bin}) add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) - target_link_libraries(${test_bin} ${slam_local_libs}) + target_link_libraries(${test_bin} ${slam_local_libs} ${Boost_LIBRARIES}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${test_bin} ${slam_local_libs}) + endif() add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) endif (GTSAM_BUILD_TESTS) @@ -46,7 +54,10 @@ if (GTSAM_BUILD_TIMING) add_executable(${time_bin} ${time_src}) add_dependencies(timing.slam ${time_bin}) add_dependencies(timing ${time_bin}) - target_link_libraries(${time_bin} ${slam_local_libs}) + if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) + add_dependencies(${time_bin} ${slam_local_libs}) + endif() + target_link_libraries(${time_bin} ${slam_local_libs} ${Boost_LIBRARIES}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) endforeach(time_src) endif (GTSAM_BUILD_TIMING) diff --git a/wrap/CMakeLists.txt b/wrap/CMakeLists.txt index 6b97822d2..6794a601f 100644 --- a/wrap/CMakeLists.txt +++ b/wrap/CMakeLists.txt @@ -63,7 +63,7 @@ set(moduleName gtsam) # only support 64-bit apple if(CMAKE_HOST_APPLE) - set(mex_bin_extension_default mexmaci64) + set(GTSAM_MEX_BIN_EXTENSION_default mexmaci64) endif(CMAKE_HOST_APPLE) if(NOT CMAKE_HOST_APPLE) @@ -79,56 +79,56 @@ if(NOT CMAKE_HOST_APPLE) # Check for linux machines if (CMAKE_HOST_UNIX) if (HAVE_64_BIT) - set(mex_bin_extension_default mexa64) + set(GTSAM_MEX_BIN_EXTENSION_default mexa64) else (HAVE_64_BIT) - set(mex_bin_extension_default mexglx) + set(GTSAM_MEX_BIN_EXTENSION_default mexglx) endif (HAVE_64_BIT) endif(CMAKE_HOST_UNIX) # Check for windows machines if (CMAKE_HOST_WIN32) if (HAVE_64_BIT) - set(mex_bin_extension_default mexw64) + set(GTSAM_MEX_BIN_EXTENSION_default mexw64) else (HAVE_64_BIT) - set(mex_bin_extension_default mexw32) + set(GTSAM_MEX_BIN_EXTENSION_default mexw32) endif (HAVE_64_BIT) endif(CMAKE_HOST_WIN32) endif(NOT CMAKE_HOST_APPLE) # Allow for setting mex extension manually -set(mex_bin_extension ${mex_bin_extension_default} CACHE DOCSTRING "Extension for matlab mex files") -message(STATUS "Detected Matlab mex extension: ${mex_bin_extension_default}") -message(STATUS "Current Matlab mex extension: ${mex_bin_extension}") +set(GTSAM_MEX_BIN_EXTENSION ${GTSAM_MEX_BIN_EXTENSION_default} CACHE DOCSTRING "Extension for matlab mex files") +message(STATUS "Detected Matlab mex extension: ${GTSAM_MEX_BIN_EXTENSION_default}") +message(STATUS "Current Matlab mex extension: ${GTSAM_MEX_BIN_EXTENSION}") # Actual build commands - separated by OS add_custom_target(wrap_gtsam ALL COMMAND - ./wrap ${mex_bin_extension} ${CMAKE_SOURCE_DIR} ${moduleName} ${toolbox_path} "${mexFlags}" + ./wrap ${GTSAM_MEX_BIN_EXTENSION} ${CMAKE_SOURCE_DIR} ${moduleName} ${toolbox_path} "${mexFlags}" DEPENDS wrap) option(GTSAM_INSTALL_MATLAB_TOOLBOX "Enable/Disable installation of matlab toolbox" ON) option(GTSAM_INSTALL_MATLAB_EXAMPLES "Enable/Disable installation of matlab examples" ON) option(GTSAM_INSTALL_MATLAB_TESTS "Enable/Disable installation of matlab tests" ON) -set(toolbox_install_path ${CMAKE_INSTALL_PREFIX}/borg/toolbox CACHE DOCSTRING "Path to install matlab toolbox") +set(GTSAM_TOOLBOX_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/borg/toolbox CACHE DOCSTRING "Path to install matlab toolbox") if (GTSAM_INSTALL_MATLAB_TOOLBOX) # Primary toolbox files - message(STATUS "Installing Matlab Toolbox to ${toolbox_install_path}") - install(DIRECTORY DESTINATION ${toolbox_install_path}) # make an empty folder + message(STATUS "Installing Matlab Toolbox to ${GTSAM_TOOLBOX_INSTALL_PATH}") + install(DIRECTORY DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH}) # make an empty folder # exploit need for trailing slash to specify a full folder, rather than just its contents to copy - install(DIRECTORY ${toolbox_path} DESTINATION ${toolbox_install_path}) + install(DIRECTORY ${toolbox_path} DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH}) # Examples if (GTSAM_INSTALL_MATLAB_EXAMPLES) message(STATUS "Installing Matlab Toolbox Examples") file(GLOB matlab_examples "${CMAKE_SOURCE_DIR}/examples/matlab/*.m") - install(FILES ${matlab_examples} DESTINATION ${toolbox_install_path}/gtsam/examples) + install(FILES ${matlab_examples} DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH}/gtsam/examples) endif (GTSAM_INSTALL_MATLAB_EXAMPLES) # Tests if (GTSAM_INSTALL_MATLAB_TESTS) message(STATUS "Installing Matlab Toolbox Tests") file(GLOB matlab_tests "${CMAKE_SOURCE_DIR}/tests/matlab/*.m") - install(FILES ${matlab_tests} DESTINATION ${toolbox_install_path}/gtsam/tests) + install(FILES ${matlab_tests} DESTINATION ${GTSAM_TOOLBOX_INSTALL_PATH}/gtsam/tests) endif (GTSAM_INSTALL_MATLAB_TESTS) endif (GTSAM_INSTALL_MATLAB_TOOLBOX)