Moved installation of 3rdparty headers into separate cmake file, install some wrap components

release/4.3a0
Alex Cunningham 2011-12-14 02:24:25 +00:00
parent 5dd461c5b1
commit 3afc03cf04
5 changed files with 50 additions and 18 deletions

View File

@ -1690,6 +1690,14 @@
<useDefaultCommand>false</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="install" path="build_cmake" 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="tests/testDSFVector.run" path="build/gtsam/base" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j2</buildArguments>

View File

@ -11,6 +11,18 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
endif()
# guard against bad build-type strings
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)
if( NOT cmake_build_type_tolower STREQUAL "debug"
AND NOT cmake_build_type_tolower STREQUAL "release"
AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).")
endif()
# Turn off function inlining when debugging
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-inline -Wall")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -Wall")

15
gtsam/3rdparty/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,15 @@
# install CCOLAMD headers
install(FILES CCOLAMD/Include/ccolamd.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/CCOLAMD)
install(FILES UFconfig/UFconfig.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/UFconfig)
# install Eigen - only the headers
install(DIRECTORY Eigen/Eigen
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/Eigen
FILES_MATCHING PATTERN "*.h")
file(GLOB eigen_dir_headers_all "Eigen/Eigen/*")
foreach(eigen_dir ${eigen_dir_headers_all})
get_filename_component(filename ${eigen_dir} NAME)
if (NOT ((${filename} MATCHES "CMakeLists.txt") OR (${filename} MATCHES "src")))
install(FILES Eigen/Eigen/${filename} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/3rdparty/Eigen/Eigen)
endif()
endforeach(eigen_dir)

View File

@ -12,12 +12,12 @@ set (ccolamd_srcs
3rdparty/CCOLAMD/Source/ccolamd.c
3rdparty/CCOLAMD/Source/ccolamd_global.c
3rdparty/UFconfig/UFconfig.c)
# install headers from 3rdparty libraries
add_subdirectory(3rdparty)
# Accumulate gtsam_srcs
set(gtsam_srcs ${ccolamd_srcs})
# ccolamd convenience library
#add_library(ccolamd STATIC ${ccolamd_srcs})
#list(APPEND inner_libs ccolamd)
# Get all sources and headers from each
foreach(subdir ${gtsam_subdirs})
@ -25,23 +25,18 @@ foreach(subdir ${gtsam_subdirs})
file(GLOB sub_gtsam_srcs "${subdir}/*.cpp")
list(APPEND gtsam_srcs ${sub_gtsam_srcs})
# Make a convenience library
# add_library(${subdir} STATIC ${sub_gtsam_srcs})
# list(APPEND inner_libs ${subdir})
# install headers
file(GLOB sub_gtsam_headers "${subdir}/*.h")
install(FILES ${sub_gtsam_headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/gtsam/${subdir})
# Build tests
file(GLOB tests_srcs "${subdir}/tests/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 ${EXECUTABLE_OUTPUT_PATH}${subdir}/${test_base} )
set( test_bin ${subdir}_${test_base} )
add_executable(${test_bin} EXCLUDE_FROM_ALL ${test_src})
add_dependencies(check ${test_bin})
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)
@ -60,4 +55,5 @@ endforeach(subdir)
# build a single shared library
add_library(gtsam SHARED ${gtsam_srcs})
install(TARGETS gtsam LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

View File

@ -1,14 +1,15 @@
# Build/install Wrap
# Build the executable itself
FILE(GLOB wrap_srcs "*.cpp")
LIST(REMOVE_ITEM wrap_srcs wrap.cpp)
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)
install(TARGETS wrap DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
# Build tests
FILE(GLOB wrap_test_srcs "tests/test*.cpp")
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)
@ -20,5 +21,5 @@ foreach(test_src ${wrap_test_srcs} )
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src)
# Install matlab header
install(FILES matlab.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/wrap)