Adding faster compilation options for distribution in CMake

release/4.3a0
Alex Cunningham 2012-02-14 18:03:29 +00:00
parent 9856a7c7aa
commit 0409c1c7ee
11 changed files with 173 additions and 100 deletions

View File

@ -21,7 +21,7 @@
<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.1359703544.2031210194" name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.1359703544.2031210194" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.677243255" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base"> <toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.677243255" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.macosx.base.752782918" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.macosx.base.752782918" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
<builder arguments="-j2" buildPath="${ProjDirPath}/build" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.319933862" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="5" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/> <builder arguments="" buildPath="${ProjDirPath}/build" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.319933862" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="5" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
<tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.457360678" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base"/> <tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.457360678" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base"/>
<tool id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base.1011140787" name="MacOS X C++ Linker" superClass="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base"> <tool id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base.1011140787" name="MacOS X C++ Linker" superClass="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base">
<inputType id="cdt.managedbuild.tool.macosx.cpp.linker.input.1032375444" superClass="cdt.managedbuild.tool.macosx.cpp.linker.input"> <inputType id="cdt.managedbuild.tool.macosx.cpp.linker.input.1032375444" superClass="cdt.managedbuild.tool.macosx.cpp.linker.input">

View File

@ -23,7 +23,7 @@
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key> <key>org.eclipse.cdt.make.core.buildArguments</key>
<value>-j2 -j5</value> <value>-j5</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key> <key>org.eclipse.cdt.make.core.buildCommand</key>

View File

@ -39,6 +39,7 @@ option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" 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_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_BUILD_WRAP "Enable/Disable building of matlab wrap utility (necessary for matlab interface)" ON)
option(GTSAM_BUILD_CONVENIENCE_LIBRARIES "Enable/Disable using convenience librares for tests" ON)
option(GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS option(GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS
"Enable/Disable linking tests against the convenince libraries for faster debugging" ON) "Enable/Disable linking tests against the convenince libraries for faster debugging" ON)
@ -46,10 +47,12 @@ option(GTSAM_LINK_BINARIES_AGAINST_CONVENIENCE_LIBS
# FIXME: breaks generation and install of matlab toolbox # FIXME: breaks generation and install of matlab toolbox
#set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE) #set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
# Pull in tests # Pull in infrastructure
enable_testing() if (GTSAM_BUILD_TESTS)
include(Dart) enable_testing()
include(CTest) include(Dart)
include(CTest)
endif()
# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck) # Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})

View File

@ -20,14 +20,20 @@ set (3rdparty_srcs
3rdparty/CCOLAMD/Source/ccolamd.c 3rdparty/CCOLAMD/Source/ccolamd.c
3rdparty/CCOLAMD/Source/ccolamd_global.c 3rdparty/CCOLAMD/Source/ccolamd_global.c
3rdparty/UFconfig/UFconfig.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 # assemble core libaries
foreach(subdir ${gtsam_subdirs}) foreach(subdir ${gtsam_subdirs})
# Build convenience libraries # Build convenience libraries
file(GLOB subdir_srcs "${subdir}/*.cpp") file(GLOB subdir_srcs "${subdir}/*.cpp")
add_library(${subdir} STATIC ${subdir_srcs})
set(${subdir}_srcs ${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 # Build local library and tests
message(STATUS "Building ${subdir}") message(STATUS "Building ${subdir}")

View File

@ -3,11 +3,15 @@ file(GLOB base_headers "*.h")
install(FILES ${base_headers} DESTINATION include/gtsam/base) install(FILES ${base_headers} DESTINATION include/gtsam/base)
# Components to link tests in this subfolder against # Components to link tests in this subfolder against
set(base_local_libs if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
CppUnitLite set(base_local_libs
${Boost_LIBRARIES} CppUnitLite
base base)
) else()
set(base_local_libs
CppUnitLite
gtsam-static)
endif()
# Build tests # Build tests
if (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TESTS)
@ -20,8 +24,11 @@ if (GTSAM_BUILD_TESTS)
add_executable(${test_bin} ${test_src}) add_executable(${test_bin} ${test_src})
add_dependencies(check.base ${test_bin}) add_dependencies(check.base ${test_bin})
add_dependencies(check ${test_bin}) add_dependencies(check ${test_bin})
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
target_link_libraries(${test_bin} ${base_local_libs}) add_dependencies(${test_bin} ${base_local_libs})
endif()
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin} )
target_link_libraries(${test_bin} ${base_local_libs} ${Boost_LIBRARIES})
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src) endforeach(test_src)
endif(GTSAM_BUILD_TESTS) endif(GTSAM_BUILD_TESTS)
@ -37,7 +44,10 @@ if (GTSAM_BUILD_TIMING)
add_executable(${time_bin} ${time_src}) add_executable(${time_bin} ${time_src})
add_dependencies(timing.base ${time_bin}) add_dependencies(timing.base ${time_bin})
add_dependencies(timing ${time_bin}) add_dependencies(timing ${time_bin})
target_link_libraries(${time_bin} ${base_local_libs}) if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${time_bin} ${base_local_libs})
endif()
target_link_libraries(${time_bin} ${base_local_libs} ${Boost_LIBRARIES})
add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src) endforeach(time_src)
endif(GTSAM_BUILD_TIMING) endif(GTSAM_BUILD_TIMING)

View File

@ -1,17 +1,23 @@
# link back to base
add_dependencies(geometry base)
# Install headers # Install headers
file(GLOB geometry_headers "*.h") file(GLOB geometry_headers "*.h")
install(FILES ${geometry_headers} DESTINATION include/gtsam/geometry) install(FILES ${geometry_headers} DESTINATION include/gtsam/geometry)
# Components to link tests in this subfolder against # Components to link tests in this subfolder against
set(geometry_local_libs if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
geometry set(geometry_local_libs
base geometry
${Boost_LIBRARIES} base
CppUnitLite CppUnitLite
) )
# link back to base
add_dependencies(geometry base)
else()
set(geometry_local_libs
CppUnitLite
gtsam-static
)
endif()
# Build tests # Build tests
if (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TESTS)
@ -24,8 +30,11 @@ if (GTSAM_BUILD_TESTS)
add_executable(${test_bin} ${test_src}) add_executable(${test_bin} ${test_src})
add_dependencies(check.geometry ${test_bin}) add_dependencies(check.geometry ${test_bin})
add_dependencies(check ${test_bin}) add_dependencies(check ${test_bin})
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${test_bin} gtsam-static)
endif()
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
target_link_libraries(${test_bin} ${geometry_local_libs}) target_link_libraries(${test_bin} ${geometry_local_libs} ${Boost_LIBRARIES})
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src) endforeach(test_src)
endif(GTSAM_BUILD_TESTS) endif(GTSAM_BUILD_TESTS)
@ -41,7 +50,10 @@ if (GTSAM_BUILD_TIMING)
add_executable(${time_bin} ${time_src}) add_executable(${time_bin} ${time_src})
add_dependencies(timing.geometry ${time_bin}) add_dependencies(timing.geometry ${time_bin})
add_dependencies(timing ${time_bin}) add_dependencies(timing ${time_bin})
target_link_libraries(${time_bin} ${geometry_local_libs}) if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${time_bin} gtsam-static)
endif()
target_link_libraries(${time_bin} ${geometry_local_libs} ${Boost_LIBRARIES})
add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src) endforeach(time_src)
endif(GTSAM_BUILD_TIMING) endif(GTSAM_BUILD_TIMING)

View File

@ -1,19 +1,23 @@
# link back to previous convenience library
add_dependencies(inference base)
# Install headers # Install headers
file(GLOB inference_headers "*.h") file(GLOB inference_headers "*.h")
install(FILES ${inference_headers} DESTINATION include/gtsam/inference) install(FILES ${inference_headers} DESTINATION include/gtsam/inference)
# Components to link tests in this subfolder against # Components to link tests in this subfolder against
set(inference_local_libs if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
inference set(inference_local_libs
geometry inference
base geometry
ccolamd base
CppUnitLite ccolamd
${Boost_LIBRARIES} CppUnitLite)
) # link back to previous convenience library
add_dependencies(inference base)
else()
set(inference_local_libs
CppUnitLite
gtsam-static
)
endif()
# Build tests # Build tests
if(GTSAM_BUILD_TESTS) if(GTSAM_BUILD_TESTS)
@ -26,8 +30,11 @@ if(GTSAM_BUILD_TESTS)
add_executable(${test_bin} ${test_src}) add_executable(${test_bin} ${test_src})
add_dependencies(check.inference ${test_bin}) add_dependencies(check.inference ${test_bin})
add_dependencies(check ${test_bin}) add_dependencies(check ${test_bin})
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${test_bin} ${inference_local_libs})
endif()
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
target_link_libraries(${test_bin} ${inference_local_libs}) target_link_libraries(${test_bin} ${inference_local_libs} ${Boost_LIBRARIES})
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src) endforeach(test_src)
endif(GTSAM_BUILD_TESTS) endif(GTSAM_BUILD_TESTS)
@ -43,7 +50,10 @@ if(GTSAM_BUILD_TIMING)
add_executable(${time_bin} ${time_src}) add_executable(${time_bin} ${time_src})
add_dependencies(timing.inference ${time_bin}) add_dependencies(timing.inference ${time_bin})
add_dependencies(timing ${time_bin}) add_dependencies(timing ${time_bin})
target_link_libraries(${time_bin} ${inference_local_libs}) if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${time_bin} ${inference_local_libs})
endif()
target_link_libraries(${time_bin} ${inference_local_libs} ${Boost_LIBRARIES})
add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src) endforeach(time_src)
endif(GTSAM_BUILD_TIMING) endif(GTSAM_BUILD_TIMING)

View File

@ -1,20 +1,25 @@
# link back to base
add_dependencies(linear inference)
# Install headers # Install headers
file(GLOB linear_headers "*.h") file(GLOB linear_headers "*.h")
install(FILES ${linear_headers} DESTINATION include/gtsam/linear) install(FILES ${linear_headers} DESTINATION include/gtsam/linear)
# Components to link tests in this subfolder against # Components to link tests in this subfolder against
set(linear_local_libs if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
linear set(linear_local_libs
inference linear
geometry inference
base geometry
ccolamd base
CppUnitLite ccolamd
${Boost_LIBRARIES} CppUnitLite)
) # link back to base
add_dependencies(linear inference)
else()
set(linear_local_libs
CppUnitLite
gtsam-static
)
endif()
# Build tests # Build tests
if (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TESTS)
@ -27,8 +32,11 @@ if (GTSAM_BUILD_TESTS)
add_executable(${test_bin} ${test_src}) add_executable(${test_bin} ${test_src})
add_dependencies(check.linear ${test_bin}) add_dependencies(check.linear ${test_bin})
add_dependencies(check ${test_bin}) add_dependencies(check ${test_bin})
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${test_bin} ${linear_local_libs})
endif()
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
target_link_libraries(${test_bin} ${linear_local_libs}) target_link_libraries(${test_bin} ${linear_local_libs} ${Boost_LIBRARIES})
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src) endforeach(test_src)
endif (GTSAM_BUILD_TESTS) endif (GTSAM_BUILD_TESTS)
@ -44,7 +52,10 @@ if (GTSAM_BUILD_TIMING)
add_executable(${time_bin} ${time_src}) add_executable(${time_bin} ${time_src})
add_dependencies(timing.linear ${time_bin}) add_dependencies(timing.linear ${time_bin})
add_dependencies(timing ${time_bin}) add_dependencies(timing ${time_bin})
target_link_libraries(${time_bin} ${linear_local_libs}) if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${time_bin} ${linear_local_libs})
endif()
target_link_libraries(${time_bin} ${linear_local_libs} ${Boost_LIBRARIES})
add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src) endforeach(time_src)
endif (GTSAM_BUILD_TIMING) endif (GTSAM_BUILD_TIMING)

View File

@ -1,21 +1,25 @@
# link back to base
add_dependencies(nonlinear linear)
# Install headers # Install headers
file(GLOB nonlinear_headers "*.h") file(GLOB nonlinear_headers "*.h")
install(FILES ${nonlinear_headers} DESTINATION include/gtsam/nonlinear) install(FILES ${nonlinear_headers} DESTINATION include/gtsam/nonlinear)
# Components to link tests in this subfolder against # Components to link tests in this subfolder against
set(nonlinear_local_libs if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
nonlinear set(nonlinear_local_libs
linear nonlinear
inference linear
geometry inference
base geometry
ccolamd base
CppUnitLite ccolamd
${Boost_LIBRARIES} CppUnitLite)
) # link back to base
add_dependencies(nonlinear linear)
else()
set(nonlinear_local_libs
CppUnitLite
gtsam-static
)
endif()
# Build tests # Build tests
if (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TESTS)
@ -28,8 +32,11 @@ if (GTSAM_BUILD_TESTS)
add_executable(${test_bin} ${test_src}) add_executable(${test_bin} ${test_src})
add_dependencies(check.nonlinear ${test_bin}) add_dependencies(check.nonlinear ${test_bin})
add_dependencies(check ${test_bin}) add_dependencies(check ${test_bin})
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${test_bin} ${nonlinear_local_libs} )
endif()
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
target_link_libraries(${test_bin} ${nonlinear_local_libs}) target_link_libraries(${test_bin} ${nonlinear_local_libs} ${Boost_LIBRARIES})
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src) endforeach(test_src)
endif (GTSAM_BUILD_TESTS) endif (GTSAM_BUILD_TESTS)
@ -45,7 +52,10 @@ if (GTSAM_BUILD_TIMING)
add_executable(${time_bin} ${time_src}) add_executable(${time_bin} ${time_src})
add_dependencies(timing.nonlinear ${time_bin}) add_dependencies(timing.nonlinear ${time_bin})
add_dependencies(timing ${time_bin}) add_dependencies(timing ${time_bin})
target_link_libraries(${time_bin} ${nonlinear_local_libs}) if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${time_bin} ${nonlinear_local_libs} )
endif()
target_link_libraries(${time_bin} ${nonlinear_local_libs} ${Boost_LIBRARIES})
add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src) endforeach(time_src)
endif (GTSAM_BUILD_TIMING) endif (GTSAM_BUILD_TIMING)

View File

@ -1,22 +1,27 @@
# link back to base
add_dependencies(slam nonlinear)
# Install headers # Install headers
file(GLOB slam_headers "*.h") file(GLOB slam_headers "*.h")
install(FILES ${slam_headers} DESTINATION include/gtsam/slam) install(FILES ${slam_headers} DESTINATION include/gtsam/slam)
# Components to link tests in this subfolder against # Components to link tests in this subfolder against
set(slam_local_libs if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
slam set(slam_local_libs
nonlinear slam
linear nonlinear
inference linear
geometry inference
base geometry
ccolamd base
CppUnitLite ccolamd
${Boost_LIBRARIES} CppUnitLite)
)
# link back to base
add_dependencies(slam nonlinear geometry)
else()
set(slam_local_libs
CppUnitLite
gtsam-static
)
endif()
# Build tests # Build tests
if (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TESTS)
@ -30,7 +35,10 @@ if (GTSAM_BUILD_TESTS)
add_dependencies(check.slam ${test_bin}) add_dependencies(check.slam ${test_bin})
add_dependencies(check ${test_bin}) add_dependencies(check ${test_bin})
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin}) add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
target_link_libraries(${test_bin} ${slam_local_libs}) target_link_libraries(${test_bin} ${slam_local_libs} ${Boost_LIBRARIES})
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${test_bin} ${slam_local_libs})
endif()
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN}) add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src) endforeach(test_src)
endif (GTSAM_BUILD_TESTS) endif (GTSAM_BUILD_TESTS)
@ -46,7 +54,10 @@ if (GTSAM_BUILD_TIMING)
add_executable(${time_bin} ${time_src}) add_executable(${time_bin} ${time_src})
add_dependencies(timing.slam ${time_bin}) add_dependencies(timing.slam ${time_bin})
add_dependencies(timing ${time_bin}) add_dependencies(timing ${time_bin})
target_link_libraries(${time_bin} ${slam_local_libs}) if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
add_dependencies(${time_bin} ${slam_local_libs})
endif()
target_link_libraries(${time_bin} ${slam_local_libs} ${Boost_LIBRARIES})
add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN}) add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src) endforeach(time_src)
endif (GTSAM_BUILD_TIMING) endif (GTSAM_BUILD_TIMING)

View File

@ -63,7 +63,7 @@ set(moduleName gtsam)
# only support 64-bit apple # only support 64-bit apple
if(CMAKE_HOST_APPLE) if(CMAKE_HOST_APPLE)
set(mex_bin_extension_default mexmaci64) set(GTSAM_MEX_BIN_EXTENSION_default mexmaci64)
endif(CMAKE_HOST_APPLE) endif(CMAKE_HOST_APPLE)
if(NOT CMAKE_HOST_APPLE) if(NOT CMAKE_HOST_APPLE)
@ -79,56 +79,56 @@ if(NOT CMAKE_HOST_APPLE)
# Check for linux machines # Check for linux machines
if (CMAKE_HOST_UNIX) if (CMAKE_HOST_UNIX)
if (HAVE_64_BIT) if (HAVE_64_BIT)
set(mex_bin_extension_default mexa64) set(GTSAM_MEX_BIN_EXTENSION_default mexa64)
else (HAVE_64_BIT) else (HAVE_64_BIT)
set(mex_bin_extension_default mexglx) set(GTSAM_MEX_BIN_EXTENSION_default mexglx)
endif (HAVE_64_BIT) endif (HAVE_64_BIT)
endif(CMAKE_HOST_UNIX) endif(CMAKE_HOST_UNIX)
# Check for windows machines # Check for windows machines
if (CMAKE_HOST_WIN32) if (CMAKE_HOST_WIN32)
if (HAVE_64_BIT) if (HAVE_64_BIT)
set(mex_bin_extension_default mexw64) set(GTSAM_MEX_BIN_EXTENSION_default mexw64)
else (HAVE_64_BIT) else (HAVE_64_BIT)
set(mex_bin_extension_default mexw32) set(GTSAM_MEX_BIN_EXTENSION_default mexw32)
endif (HAVE_64_BIT) endif (HAVE_64_BIT)
endif(CMAKE_HOST_WIN32) endif(CMAKE_HOST_WIN32)
endif(NOT CMAKE_HOST_APPLE) endif(NOT CMAKE_HOST_APPLE)
# Allow for setting mex extension manually # Allow for setting mex extension manually
set(mex_bin_extension ${mex_bin_extension_default} CACHE DOCSTRING "Extension for matlab mex files") set(GTSAM_MEX_BIN_EXTENSION ${GTSAM_MEX_BIN_EXTENSION_default} CACHE DOCSTRING "Extension for matlab mex files")
message(STATUS "Detected Matlab mex extension: ${mex_bin_extension_default}") message(STATUS "Detected Matlab mex extension: ${GTSAM_MEX_BIN_EXTENSION_default}")
message(STATUS "Current Matlab mex extension: ${mex_bin_extension}") message(STATUS "Current Matlab mex extension: ${GTSAM_MEX_BIN_EXTENSION}")
# Actual build commands - separated by OS # Actual build commands - separated by OS
add_custom_target(wrap_gtsam ALL COMMAND 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) DEPENDS wrap)
option(GTSAM_INSTALL_MATLAB_TOOLBOX "Enable/Disable installation of matlab toolbox" ON) 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_EXAMPLES "Enable/Disable installation of matlab examples" ON)
option(GTSAM_INSTALL_MATLAB_TESTS "Enable/Disable installation of matlab tests" 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) if (GTSAM_INSTALL_MATLAB_TOOLBOX)
# Primary toolbox files # Primary toolbox files
message(STATUS "Installing Matlab Toolbox to ${toolbox_install_path}") message(STATUS "Installing Matlab Toolbox to ${GTSAM_TOOLBOX_INSTALL_PATH}")
install(DIRECTORY DESTINATION ${toolbox_install_path}) # make an empty folder 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 # 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 # Examples
if (GTSAM_INSTALL_MATLAB_EXAMPLES) if (GTSAM_INSTALL_MATLAB_EXAMPLES)
message(STATUS "Installing Matlab Toolbox Examples") message(STATUS "Installing Matlab Toolbox Examples")
file(GLOB matlab_examples "${CMAKE_SOURCE_DIR}/examples/matlab/*.m") 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) endif (GTSAM_INSTALL_MATLAB_EXAMPLES)
# Tests # Tests
if (GTSAM_INSTALL_MATLAB_TESTS) if (GTSAM_INSTALL_MATLAB_TESTS)
message(STATUS "Installing Matlab Toolbox Tests") message(STATUS "Installing Matlab Toolbox Tests")
file(GLOB matlab_tests "${CMAKE_SOURCE_DIR}/tests/matlab/*.m") 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_TESTS)
endif (GTSAM_INSTALL_MATLAB_TOOLBOX) endif (GTSAM_INSTALL_MATLAB_TOOLBOX)