diff --git a/.cproject b/.cproject index 64b368108..680e549ef 100644 --- a/.cproject +++ b/.cproject @@ -378,14 +378,6 @@ true true - - make - -j2 - testGaussianFactor.run - true - true - true - make -j2 @@ -412,6 +404,7 @@ make + tests/testBayesTree.run true false @@ -419,6 +412,7 @@ make + testBinaryBayesNet.run true false @@ -466,6 +460,7 @@ make + testSymbolicBayesNet.run true false @@ -473,6 +468,7 @@ make + tests/testSymbolicFactor.run true false @@ -480,6 +476,7 @@ make + testSymbolicFactorGraph.run true false @@ -495,11 +492,20 @@ make + tests/testBayesTree true false true + + make + -j2 + testGaussianFactor.run + true + true + true + make -j2 @@ -526,7 +532,6 @@ make - testGraph.run true false @@ -598,7 +603,6 @@ make - testInference.run true false @@ -606,7 +610,6 @@ make - testGaussianFactor.run true false @@ -614,7 +617,6 @@ make - testJunctionTree.run true false @@ -622,7 +624,6 @@ make - testSymbolicBayesNet.run true false @@ -630,7 +631,6 @@ make - testSymbolicFactorGraph.run true false @@ -700,22 +700,6 @@ false true - - make - -j2 - all - true - true - true - - - make - -j2 - clean - true - true - true - make -j2 @@ -732,6 +716,22 @@ true true + + make + -j2 + all + true + true + true + + + make + -j2 + clean + true + true + true + make -j2 @@ -756,7 +756,15 @@ true true - + + make + -j2 + all + true + true + true + + make -j2 check @@ -764,6 +772,14 @@ true true + + make + -j2 + clean + true + true + true + make -j2 @@ -804,15 +820,7 @@ true true - - make - -j2 - all - true - true - true - - + make -j2 check @@ -820,14 +828,6 @@ true true - - make - -j2 - clean - true - true - true - make -j2 @@ -1150,6 +1150,7 @@ make + testErrors.run true false @@ -1557,7 +1558,6 @@ make - testSimulated2DOriented.run true false @@ -1597,7 +1597,6 @@ make - testSimulated2D.run true false @@ -1605,7 +1604,6 @@ make - testSimulated3D.run true false @@ -1698,6 +1696,14 @@ true true + + make + -j2 + timing + true + true + true + make -j2 @@ -1932,7 +1938,6 @@ make - tests/testGaussianISAM2 true false @@ -1954,6 +1959,46 @@ true true + + make + -j2 + install + true + true + true + + + make + -j2 + clean + true + true + true + + + make + -j2 + check + true + true + true + + + make + -j2 + all + true + true + true + + + make + -j2 + dist + true + true + true + make -j2 @@ -2050,94 +2095,6 @@ true true - - make - -j2 - install - true - true - true - - - make - -j2 - clean - true - true - true - - - make - -j2 - check - true - true - true - - - make - -j2 - all - true - true - true - - - make - -j2 - dist - true - true - true - - - make - -j2 - check - true - true - true - - - make - -j2 - install - true - true - true - - - make - -j2 - tests/testSpirit.run - true - true - true - - - make - -j2 - tests/testWrap.run - true - true - true - - - make - -j2 - clean - true - true - true - - - make - -j2 - all - true - true - true - make -j2 @@ -2194,6 +2151,54 @@ false true + + make + -j2 + check + true + true + true + + + make + -j2 + install + true + true + true + + + make + -j2 + tests/testSpirit.run + true + true + true + + + make + -j2 + tests/testWrap.run + true + true + true + + + make + -j2 + clean + true + true + true + + + make + -j2 + all + true + true + true + diff --git a/CMakeLists.txt b/CMakeLists.txt index 094fcd59a..fe14fab87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -project(GTSAM CXX C) +project(gtsam CXX C) cmake_minimum_required(VERSION 2.6) # Set the version number for the libarary @@ -43,6 +43,7 @@ include(CTest) # Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) +add_custom_target(timing) # Find boost find_package(Boost 1.40 REQUIRED) @@ -69,4 +70,4 @@ add_subdirectory(tests) add_subdirectory(wrap) # Build examples -add_subdirectory(examples) \ No newline at end of file +add_subdirectory(examples) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c2c4113f6..615db98b5 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -4,7 +4,7 @@ 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) + target_link_libraries(${example_bin} gtsam-static) endforeach(example_src) add_subdirectory(vSLAMexample) diff --git a/examples/vSLAMexample/CMakeLists.txt b/examples/vSLAMexample/CMakeLists.txt index 0297159af..ecc51fe36 100644 --- a/examples/vSLAMexample/CMakeLists.txt +++ b/examples/vSLAMexample/CMakeLists.txt @@ -7,10 +7,10 @@ set ( srcs add_library(vSLAMexample ${srcs}) add_executable(vISAMexample vISAMexample.cpp) -target_link_libraries(vISAMexample vSLAMexample gtsam) +target_link_libraries(vISAMexample vSLAMexample gtsam-static) add_executable(vSFMexample vSFMexample.cpp) -target_link_libraries(vSFMexample vSLAMexample gtsam) +target_link_libraries(vSFMexample vSLAMexample gtsam-static) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index 5b795b11f..3499bff86 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -27,17 +27,32 @@ foreach(subdir ${gtsam_subdirs}) # install headers file(GLOB sub_gtsam_headers "${subdir}/*.h") - install(FILES ${sub_gtsam_headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/${subdir}) - + install(FILES ${sub_gtsam_headers} DESTINATION include/gtsam/${subdir}) +endforeach(subdir) + +# build shared and static versions of the library +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) +install(TARGETS ${PROJECT_NAME}-shared LIBRARY DESTINATION lib ) + +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) +install(TARGETS ${PROJECT_NAME}-static ARCHIVE 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) + target_link_libraries(${test_bin} CppUnitLite gtsam-static) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) @@ -47,13 +62,10 @@ foreach(subdir ${gtsam_subdirs}) 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(check ${time_bin}) - target_link_libraries(${time_bin} CppUnitLite gtsam) + 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 a single shared library -add_library(gtsam SHARED ${gtsam_srcs}) -install(TARGETS gtsam LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 96f101f5c..099307363 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -12,8 +12,9 @@ foreach(test_src ${tests_srcs}) set( test_bin ${test_base} ) add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_src}) add_dependencies(check ${test_bin}) + add_dependencies(${test_bin} ${PROJECT_NAME}-static) add_test(${test_bin} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) - target_link_libraries(${test_bin} CppUnitLite gtsam ${Boost_SERIALIZATION_LIBRARY}) + target_link_libraries(${test_bin} CppUnitLite gtsam-static ${Boost_SERIALIZATION_LIBRARY}) add_custom_target(${test_base}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src) @@ -23,7 +24,8 @@ 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(check ${time_bin}) - target_link_libraries(${time_bin} CppUnitLite gtsam) + add_dependencies(timing ${time_bin}) + add_dependencies(${test_bin} ${PROJECT_NAME}-static) + target_link_libraries(${time_bin} CppUnitLite gtsam-static) 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 index b6bf8b4f9..08f9b63c0 100644 --- a/wrap/CMakeLists.txt +++ b/wrap/CMakeLists.txt @@ -17,7 +17,7 @@ foreach(test_src ${wrap_test_srcs} ) add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_src}) add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) add_dependencies(check ${test_bin}) - target_link_libraries(${test_bin} CppUnitLite gtsam wrapLib) + target_link_libraries(${test_bin} CppUnitLite gtsam-static wrapLib) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) endforeach(test_src)