Added a variety of options to the cmake build, working on automating wrap execution/install

release/4.3a0
Alex Cunningham 2012-01-31 19:59:15 +00:00
parent b92e4a08dc
commit c43a9b4852
13 changed files with 432 additions and 361 deletions

215
.cproject
View File

@ -258,14 +258,6 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="testGaussianFactor.run" path="linear/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>testGaussianFactor.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
@ -292,6 +284,7 @@
</target>
<target name="tests/testBayesTree.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>tests/testBayesTree.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -299,6 +292,7 @@
</target>
<target name="testBinaryBayesNet.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testBinaryBayesNet.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -346,6 +340,7 @@
</target>
<target name="testSymbolicBayesNet.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testSymbolicBayesNet.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -353,6 +348,7 @@
</target>
<target name="tests/testSymbolicFactor.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>tests/testSymbolicFactor.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -360,6 +356,7 @@
</target>
<target name="testSymbolicFactorGraph.run" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testSymbolicFactorGraph.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -375,11 +372,20 @@
</target>
<target name="tests/testBayesTree" path="inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>tests/testBayesTree</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="testGaussianFactor.run" path="linear/tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>testGaussianFactor.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
@ -406,7 +412,6 @@
</target>
<target name="testGraph.run" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testGraph.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -478,7 +483,6 @@
</target>
<target name="testInference.run" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testInference.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -486,7 +490,6 @@
</target>
<target name="testGaussianFactor.run" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testGaussianFactor.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -494,7 +497,6 @@
</target>
<target name="testJunctionTree.run" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testJunctionTree.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -502,7 +504,6 @@
</target>
<target name="testSymbolicBayesNet.run" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testSymbolicBayesNet.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -510,7 +511,6 @@
</target>
<target name="testSymbolicFactorGraph.run" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testSymbolicFactorGraph.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -580,22 +580,6 @@
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="CppUnitLite" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="CppUnitLite" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="tests/testPose2.run" path="build_retract/gtsam/geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
@ -612,6 +596,22 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="CppUnitLite" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="CppUnitLite" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="spqr_mini" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
@ -636,7 +636,15 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="build/gtsam/nonlinear" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<target name="all" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>check</buildTarget>
@ -644,6 +652,14 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="tests/testGeneralSFMFactor.run" path="build/gtsam/slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
@ -684,15 +700,7 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<target name="check" path="build/gtsam/nonlinear" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>check</buildTarget>
@ -700,14 +708,6 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="build_wrap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="build/geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
@ -1038,6 +1038,7 @@
</target>
<target name="testErrors.run" path="linear" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testErrors.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -1493,7 +1494,6 @@
</target>
<target name="testSimulated2DOriented.run" path="slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testSimulated2DOriented.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -1533,7 +1533,6 @@
</target>
<target name="testSimulated2D.run" path="slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testSimulated2D.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -1541,7 +1540,6 @@
</target>
<target name="testSimulated3D.run" path="slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testSimulated3D.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -1898,14 +1896,6 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="wrapmac_gtsam" path="build_cmake" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>wrapmac_gtsam</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="tests/testDSFVector.run" path="build/gtsam/base" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
@ -2156,7 +2146,6 @@
</target>
<target name="tests/testGaussianISAM2" path="build/slam" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>tests/testGaussianISAM2</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -2178,6 +2167,46 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>install</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>check</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="dist" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>dist</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="testRot3.run" path="geometry" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
@ -2274,23 +2303,7 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>install</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<target name="check" path="build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>check</buildTarget>
@ -2298,18 +2311,26 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<target name="clean" path="build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>all</buildTarget>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="dist" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<target name="install" path="build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>dist</buildTarget>
<buildTarget>install</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
@ -2362,38 +2383,6 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>check</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="install" path="build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>install</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="all" path="build" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cproject>

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)