Back-ported cmake from the 2.0prep branch
parent
8e41e032b0
commit
59b1197c9f
|
@ -40,8 +40,6 @@ 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_USE_QUATERNIONS "Enable/Disable using an internal Quaternion representation for rotations instead of rotation matrices" OFF)
|
||||
option(GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS
|
||||
"Enable/Disable linking tests against the convenience libraries for faster debugging" ON)
|
||||
|
||||
# Add the Quaternion Build Flag if requested
|
||||
if (GTSAM_USE_QUATERNIONS)
|
||||
|
@ -53,10 +51,16 @@ endif(GTSAM_USE_QUATERNIONS)
|
|||
# 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()
|
||||
|
||||
# Use macros for creating tests/timing scripts
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
include(GtsamTesting)
|
||||
|
||||
# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck)
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
|
||||
|
@ -71,7 +75,7 @@ include_directories(
|
|||
gtsam/3rdparty/CCOLAMD/Include
|
||||
${CMAKE_SOURCE_DIR}
|
||||
CppUnitLite
|
||||
${BOOST_INCLUDE_DIR})
|
||||
${Boost_INCLUDE_DIR})
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
|
||||
# Build CppUnitLite
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
# Build macros for using tests
|
||||
|
||||
# Collects all tests in an adjacent tests folder and builds them
|
||||
macro(gtsam_add_tests subdir libs)
|
||||
add_custom_target(check.${subdir} COMMAND ${CMAKE_CTEST_COMMAND})
|
||||
file(GLOB tests_srcs "tests/test*.cpp")
|
||||
foreach(test_src ${tests_srcs})
|
||||
get_filename_component(test_base ${test_src} NAME_WE)
|
||||
set( test_bin ${subdir}.${test_base} )
|
||||
message(STATUS "Adding Test ${test_bin}")
|
||||
add_executable(${test_bin} ${test_src})
|
||||
add_dependencies(check.${subdir} ${test_bin})
|
||||
add_dependencies(check ${test_bin})
|
||||
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin} )
|
||||
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
|
||||
add_dependencies(${test_bin} ${libs} CppUnitLite)
|
||||
target_link_libraries(${test_bin} ${libs} ${Boost_LIBRARIES} CppUnitLite)
|
||||
else()
|
||||
add_dependencies(${test_bin} gtsam-static)
|
||||
target_link_libraries(${test_bin} ${Boost_LIBRARIES} gtsam-static CppUnitLite)
|
||||
endif()
|
||||
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
|
||||
endforeach(test_src)
|
||||
endmacro()
|
||||
|
||||
# Collects all tests in an adjacent tests folder and builds them
|
||||
# This version forces the use of libs, as necessary for wrap/tests
|
||||
macro(gtsam_add_external_tests subdir libs)
|
||||
add_custom_target(check.${subdir} COMMAND ${CMAKE_CTEST_COMMAND})
|
||||
file(GLOB tests_srcs "tests/test*.cpp")
|
||||
foreach(test_src ${tests_srcs})
|
||||
get_filename_component(test_base ${test_src} NAME_WE)
|
||||
set( test_bin ${subdir}.${test_base} )
|
||||
message(STATUS "Adding Test ${test_bin}")
|
||||
add_executable(${test_bin} ${test_src})
|
||||
add_dependencies(check.${subdir} ${test_bin})
|
||||
add_dependencies(check ${test_bin})
|
||||
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin} )
|
||||
add_dependencies(${test_bin} ${libs} CppUnitLite)
|
||||
target_link_libraries(${test_bin} ${libs} ${Boost_LIBRARIES} CppUnitLite)
|
||||
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
|
||||
endforeach(test_src)
|
||||
endmacro()
|
||||
|
||||
# Collects timing scripts and builds them
|
||||
macro(gtsam_add_timing subdir libs)
|
||||
add_custom_target(timing.${subdir})
|
||||
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 ${subdir}.${time_base} )
|
||||
message(STATUS "Adding Timing Benchmark ${time_bin}")
|
||||
add_executable(${time_bin} ${time_src})
|
||||
add_dependencies(timing.${subdir} ${time_bin})
|
||||
add_dependencies(timing ${time_bin})
|
||||
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
|
||||
add_dependencies(${time_bin} ${libs})
|
||||
target_link_libraries(${time_bin} ${libs} ${Boost_LIBRARIES} CppUnitLite)
|
||||
else()
|
||||
add_dependencies(${time_bin} gtsam-static)
|
||||
target_link_libraries(${time_bin} ${Boost_LIBRARIES} gtsam-static CppUnitLite)
|
||||
endif()
|
||||
add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
|
||||
endforeach(time_src)
|
||||
endmacro()
|
|
@ -15,10 +15,3 @@ foreach(eigen_dir ${eigen_dir_headers_all})
|
|||
install(FILES Eigen/Eigen/${filename} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/Eigen/Eigen)
|
||||
endif()
|
||||
endforeach(eigen_dir)
|
||||
|
||||
## build convenience library
|
||||
#set (3rdparty_srcs
|
||||
# CCOLAMD/Source/ccolamd.c
|
||||
# CCOLAMD/Source/ccolamd_global.c
|
||||
# UFconfig/UFconfig.c)
|
||||
#add_library(ccolamd STATIC ${3rdparty_srcs})
|
|
@ -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}")
|
||||
|
|
|
@ -4,40 +4,16 @@ install(FILES ${base_headers} DESTINATION include/gtsam/base)
|
|||
|
||||
# Components to link tests in this subfolder against
|
||||
set(base_local_libs
|
||||
CppUnitLite
|
||||
base
|
||||
)
|
||||
|
||||
# Build tests
|
||||
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)
|
||||
gtsam_add_tests(base "${base_local_libs}")
|
||||
endif(GTSAM_BUILD_TESTS)
|
||||
|
||||
# Build timing scripts
|
||||
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)
|
||||
gtsam_add_timing(base "${base_local_libs}")
|
||||
endif(GTSAM_BUILD_TIMING)
|
||||
|
||||
|
|
|
@ -1,47 +1,20 @@
|
|||
# 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
|
||||
CppUnitLite
|
||||
base
|
||||
geometry
|
||||
)
|
||||
|
||||
# Build tests
|
||||
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)
|
||||
gtsam_add_tests(geometry "${geometry_local_libs}")
|
||||
endif(GTSAM_BUILD_TESTS)
|
||||
|
||||
# Build timing scripts
|
||||
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)
|
||||
gtsam_add_timing(geometry "${geometry_local_libs}")
|
||||
endif(GTSAM_BUILD_TIMING)
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# 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)
|
||||
|
@ -11,39 +8,15 @@ set(inference_local_libs
|
|||
geometry
|
||||
base
|
||||
ccolamd
|
||||
CppUnitLite
|
||||
)
|
||||
|
||||
# Build tests
|
||||
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)
|
||||
if (GTSAM_BUILD_TESTS)
|
||||
gtsam_add_tests(inference "${inference_local_libs}")
|
||||
endif(GTSAM_BUILD_TESTS)
|
||||
|
||||
# Build timing scripts
|
||||
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)
|
||||
if (GTSAM_BUILD_TIMING)
|
||||
gtsam_add_timing(inference "${inference_local_libs}")
|
||||
endif(GTSAM_BUILD_TIMING)
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# link back to base
|
||||
add_dependencies(linear inference)
|
||||
|
||||
# Install headers
|
||||
file(GLOB linear_headers "*.h")
|
||||
install(FILES ${linear_headers} DESTINATION include/gtsam/linear)
|
||||
|
@ -12,38 +9,14 @@ set(linear_local_libs
|
|||
geometry
|
||||
base
|
||||
ccolamd
|
||||
CppUnitLite
|
||||
)
|
||||
|
||||
# Build tests
|
||||
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)
|
||||
gtsam_add_tests(linear "${linear_local_libs}")
|
||||
endif(GTSAM_BUILD_TESTS)
|
||||
|
||||
# Build timing scripts
|
||||
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)
|
||||
gtsam_add_timing(linear "${linear_local_libs}")
|
||||
endif(GTSAM_BUILD_TIMING)
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# link back to base
|
||||
add_dependencies(nonlinear linear)
|
||||
|
||||
# Install headers
|
||||
file(GLOB nonlinear_headers "*.h")
|
||||
install(FILES ${nonlinear_headers} DESTINATION include/gtsam/nonlinear)
|
||||
|
@ -13,39 +10,15 @@ set(nonlinear_local_libs
|
|||
geometry
|
||||
base
|
||||
ccolamd
|
||||
CppUnitLite
|
||||
)
|
||||
|
||||
# Build tests
|
||||
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)
|
||||
gtsam_add_tests(nonlinear "${nonlinear_local_libs}")
|
||||
endif(GTSAM_BUILD_TESTS)
|
||||
|
||||
# Build timing scripts
|
||||
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)
|
||||
gtsam_add_timing(nonlinear "${nonlinear_local_libs}")
|
||||
endif(GTSAM_BUILD_TIMING)
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# link back to base
|
||||
add_dependencies(slam nonlinear)
|
||||
|
||||
# Install headers
|
||||
file(GLOB slam_headers "*.h")
|
||||
install(FILES ${slam_headers} DESTINATION include/gtsam/slam)
|
||||
|
@ -14,38 +11,14 @@ set(slam_local_libs
|
|||
geometry
|
||||
base
|
||||
ccolamd
|
||||
CppUnitLite
|
||||
)
|
||||
|
||||
# Build tests
|
||||
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)
|
||||
gtsam_add_tests(slam "${slam_local_libs}")
|
||||
endif(GTSAM_BUILD_TESTS)
|
||||
|
||||
# Build timing scripts
|
||||
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)
|
||||
gtsam_add_timing(slam "${slam_local_libs}")
|
||||
endif(GTSAM_BUILD_TIMING)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
|
||||
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
|
||||
set(convenience_libs
|
||||
slam
|
||||
nonlinear
|
||||
|
@ -7,15 +7,22 @@ if (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
|
|||
geometry
|
||||
base
|
||||
ccolamd)
|
||||
else (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
|
||||
else (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
|
||||
set(convenience_libs
|
||||
gtsam-static)
|
||||
endif (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
|
||||
endif (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
|
||||
|
||||
# exclude certain files
|
||||
# note the source dir on each
|
||||
set (tests_exclude
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/testPose2SLAMwSPCG.cpp"
|
||||
)
|
||||
|
||||
# Build tests
|
||||
if (GTSAM_BUILD_TESTS)
|
||||
add_custom_target(check.tests COMMAND ${CMAKE_CTEST_COMMAND})
|
||||
file(GLOB tests_srcs "test*.cpp")
|
||||
#list(REMOVE_ITEM tests_srcs ${tests_exclude}) #NOTE: uncomment if there are tests to exclude
|
||||
foreach(test_src ${tests_srcs})
|
||||
get_filename_component(test_base ${test_src} NAME_WE)
|
||||
set( test_bin tests.${test_base} )
|
||||
|
@ -33,6 +40,7 @@ endif (GTSAM_BUILD_TESTS)
|
|||
if (GTSAM_BUILD_TIMING)
|
||||
add_custom_target(timing.tests)
|
||||
file(GLOB timing_srcs "time*.cpp")
|
||||
#list(REMOVE_ITEM timing_srcs ${tests_exclude}) #NOTE: uncomment if there are tests to exclude
|
||||
foreach(time_src ${timing_srcs})
|
||||
get_filename_component(time_base ${time_src} NAME_WE)
|
||||
set( time_bin tests.${time_base} )
|
||||
|
|
|
@ -16,30 +16,10 @@ endif(GTSAM_INSTALL_WRAP)
|
|||
# Install matlab header
|
||||
install(FILES matlab.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/wrap)
|
||||
|
||||
if (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
|
||||
set(convenience_libs
|
||||
base
|
||||
)
|
||||
else (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
|
||||
set(convenience_libs
|
||||
gtsam-static)
|
||||
endif (GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS)
|
||||
|
||||
# Build tests
|
||||
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 ${convenience_libs} wrap_lib)
|
||||
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
|
||||
endforeach(test_src)
|
||||
add_definitions(-DTOPSRCDIR="${CMAKE_SOURCE_DIR}")
|
||||
gtsam_add_external_tests(wrap wrap_lib)
|
||||
endif(GTSAM_BUILD_TESTS)
|
||||
|
||||
# Wrap codegen
|
||||
|
@ -63,7 +43,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 +59,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)
|
||||
|
|
Loading…
Reference in New Issue