diff --git a/.cproject b/.cproject
index 45011fdf4..4de095933 100644
--- a/.cproject
+++ b/.cproject
@@ -258,14 +258,6 @@
true
true
-
- make
- -j2
- testGaussianFactor.run
- true
- true
- true
-
make
-j2
@@ -292,6 +284,7 @@
make
+
tests/testBayesTree.run
true
false
@@ -299,6 +292,7 @@
make
+
testBinaryBayesNet.run
true
false
@@ -346,6 +340,7 @@
make
+
testSymbolicBayesNet.run
true
false
@@ -353,6 +348,7 @@
make
+
tests/testSymbolicFactor.run
true
false
@@ -360,6 +356,7 @@
make
+
testSymbolicFactorGraph.run
true
false
@@ -375,11 +372,20 @@
make
+
tests/testBayesTree
true
false
true
+
+ make
+ -j2
+ testGaussianFactor.run
+ true
+ true
+ true
+
make
-j2
@@ -406,7 +412,6 @@
make
-
testGraph.run
true
false
@@ -478,7 +483,6 @@
make
-
testInference.run
true
false
@@ -486,7 +490,6 @@
make
-
testGaussianFactor.run
true
false
@@ -494,7 +497,6 @@
make
-
testJunctionTree.run
true
false
@@ -502,7 +504,6 @@
make
-
testSymbolicBayesNet.run
true
false
@@ -510,7 +511,6 @@
make
-
testSymbolicFactorGraph.run
true
false
@@ -580,22 +580,6 @@
false
true
-
- make
- -j2
- all
- true
- true
- true
-
-
- make
- -j2
- clean
- true
- true
- true
-
make
-j2
@@ -612,6 +596,22 @@
true
true
+
+ make
+ -j2
+ all
+ true
+ true
+ true
+
+
+ make
+ -j2
+ clean
+ true
+ true
+ true
+
make
-j2
@@ -636,7 +636,15 @@
true
true
-
+
+ make
+ -j2
+ all
+ true
+ true
+ true
+
+
make
-j2
check
@@ -644,6 +652,14 @@
true
true
+
+ make
+ -j2
+ clean
+ true
+ true
+ true
+
make
-j2
@@ -684,15 +700,7 @@
true
true
-
- make
- -j2
- all
- true
- true
- true
-
-
+
make
-j2
check
@@ -700,14 +708,6 @@
true
true
-
- make
- -j2
- clean
- true
- true
- true
-
make
-j2
@@ -1038,6 +1038,7 @@
make
+
testErrors.run
true
false
@@ -1493,7 +1494,6 @@
make
-
testSimulated2DOriented.run
true
false
@@ -1533,7 +1533,6 @@
make
-
testSimulated2D.run
true
false
@@ -1541,7 +1540,6 @@
make
-
testSimulated3D.run
true
false
@@ -1898,14 +1896,6 @@
true
true
-
- make
- -j2
- wrapmac_gtsam
- true
- true
- true
-
make
-j2
@@ -2156,7 +2146,6 @@
make
-
tests/testGaussianISAM2
true
false
@@ -2178,6 +2167,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
@@ -2274,23 +2303,7 @@
true
true
-
- make
- -j2
- install
- true
- true
- true
-
-
- make
- -j2
- clean
- true
- true
- true
-
-
+
make
-j2
check
@@ -2298,18 +2311,26 @@
true
true
-
+
make
-j2
- all
+ clean
true
true
true
-
+
make
-j2
- dist
+ install
+ true
+ true
+ true
+
+
+ make
+ -j2
+ all
true
true
true
@@ -2362,38 +2383,6 @@
true
true
-
- make
- -j2
- check
- true
- true
- true
-
-
- make
- -j2
- clean
- true
- true
- true
-
-
- make
- -j2
- install
- true
- true
- true
-
-
- make
- -j2
- all
- true
- true
- true
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e57d645c..5cb4aca22 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
project(GTSAM CXX C)
cmake_minimum_required(VERSION 2.6)
-# Set the version number for the libarary
+# Set the version number for the library
set (GTSAM_VERSION_MAJOR 0)
set (GTSAM_VERSION_MINOR 9)
set (GTSAM_VERSION_PATCH 3)
@@ -24,12 +24,21 @@ if( NOT cmake_build_type_tolower STREQUAL "debug"
endif()
# Add debugging flags
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-inline -Wall")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -Wall")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall -DNDEBUG -DEIGEN_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -fno-inline -Wall -DNDEBUG -DEIGEN_NO_DEBUG")
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG -Wall -DEIGEN_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -Wall -DEIGEN_NO_DEBUG")
# Configurable Options
-# TODO
+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)
+
+# Avoid building non-installed exes and unit tests when installing
+set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
# Pull in tests
enable_testing()
@@ -62,7 +71,11 @@ add_subdirectory(gtsam)
add_subdirectory(tests)
# Build wrap
-add_subdirectory(wrap)
+if (GTSAM_BUILD_WRAP)
+ add_subdirectory(wrap)
+endif(GTSAM_BUILD_WRAP)
# Build examples
-add_subdirectory(examples)
+if (GTSAM_BUILD_EXAMPLES)
+ add_subdirectory(examples)
+endif(GTSAM_BUILD_EXAMPLES)
diff --git a/CppUnitLite/CMakeLists.txt b/CppUnitLite/CMakeLists.txt
index 6fba22eac..6bd5446f9 100644
--- a/CppUnitLite/CMakeLists.txt
+++ b/CppUnitLite/CMakeLists.txt
@@ -5,5 +5,8 @@ FILE(GLOB cppunitlite_src "*.cpp")
ADD_LIBRARY(CppUnitLite STATIC ${cppunitlite_src})
-install(FILES ${cppunitlite_headers} DESTINATION include/CppUnitLite)
-install(TARGETS CppUnitLite ARCHIVE DESTINATION lib)
+option(GTSAM_INSTALL_CPPUNITLITE "Enable/Disable installation of CppUnitLite library" ON)
+if (GTSAM_INSTALL_CPPUNITLITE)
+ install(FILES ${cppunitlite_headers} DESTINATION include/CppUnitLite)
+ install(TARGETS CppUnitLite ARCHIVE DESTINATION lib)
+endif(GTSAM_INSTALL_CPPUNITLITE)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 7589e4ba0..27f85b2f7 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,15 +1,3 @@
-#set(examples_local_libs
-# slam
-# nonlinear
-# linear
-# inference
-# geometry
-# base
-# ccolamd
-# CppUnitLite
-# ${Boost_LIBRARIES}
-#)
-
add_custom_target(examples)
# Build example executables
diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt
index 51e9eef4b..71cf8448b 100644
--- a/gtsam/CMakeLists.txt
+++ b/gtsam/CMakeLists.txt
@@ -44,15 +44,17 @@ set(gtsam_srcs
${nonlinear_srcs}
${slam_srcs}
)
+
+option (GTSAM_BUILD_SHARED_LIBRARY "Enable/Disable building of a shared version of gtsam" ON)
# Versions
set(gtsam_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})
set(gtsam_soversion ${GTSAM_VERSION_MAJOR})
message(STATUS "GTSAM Version: ${gtsam_version}")
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
# build shared and static versions of the library
message(STATUS "Building GTSAM - static")
-#message(STATUS "GTSAM library sources ${gtsam_srcs}")
add_library(gtsam-static STATIC ${gtsam_srcs})
set_target_properties(gtsam-static PROPERTIES
OUTPUT_NAME gtsam
@@ -61,12 +63,14 @@ set_target_properties(gtsam-static PROPERTIES
SOVERSION ${gtsam_soversion})
install(TARGETS gtsam-static ARCHIVE DESTINATION lib)
-message(STATUS "Building GTSAM - shared")
-add_library(gtsam-shared SHARED ${gtsam_srcs})
-set_target_properties(gtsam-shared PROPERTIES
- OUTPUT_NAME gtsam
- CLEAN_DIRECT_OUTPUT 1
- VERSION ${gtsam_version}
- SOVERSION ${gtsam_soversion})
-install(TARGETS gtsam-shared LIBRARY DESTINATION lib )
+if (GTSAM_BUILD_SHARED_LIBRARY)
+ message(STATUS "Building GTSAM - shared")
+ add_library(gtsam-shared SHARED ${gtsam_srcs})
+ set_target_properties(gtsam-shared PROPERTIES
+ OUTPUT_NAME gtsam
+ CLEAN_DIRECT_OUTPUT 1
+ VERSION ${gtsam_version}
+ SOVERSION ${gtsam_soversion})
+ install(TARGETS gtsam-shared LIBRARY DESTINATION lib )
+endif(GTSAM_BUILD_SHARED_LIBRARY)
diff --git a/gtsam/base/CMakeLists.txt b/gtsam/base/CMakeLists.txt
index 6c788d9c8..e6818b787 100644
--- a/gtsam/base/CMakeLists.txt
+++ b/gtsam/base/CMakeLists.txt
@@ -2,9 +2,6 @@
file(GLOB base_headers "*.h")
install(FILES ${base_headers} DESTINATION include/gtsam/base)
-add_custom_target(check.base COMMAND ${CMAKE_CTEST_COMMAND})
-add_custom_target(timing.base)
-
# Components to link tests in this subfolder against
set(base_local_libs
CppUnitLite
@@ -12,29 +9,35 @@ set(base_local_libs
)
# 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} )
- message(STATUS "Adding Test ${test_bin}")
- 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})
- add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
-endforeach(test_src)
+if (GTSAM_BUILD_TESTS)
+ add_custom_target(check.base COMMAND ${CMAKE_CTEST_COMMAND})
+ 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} )
+ message(STATUS "Adding Test ${test_bin}")
+ 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})
+ add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
+ endforeach(test_src)
+endif(GTSAM_BUILD_TESTS)
# Build timing scripts
-file(GLOB base_timing_srcs "tests/time*.cpp")
-foreach(time_src ${base_timing_srcs})
- get_filename_component(time_base ${time_src} NAME_WE)
- set( time_bin base.${time_base} )
- message(STATUS "Adding Timing Benchmark ${time_bin}")
- 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})
- add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
-endforeach(time_src)
+if (GTSAM_BUILD_TIMING)
+ add_custom_target(timing.base)
+ file(GLOB base_timing_srcs "tests/time*.cpp")
+ foreach(time_src ${base_timing_srcs})
+ get_filename_component(time_base ${time_src} NAME_WE)
+ set( time_bin base.${time_base} )
+ message(STATUS "Adding Timing Benchmark ${time_bin}")
+ 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})
+ 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 9decf7fa5..2b4635638 100644
--- a/gtsam/geometry/CMakeLists.txt
+++ b/gtsam/geometry/CMakeLists.txt
@@ -5,9 +5,6 @@ add_dependencies(geometry base)
file(GLOB geometry_headers "*.h")
install(FILES ${geometry_headers} DESTINATION include/gtsam/geometry)
-add_custom_target(check.geometry COMMAND ${CMAKE_CTEST_COMMAND})
-add_custom_target(timing.geometry)
-
# Components to link tests in this subfolder against
set(geometry_local_libs
geometry
@@ -16,29 +13,35 @@ set(geometry_local_libs
)
# Build tests
-file(GLOB geometry_tests_srcs "tests/test*.cpp")
-foreach(test_src ${geometry_tests_srcs})
- get_filename_component(test_base ${test_src} NAME_WE)
- set( test_bin geometry.${test_base} )
- message(STATUS "Adding Test ${test_bin}")
- add_executable(${test_bin} ${test_src})
- add_dependencies(check.geometry ${test_bin})
- add_dependencies(check ${test_bin})
- add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
- target_link_libraries(${test_bin} ${geometry_local_libs})
- add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
-endforeach(test_src)
+if (GTSAM_BUILD_TESTS)
+ add_custom_target(check.geometry COMMAND ${CMAKE_CTEST_COMMAND})
+ file(GLOB geometry_tests_srcs "tests/test*.cpp")
+ foreach(test_src ${geometry_tests_srcs})
+ get_filename_component(test_base ${test_src} NAME_WE)
+ set( test_bin geometry.${test_base} )
+ message(STATUS "Adding Test ${test_bin}")
+ add_executable(${test_bin} ${test_src})
+ add_dependencies(check.geometry ${test_bin})
+ add_dependencies(check ${test_bin})
+ add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
+ target_link_libraries(${test_bin} ${geometry_local_libs})
+ add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
+ endforeach(test_src)
+endif(GTSAM_BUILD_TESTS)
# Build timing scripts
-file(GLOB geometry_timing_srcs "tests/time*.cpp")
-foreach(time_src ${geometry_timing_srcs})
- get_filename_component(time_base ${time_src} NAME_WE)
- set( time_bin geometry.${time_base} )
- message(STATUS "Adding Timing Benchmark ${time_bin}")
- 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})
- add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
-endforeach(time_src)
+if (GTSAM_BUILD_TIMING)
+ add_custom_target(timing.geometry)
+ file(GLOB geometry_timing_srcs "tests/time*.cpp")
+ foreach(time_src ${geometry_timing_srcs})
+ get_filename_component(time_base ${time_src} NAME_WE)
+ set( time_bin geometry.${time_base} )
+ message(STATUS "Adding Timing Benchmark ${time_bin}")
+ 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})
+ 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 f1b671ea2..158ce706e 100644
--- a/gtsam/inference/CMakeLists.txt
+++ b/gtsam/inference/CMakeLists.txt
@@ -5,9 +5,6 @@ add_dependencies(inference base)
file(GLOB inference_headers "*.h")
install(FILES ${inference_headers} DESTINATION include/gtsam/inference)
-add_custom_target(check.inference COMMAND ${CMAKE_CTEST_COMMAND})
-add_custom_target(timing.inference)
-
# Components to link tests in this subfolder against
set(inference_local_libs
inference
@@ -18,29 +15,35 @@ set(inference_local_libs
)
# Build tests
-file(GLOB inference_tests_srcs "tests/test*.cpp")
-foreach(test_src ${inference_tests_srcs})
- get_filename_component(test_base ${test_src} NAME_WE)
- set( test_bin inference.${test_base} )
- message(STATUS "Adding Test ${test_bin}")
- add_executable(${test_bin} ${test_src})
- add_dependencies(check.inference ${test_bin})
- add_dependencies(check ${test_bin})
- add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
- target_link_libraries(${test_bin} ${inference_local_libs})
- add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
-endforeach(test_src)
+if(GTSAM_BUILD_TESTS)
+ add_custom_target(check.inference COMMAND ${CMAKE_CTEST_COMMAND})
+ file(GLOB inference_tests_srcs "tests/test*.cpp")
+ foreach(test_src ${inference_tests_srcs})
+ get_filename_component(test_base ${test_src} NAME_WE)
+ set( test_bin inference.${test_base} )
+ message(STATUS "Adding Test ${test_bin}")
+ add_executable(${test_bin} ${test_src})
+ add_dependencies(check.inference ${test_bin})
+ add_dependencies(check ${test_bin})
+ add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
+ target_link_libraries(${test_bin} ${inference_local_libs})
+ add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
+ endforeach(test_src)
+endif(GTSAM_BUILD_TESTS)
# Build timing scripts
-file(GLOB inference_timing_srcs "tests/time*.cpp")
-foreach(time_src ${inference_timing_srcs})
- get_filename_component(time_base ${time_src} NAME_WE)
- set( time_bin inference.${time_base} )
- message(STATUS "Adding Timing Benchmark ${time_bin}")
- 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})
- add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
-endforeach(time_src)
+if(GTSAM_BUILD_TIMING)
+ add_custom_target(timing.inference)
+ file(GLOB inference_timing_srcs "tests/time*.cpp")
+ foreach(time_src ${inference_timing_srcs})
+ get_filename_component(time_base ${time_src} NAME_WE)
+ set( time_bin inference.${time_base} )
+ message(STATUS "Adding Timing Benchmark ${time_bin}")
+ 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})
+ 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 1a5aea09b..49438c5c9 100644
--- a/gtsam/linear/CMakeLists.txt
+++ b/gtsam/linear/CMakeLists.txt
@@ -5,9 +5,6 @@ add_dependencies(linear inference)
file(GLOB linear_headers "*.h")
install(FILES ${linear_headers} DESTINATION include/gtsam/linear)
-add_custom_target(check.linear COMMAND ${CMAKE_CTEST_COMMAND})
-add_custom_target(timing.linear)
-
# Components to link tests in this subfolder against
set(linear_local_libs
linear
@@ -19,29 +16,34 @@ set(linear_local_libs
)
# Build tests
-file(GLOB linear_tests_srcs "tests/test*.cpp")
-foreach(test_src ${linear_tests_srcs})
- get_filename_component(test_base ${test_src} NAME_WE)
- set( test_bin linear.${test_base} )
- message(STATUS "Adding Test ${test_bin}")
- add_executable(${test_bin} ${test_src})
- add_dependencies(check.linear ${test_bin})
- add_dependencies(check ${test_bin})
- add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
- target_link_libraries(${test_bin} ${linear_local_libs})
- add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
-endforeach(test_src)
+if (GTSAM_BUILD_TESTS)
+ add_custom_target(check.linear COMMAND ${CMAKE_CTEST_COMMAND})
+ file(GLOB linear_tests_srcs "tests/test*.cpp")
+ foreach(test_src ${linear_tests_srcs})
+ get_filename_component(test_base ${test_src} NAME_WE)
+ set( test_bin linear.${test_base} )
+ message(STATUS "Adding Test ${test_bin}")
+ add_executable(${test_bin} ${test_src})
+ add_dependencies(check.linear ${test_bin})
+ add_dependencies(check ${test_bin})
+ add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
+ target_link_libraries(${test_bin} ${linear_local_libs})
+ add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
+ endforeach(test_src)
+endif (GTSAM_BUILD_TESTS)
# Build timing scripts
-file(GLOB linear_timing_srcs "tests/time*.cpp")
-foreach(time_src ${linear_timing_srcs})
- get_filename_component(time_base ${time_src} NAME_WE)
- set( time_bin linear.${time_base} )
- message(STATUS "Adding Timing Benchmark ${time_bin}")
- 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})
- add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
-endforeach(time_src)
-
+if (GTSAM_BUILD_TIMING)
+ add_custom_target(timing.linear)
+ file(GLOB linear_timing_srcs "tests/time*.cpp")
+ foreach(time_src ${linear_timing_srcs})
+ get_filename_component(time_base ${time_src} NAME_WE)
+ set( time_bin linear.${time_base} )
+ message(STATUS "Adding Timing Benchmark ${time_bin}")
+ 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})
+ 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 b489b7ba6..070d88da4 100644
--- a/gtsam/nonlinear/CMakeLists.txt
+++ b/gtsam/nonlinear/CMakeLists.txt
@@ -5,9 +5,6 @@ add_dependencies(nonlinear linear)
file(GLOB nonlinear_headers "*.h")
install(FILES ${nonlinear_headers} DESTINATION include/gtsam/nonlinear)
-add_custom_target(check.nonlinear COMMAND ${CMAKE_CTEST_COMMAND})
-add_custom_target(timing.nonlinear)
-
# Components to link tests in this subfolder against
set(nonlinear_local_libs
nonlinear
@@ -20,29 +17,35 @@ set(nonlinear_local_libs
)
# Build tests
-file(GLOB nonlinear_tests_srcs "tests/test*.cpp")
-foreach(test_src ${nonlinear_tests_srcs})
- get_filename_component(test_base ${test_src} NAME_WE)
- set( test_bin nonlinear.${test_base} )
- message(STATUS "Adding Test ${test_bin}")
- add_executable(${test_bin} ${test_src})
- add_dependencies(check.nonlinear ${test_bin})
- add_dependencies(check ${test_bin})
- add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
- target_link_libraries(${test_bin} ${nonlinear_local_libs})
- add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
-endforeach(test_src)
+if (GTSAM_BUILD_TESTS)
+ add_custom_target(check.nonlinear COMMAND ${CMAKE_CTEST_COMMAND})
+ file(GLOB nonlinear_tests_srcs "tests/test*.cpp")
+ foreach(test_src ${nonlinear_tests_srcs})
+ get_filename_component(test_base ${test_src} NAME_WE)
+ set( test_bin nonlinear.${test_base} )
+ message(STATUS "Adding Test ${test_bin}")
+ add_executable(${test_bin} ${test_src})
+ add_dependencies(check.nonlinear ${test_bin})
+ add_dependencies(check ${test_bin})
+ add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
+ target_link_libraries(${test_bin} ${nonlinear_local_libs})
+ add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
+ endforeach(test_src)
+endif (GTSAM_BUILD_TESTS)
# Build timing scripts
-file(GLOB nonlinear_timing_srcs "tests/time*.cpp")
-foreach(time_src ${nonlinear_timing_srcs})
- get_filename_component(time_base ${time_src} NAME_WE)
- set( time_bin nonlinear.${time_base} )
- message(STATUS "Adding Timing Benchmark ${time_bin}")
- 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})
- add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
-endforeach(time_src)
+if (GTSAM_BUILD_TIMING)
+ add_custom_target(timing.nonlinear)
+ file(GLOB nonlinear_timing_srcs "tests/time*.cpp")
+ foreach(time_src ${nonlinear_timing_srcs})
+ get_filename_component(time_base ${time_src} NAME_WE)
+ set( time_bin nonlinear.${time_base} )
+ message(STATUS "Adding Timing Benchmark ${time_bin}")
+ 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})
+ 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 cc9e2c73d..7bce4f369 100644
--- a/gtsam/slam/CMakeLists.txt
+++ b/gtsam/slam/CMakeLists.txt
@@ -5,9 +5,6 @@ add_dependencies(slam nonlinear)
file(GLOB slam_headers "*.h")
install(FILES ${slam_headers} DESTINATION include/gtsam/slam)
-add_custom_target(check.slam COMMAND ${CMAKE_CTEST_COMMAND})
-add_custom_target(timing.slam)
-
# Components to link tests in this subfolder against
set(slam_local_libs
slam
@@ -21,29 +18,34 @@ set(slam_local_libs
)
# Build tests
-file(GLOB slam_tests_srcs "tests/test*.cpp")
-foreach(test_src ${slam_tests_srcs})
- get_filename_component(test_base ${test_src} NAME_WE)
- set( test_bin slam.${test_base} )
- message(STATUS "Adding Test ${test_bin}")
- add_executable(${test_bin} ${test_src})
- 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})
- add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
-endforeach(test_src)
+if (GTSAM_BUILD_TESTS)
+ add_custom_target(check.slam COMMAND ${CMAKE_CTEST_COMMAND})
+ file(GLOB slam_tests_srcs "tests/test*.cpp")
+ foreach(test_src ${slam_tests_srcs})
+ get_filename_component(test_base ${test_src} NAME_WE)
+ set( test_bin slam.${test_base} )
+ message(STATUS "Adding Test ${test_bin}")
+ add_executable(${test_bin} ${test_src})
+ 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})
+ add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
+ endforeach(test_src)
+endif (GTSAM_BUILD_TESTS)
# Build timing scripts
-file(GLOB slam_timing_srcs "tests/time*.cpp")
-foreach(time_src ${slam_timing_srcs})
- get_filename_component(time_base ${time_src} NAME_WE)
- set( time_bin slam.${time_base} )
- message(STATUS "Adding Timing Benchmark ${time_bin}")
- 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})
- add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
-endforeach(time_src)
-
+if (GTSAM_BUILD_TIMING)
+ add_custom_target(timing.slam)
+ file(GLOB slam_timing_srcs "tests/time*.cpp")
+ foreach(time_src ${slam_timing_srcs})
+ get_filename_component(time_base ${time_src} NAME_WE)
+ set( time_bin slam.${time_base} )
+ message(STATUS "Adding Timing Benchmark ${time_bin}")
+ 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})
+ add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
+ endforeach(time_src)
+endif (GTSAM_BUILD_TIMING)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 234c321d3..530dd54d2 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,30 +1,32 @@
-# Convenience targets
-add_custom_target(check.tests COMMAND ${CMAKE_CTEST_COMMAND})
-add_custom_target(timing.tests)
-
# Build tests
-file(GLOB tests_srcs "test*.cpp")
-foreach(test_src ${tests_srcs})
- get_filename_component(test_base ${test_src} NAME_WE)
- set( test_bin tests.${test_base} )
- message(STATUS "Adding Test ${test_bin}")
- add_executable(${test_bin} ${test_src})
- add_dependencies(check.tests ${test_bin})
- add_dependencies(check ${test_bin})
- add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
- target_link_libraries(${test_bin} gtsam-static CppUnitLite ${Boost_LIBRARIES})
- add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
-endforeach(test_src)
+if (GTSAM_BUILD_TESTS)
+ add_custom_target(check.tests COMMAND ${CMAKE_CTEST_COMMAND})
+ file(GLOB tests_srcs "test*.cpp")
+ foreach(test_src ${tests_srcs})
+ get_filename_component(test_base ${test_src} NAME_WE)
+ set( test_bin tests.${test_base} )
+ message(STATUS "Adding Test ${test_bin}")
+ add_executable(${test_bin} ${test_src})
+ add_dependencies(check.tests ${test_bin})
+ add_dependencies(check ${test_bin})
+ add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
+ target_link_libraries(${test_bin} gtsam-static CppUnitLite ${Boost_LIBRARIES})
+ add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
+ endforeach(test_src)
+endif (GTSAM_BUILD_TESTS)
# Build timing scripts
-file(GLOB timing_srcs "time*.cpp")
-foreach(time_src ${timing_srcs})
- get_filename_component(time_base ${time_src} NAME_WE)
- set( time_bin tests.${time_base} )
- message(STATUS "Adding Timing Benchmark ${time_bin}")
- add_executable(${time_bin} ${time_src})
- add_dependencies(timing.tests ${time_bin})
- add_dependencies(timing ${time_bin})
- target_link_libraries(${time_bin} gtsam-static CppUnitLite ${Boost_LIBRARIES})
- add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
-endforeach(time_src)
+if (GTSAM_BUILD_TIMING)
+ add_custom_target(timing.tests)
+ file(GLOB timing_srcs "time*.cpp")
+ foreach(time_src ${timing_srcs})
+ get_filename_component(time_base ${time_src} NAME_WE)
+ set( time_bin tests.${time_base} )
+ message(STATUS "Adding Timing Benchmark ${time_bin}")
+ add_executable(${time_bin} ${time_src})
+ add_dependencies(timing.tests ${time_bin})
+ add_dependencies(timing ${time_bin})
+ target_link_libraries(${time_bin} gtsam-static CppUnitLite ${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 4f855386f..95e731778 100644
--- a/wrap/CMakeLists.txt
+++ b/wrap/CMakeLists.txt
@@ -8,27 +8,30 @@ add_executable(wrap wrap.cpp)
target_link_libraries(wrap wrap_lib)
# Install wrap binary
-install(TARGETS wrap DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+option(GTSAM_INSTALL_WRAP "Enable/Disable installation of wrap utility" ON)
+if (GTSAM_INSTALL_WRAP)
+ install(TARGETS wrap DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+endif(GTSAM_INSTALL_WRAP)
# Install matlab header
install(FILES matlab.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/wrap)
# Build tests
-add_custom_target(check.wrap COMMAND ${CMAKE_CTEST_COMMAND})
-
-# 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} EXCLUDE_FROM_ALL ${test_src})
- add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
- add_dependencies(check ${test_bin})
- add_dependencies(check.wrap ${test_bin})
- target_link_libraries(${test_bin} CppUnitLite gtsam-static wrap_lib)
- add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
-endforeach(test_src)
+if (GTSAM_BUILD_TESTS)
+ add_custom_target(check.wrap COMMAND ${CMAKE_CTEST_COMMAND})
+ 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} EXCLUDE_FROM_ALL ${test_src})
+ add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
+ add_dependencies(check ${test_bin})
+ add_dependencies(check.wrap ${test_bin})
+ target_link_libraries(${test_bin} CppUnitLite gtsam-static wrap_lib)
+ add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
+ endforeach(test_src)
+endif(GTSAM_BUILD_TESTS)
# Wrap codegen
#usage: wrap mexExtension interfacePath moduleName toolboxPath
@@ -38,31 +41,84 @@ endforeach(test_src)
# toolboxPath : the directory in which to generate the wrappers
# [mexFlags] : extra flags for the mex command
-set(gtsam_matlab_toolbox ${CMAKE_INSTALL_PREFIX}/borg/toolbox)
-set(mexFlags "${Boost_INCLUDE_DIR} -I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/gtsam -I${CMAKE_INSTALL_PREFIX}/include/gtsam/base -I${CMAKE_INSTALL_PREFIX}/include/gtsam/geometry -I${CMAKE_INSTALL_PREFIX}/include/gtsam/linear -I${CMAKE_INSTALL_PREFIX}/include/gtsam/nonlinear -I${CMAKE_INSTALL_PREFIX}/include/gtsam/slam -L${CMAKE_BINARY_DIR} -lgtsam")
+set(mexFlags "-I${Boost_INCLUDE_DIR} -I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/gtsam -I${CMAKE_INSTALL_PREFIX}/include/gtsam/base -I${CMAKE_INSTALL_PREFIX}/include/gtsam/geometry -I${CMAKE_INSTALL_PREFIX}/include/gtsam/linear -I${CMAKE_INSTALL_PREFIX}/include/gtsam/nonlinear -I${CMAKE_INSTALL_PREFIX}/include/gtsam/slam -L${CMAKE_INSTALL_PREFIX}/lib -lgtsam")
set(toolbox_path ${CMAKE_BINARY_DIR}/wrap/gtsam)
set(moduleName gtsam)
+## Determine the mex extension
+# Apple Macintosh (64-bit) mexmaci64
+# Linux (32-bit) mexglx
+# Linux (64-bit) mexa64
+# Microsoft Windows (32-bit) mexw32
+# Windows (64-bit) mexw64
+
+# only support 64-bit apple
+if(CMAKE_HOST_APPLE)
+ set(mex_bin_extension_default mexmaci64)
+endif(CMAKE_HOST_APPLE)
+
+if(NOT CMAKE_HOST_APPLE)
+ # check 64 bit
+ if( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
+ set( HAVE_64_BIT 0 )
+ endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 )
+
+ if( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
+ set( HAVE_64_BIT 1 )
+ endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 8 )
+
+ # Check for linux machines
+ if (CMAKE_HOST_UNIX)
+ if (HAVE_64_BIT)
+ set(mex_bin_extension_default mexa64)
+ else (HAVE_64_BIT)
+ set(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)
+ else (HAVE_64_BIT)
+ set(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}")
+
# Actual build commands - separated by OS
-# FIXME: use mexext utility or flags to set this variable correctly
add_custom_target(wrap_gtsam COMMAND
- ./wrap mexa64 ${CMAKE_SOURCE_DIR} ${moduleName} ${toolbox_path} "${mexFlags}")
-add_custom_target(wrapmac_gtsam COMMAND
- ./wrap mexmaci64 ${CMAKE_SOURCE_DIR} ${moduleName} ${toolbox_path} "${mexFlags}")
+ ./wrap ${mex_bin_extension} ${CMAKE_SOURCE_DIR} ${moduleName} ${toolbox_path} "${mexFlags}")
-# Install toolbox
-# FIXME: parameterize this install path
-set(toolbox_install_path ${CMAKE_INSTALL_PREFIX}/borg/toolbox)
+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)
-# Primary toolbox files
-install(DIRECTORY ${toolbox_path} DESTINATION ${toolbox_install_path} FILES_MATCHING PATTERN "*.m")
-install(DIRECTORY ${toolbox_path} DESTINATION ${toolbox_install_path} FILES_MATCHING PATTERN "*.cpp")
-install(DIRECTORY ${toolbox_path} DESTINATION ${toolbox_install_path} FILES_MATCHING PATTERN "Makefile")
+set(toolbox_install_path ${CMAKE_INSTALL_PREFIX}/borg/toolbox CACHE DOCSTRING "Path to install matlab toolbox")
-# Examples
-file(GLOB matlab_examples "${CMAKE_SOURCE_DIR}/examples/matlab/*.m")
-install(FILES ${matlab_examples} DESTINATION ${toolbox_install_path}/gtsam/examples)
-
-# Tests
-file(GLOB matlab_tests "${CMAKE_SOURCE_DIR}/tests/matlab/*.m")
-install(FILES ${matlab_tests} DESTINATION ${toolbox_install_path}/gtsam/tests)
+if (GTSAM_INSTALL_MATLAB_TOOLBOX)
+ # Primary toolbox files
+ message(STATUS "Installing Matlab Toolbox to ${toolbox_install_path}")
+ install(DIRECTORY ${toolbox_path} DESTINATION ${toolbox_install_path} FILES_MATCHING PATTERN "*.m")
+ install(DIRECTORY ${toolbox_path} DESTINATION ${toolbox_install_path} FILES_MATCHING PATTERN "*.cpp")
+ install(DIRECTORY ${toolbox_path} DESTINATION ${toolbox_install_path} FILES_MATCHING PATTERN "Makefile")
+
+ # 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)
+ 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)
+ endif (GTSAM_INSTALL_MATLAB_TESTS)
+endif (GTSAM_INSTALL_MATLAB_TOOLBOX)