Library now builds and all tests run with cmake

release/4.3a0
Alex Cunningham 2011-12-14 02:24:21 +00:00
parent 099ab88b5d
commit 61d05813ff
7 changed files with 146 additions and 12 deletions

View File

@ -1648,6 +1648,30 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="test" path="build_cmake" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>test</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="testSimulated2D.run" path="build_cmake" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>testSimulated2D.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="wrap_testWrap.run" path="build_cmake" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>
<buildTarget>wrap_testWrap.run</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>

View File

@ -26,8 +26,17 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DEIGEN_NO_DEBUG")
ENABLE_TESTING()
INCLUDE(Dart)
# Find boost
find_package(Boost 1.40 REQUIRED)
# General build settings
include_directories(gtsam CppUnitLite)
include_directories(
gtsam/3rdparty/UFconfig
gtsam/3rdparty/CCOLAMD/Include
${CMAKE_SOURCE_DIR}
CppUnitLite
${BOOST_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
# Build GTSAM library
add_subdirectory(gtsam)
@ -36,10 +45,10 @@ add_subdirectory(gtsam)
add_subdirectory(CppUnitLite)
# Build Tests
#add_subdirectory(tests)
add_subdirectory(tests)
# Build wrap
#add_subdirectory(wrap)
add_subdirectory(wrap)
# Build examples
#add_subdirectory(examples)
add_subdirectory(examples)

14
examples/CMakeLists.txt Normal file
View File

@ -0,0 +1,14 @@
# Build example executables
FILE(GLOB example_srcs "*.cpp")
foreach(example_src ${example_srcs} )
get_filename_component(example_base ${example_src} NAME_WE)
set( example_bin ${example_base} )
add_executable(${example_bin} ${example_src})
target_link_libraries(${example_bin} gtsam)
endforeach(example_src)
add_subdirectory(vSLAMexample)

View File

@ -0,0 +1,17 @@
# Build vSLAMexample
set ( srcs
Feature2D.cpp
vSLAMutils.cpp
)
add_library(vSLAMexample ${srcs})
add_executable(vISAMexample vISAMexample.cpp)
target_link_libraries(vISAMexample vSLAMexample gtsam)
add_executable(vSFMexample vSFMexample.cpp)
target_link_libraries(vSFMexample vSLAMexample gtsam)

View File

@ -9,10 +9,10 @@ set (gtsam_subdirs
slam)
# Include CCOLAMD source directly into gtsam
include_directories(
3rdparty/UFconfig
3rdparty/CCOLAMD/Include
${CMAKE_SOURCE_DIR})
#include_directories(
# 3rdparty/UFconfig
# 3rdparty/CCOLAMD/Include
# ${CMAKE_SOURCE_DIR})
set (ccolamd_srcs
3rdparty/CCOLAMD/Source/ccolamd.c
@ -22,6 +22,7 @@ set (ccolamd_srcs
set(gtsam_srcs ${ccolamd_srcs})
add_library(ccolamd STATIC ${ccolamd_srcs})
list(APPEND inner_libs ccolamd)
# Get all sources and headers from each
foreach(subdir ${gtsam_subdirs})
@ -37,12 +38,27 @@ foreach(subdir ${gtsam_subdirs})
file(GLOB tests_srcs "${subdir}/tests/test*.cpp")
foreach(test_src ${tests_srcs})
get_filename_component(test_base ${test_src} NAME_WE)
set( test_bin ${EXECUTABLE_OUTPUT_PATH}/${subdir}/${test_base} )
# Trying to put the executables in the right place
#set( test_bin ${EXECUTABLE_OUTPUT_PATH}${subdir}/${test_base} )
set( test_bin ${subdir}_${test_base} )
add_executable(${test_bin} ${test_src})
#add_test(${subdir}/${test_base} ${subdir}/${test_base})
#target_link_libraries(${subdir}/${test_base} ${inner_libs} CppUnitLite ccolamd)
#add_custom_target(${test_base}.run ${EXECUTABLE_OUTPUT_PATH}/${test_base} ${ARGN})
add_test(${subdir}/${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
#Linking: would like to link against subset of convenience libraries
#target_link_libraries(${test_bin} CppUnitLite ${inner_libs})
target_link_libraries(${test_bin} CppUnitLite gtsam)
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src)
# Build timing scripts
file(GLOB time_srcs "${subdir}/tests/time*.cpp")
foreach(time_src ${time_srcs})
get_filename_component(time_base ${time_src} NAME_WE)
set( time_bin ${time_base} )
add_executable(${time_bin} ${time_src})
target_link_libraries(${time_bin} CppUnitLite gtsam)
add_custom_target(${time_base}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src)
endforeach(subdir)
# build a single shared library

31
tests/CMakeLists.txt Normal file
View File

@ -0,0 +1,31 @@
include_directories(
3rdparty/UFconfig
3rdparty/CCOLAMD/Include
${CMAKE_SOURCE_DIR})
find_package(Boost COMPONENTS serialization REQUIRED)
# Build tests
file(GLOB tests_srcs "test*.cpp")
foreach(test_src ${tests_srcs})
get_filename_component(test_base ${test_src} NAME_WE)
# Trying to put the executables in the right place
set( test_bin ${test_base} )
add_executable(${test_bin} ${test_src})
add_test(${test_bin} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
target_link_libraries(${test_bin} CppUnitLite gtsam ${Boost_SERIALIZATION_LIBRARY})
add_custom_target(${test_base}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src)
# Build timing scripts
file(GLOB time_srcs "time*.cpp")
foreach(time_src ${time_srcs})
get_filename_component(time_base ${time_src} NAME_WE)
# Trying to put the executables in the right place
set( time_bin ${time_base} )
add_executable(${time_bin} ${time_src})
target_link_libraries(${time_bin} CppUnitLite gtsam)
add_custom_target(${time_base}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src)

23
wrap/CMakeLists.txt Normal file
View File

@ -0,0 +1,23 @@
# Build/install Wrap
# Build the executable itself
FILE(GLOB wrap_srcs "*.cpp")
LIST(REMOVE_ITEM wrap_srcs wrap.cpp)
add_library(wrapLib STATIC ${wrap_srcs})
add_executable(wrap wrap.cpp)
target_link_libraries(wrap wrapLib)
# 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} ${test_src})
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
target_link_libraries(${test_bin} CppUnitLite gtsam wrapLib)
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src)