diff --git a/.cproject b/.cproject index 0e31dd254..6fc7d8f1f 100644 --- a/.cproject +++ b/.cproject @@ -1648,6 +1648,30 @@ true true + + make + -j2 + test + true + true + true + + + make + -j2 + testSimulated2D.run + true + true + true + + + make + -j2 + wrap_testWrap.run + true + true + true + make -j2 diff --git a/CMakeLists.txt b/CMakeLists.txt index e3a754810..3450ceccb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,8 +26,17 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DEIGEN_NO_DEBUG") ENABLE_TESTING() INCLUDE(Dart) +# Find boost +find_package(Boost 1.40 REQUIRED) + # General build settings -include_directories(gtsam CppUnitLite) +include_directories( + gtsam/3rdparty/UFconfig + gtsam/3rdparty/CCOLAMD/Include + ${CMAKE_SOURCE_DIR} + CppUnitLite + ${BOOST_INCLUDE_DIR}) +link_directories(${Boost_LIBRARY_DIRS}) # Build GTSAM library add_subdirectory(gtsam) @@ -36,10 +45,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) \ No newline at end of file +add_subdirectory(examples) \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 000000000..c2c4113f6 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,14 @@ +# Build example executables +FILE(GLOB example_srcs "*.cpp") +foreach(example_src ${example_srcs} ) + get_filename_component(example_base ${example_src} NAME_WE) + set( example_bin ${example_base} ) + add_executable(${example_bin} ${example_src}) + target_link_libraries(${example_bin} gtsam) +endforeach(example_src) + +add_subdirectory(vSLAMexample) + + + + diff --git a/examples/vSLAMexample/CMakeLists.txt b/examples/vSLAMexample/CMakeLists.txt new file mode 100644 index 000000000..0297159af --- /dev/null +++ b/examples/vSLAMexample/CMakeLists.txt @@ -0,0 +1,17 @@ +# Build vSLAMexample + +set ( srcs + Feature2D.cpp + vSLAMutils.cpp +) +add_library(vSLAMexample ${srcs}) + +add_executable(vISAMexample vISAMexample.cpp) +target_link_libraries(vISAMexample vSLAMexample gtsam) + +add_executable(vSFMexample vSFMexample.cpp) +target_link_libraries(vSFMexample vSLAMexample gtsam) + + + + diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index a47b0c858..efd0ad18f 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -9,10 +9,10 @@ set (gtsam_subdirs slam) # Include CCOLAMD source directly into gtsam -include_directories( - 3rdparty/UFconfig - 3rdparty/CCOLAMD/Include - ${CMAKE_SOURCE_DIR}) +#include_directories( +# 3rdparty/UFconfig +# 3rdparty/CCOLAMD/Include +# ${CMAKE_SOURCE_DIR}) set (ccolamd_srcs 3rdparty/CCOLAMD/Source/ccolamd.c @@ -22,6 +22,7 @@ set (ccolamd_srcs set(gtsam_srcs ${ccolamd_srcs}) add_library(ccolamd STATIC ${ccolamd_srcs}) +list(APPEND inner_libs ccolamd) # Get all sources and headers from each foreach(subdir ${gtsam_subdirs}) @@ -37,12 +38,27 @@ foreach(subdir ${gtsam_subdirs}) 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 ${EXECUTABLE_OUTPUT_PATH}/${subdir}/${test_base} ) + # Trying to put the executables in the right place + #set( test_bin ${EXECUTABLE_OUTPUT_PATH}${subdir}/${test_base} ) + set( test_bin ${subdir}_${test_base} ) add_executable(${test_bin} ${test_src}) - #add_test(${subdir}/${test_base} ${subdir}/${test_base}) - #target_link_libraries(${subdir}/${test_base} ${inner_libs} CppUnitLite ccolamd) - #add_custom_target(${test_base}.run ${EXECUTABLE_OUTPUT_PATH}/${test_base} ${ARGN}) + add_test(${subdir}/${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) + + #Linking: would like to link against subset of convenience libraries + #target_link_libraries(${test_bin} CppUnitLite ${inner_libs}) + target_link_libraries(${test_bin} CppUnitLite gtsam) + 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} ${time_src}) + target_link_libraries(${time_bin} CppUnitLite gtsam) + add_custom_target(${time_base}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) + endforeach(time_src) endforeach(subdir) # build a single shared library diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 000000000..cda7b1aa3 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,31 @@ +include_directories( + 3rdparty/UFconfig + 3rdparty/CCOLAMD/Include + ${CMAKE_SOURCE_DIR}) + +find_package(Boost COMPONENTS serialization REQUIRED) + +# Build tests +file(GLOB tests_srcs "test*.cpp") +foreach(test_src ${tests_srcs}) + get_filename_component(test_base ${test_src} NAME_WE) + # Trying to put the executables in the right place + set( test_bin ${test_base} ) + add_executable(${test_bin} ${test_src}) + add_test(${test_bin} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) + + target_link_libraries(${test_bin} CppUnitLite gtsam ${Boost_SERIALIZATION_LIBRARY}) + add_custom_target(${test_base}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) +endforeach(test_src) + +# Build timing scripts +file(GLOB time_srcs "time*.cpp") +foreach(time_src ${time_srcs}) + get_filename_component(time_base ${time_src} NAME_WE) + # Trying to put the executables in the right place + set( time_bin ${time_base} ) + add_executable(${time_bin} ${time_src}) + + target_link_libraries(${time_bin} CppUnitLite gtsam) + add_custom_target(${time_base}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) +endforeach(time_src) \ No newline at end of file diff --git a/wrap/CMakeLists.txt b/wrap/CMakeLists.txt new file mode 100644 index 000000000..b357481bf --- /dev/null +++ b/wrap/CMakeLists.txt @@ -0,0 +1,23 @@ +# Build/install Wrap + +# Build the executable itself +FILE(GLOB wrap_srcs "*.cpp") +LIST(REMOVE_ITEM wrap_srcs wrap.cpp) +add_library(wrapLib STATIC ${wrap_srcs}) +add_executable(wrap wrap.cpp) +target_link_libraries(wrap wrapLib) + +# Build tests +FILE(GLOB wrap_test_srcs "tests/test*.cpp") +add_definitions(-DTOPSRCDIR="${CMAKE_SOURCE_DIR}") +foreach(test_src ${wrap_test_srcs} ) + get_filename_component(test_base ${test_src} NAME_WE) + set( test_bin wrap_${test_base} ) + add_executable(${test_bin} ${test_src}) + add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) + target_link_libraries(${test_bin} CppUnitLite gtsam wrapLib) + add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) +endforeach(test_src) + + +