2012-05-04 01:03:25 +08:00
|
|
|
# Build full gtsam_unstable library as a single library
|
|
|
|
# and also build tests
|
|
|
|
set (gtsam_unstable_subdirs
|
|
|
|
base
|
2012-05-15 08:47:19 +08:00
|
|
|
discrete
|
2012-05-04 01:03:25 +08:00
|
|
|
dynamics
|
2012-06-04 04:45:36 +08:00
|
|
|
linear
|
2012-05-04 01:03:25 +08:00
|
|
|
slam
|
|
|
|
)
|
|
|
|
|
2012-05-26 00:12:55 +08:00
|
|
|
add_custom_target(check.unstable COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
|
|
|
|
|
2012-05-04 01:03:25 +08:00
|
|
|
# assemble core libaries
|
|
|
|
foreach(subdir ${gtsam_unstable_subdirs})
|
|
|
|
# Build convenience libraries
|
|
|
|
file(GLOB subdir_srcs "${subdir}/*.cpp")
|
|
|
|
set(${subdir}_srcs ${subdir_srcs})
|
|
|
|
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
|
|
|
|
message(STATUS "Building Convenience Library: ${subdir}_unstable")
|
|
|
|
add_library("${subdir}_unstable" STATIC ${subdir_srcs})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Build local library and tests
|
|
|
|
message(STATUS "Building ${subdir}_unstable")
|
|
|
|
add_subdirectory(${subdir})
|
|
|
|
endforeach(subdir)
|
|
|
|
|
|
|
|
# assemble gtsam_unstable components
|
|
|
|
set(gtsam_unstable_srcs
|
|
|
|
${base_srcs}
|
|
|
|
${discrete_srcs}
|
|
|
|
${dynamics_srcs}
|
2012-06-04 04:45:36 +08:00
|
|
|
${linear_srcs}
|
2012-05-04 01:03:25 +08:00
|
|
|
${slam_srcs}
|
|
|
|
)
|
|
|
|
|
|
|
|
option (GTSAM_UNSTABLE_BUILD_SHARED_LIBRARY "Enable/Disable building of a shared version of gtsam_unstable" ON)
|
2012-05-04 01:03:27 +08:00
|
|
|
|
2012-05-04 01:03:25 +08:00
|
|
|
# Versions - same as core gtsam library
|
|
|
|
set(gtsam_unstable_version ${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH})
|
|
|
|
set(gtsam_unstable_soversion ${GTSAM_VERSION_MAJOR})
|
|
|
|
message(STATUS "GTSAM_UNSTABLE Version: ${gtsam_unstable_version}")
|
|
|
|
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
|
|
|
|
|
|
|
|
# build shared and static versions of the library
|
|
|
|
message(STATUS "Building GTSAM_UNSTABLE - static")
|
|
|
|
add_library(gtsam_unstable-static STATIC ${gtsam_unstable_srcs})
|
|
|
|
set_target_properties(gtsam_unstable-static PROPERTIES
|
|
|
|
OUTPUT_NAME gtsam_unstable
|
|
|
|
CLEAN_DIRECT_OUTPUT 1
|
|
|
|
VERSION ${gtsam_unstable_version}
|
|
|
|
SOVERSION ${gtsam_unstable_soversion})
|
2012-05-05 01:19:26 +08:00
|
|
|
target_link_libraries(gtsam_unstable-static gtsam-static)
|
2012-05-04 01:03:25 +08:00
|
|
|
install(TARGETS gtsam_unstable-static ARCHIVE DESTINATION lib)
|
|
|
|
|
|
|
|
if (GTSAM_UNSTABLE_BUILD_SHARED_LIBRARY)
|
|
|
|
message(STATUS "Building GTSAM_UNSTABLE - shared")
|
|
|
|
add_library(gtsam_unstable-shared SHARED ${gtsam_unstable_srcs})
|
|
|
|
set_target_properties(gtsam_unstable-shared PROPERTIES
|
|
|
|
OUTPUT_NAME gtsam_unstable
|
|
|
|
CLEAN_DIRECT_OUTPUT 1
|
|
|
|
VERSION ${gtsam_unstable_version}
|
|
|
|
SOVERSION ${gtsam_unstable_soversion})
|
2012-05-05 01:19:26 +08:00
|
|
|
target_link_libraries(gtsam_unstable-shared gtsam-shared)
|
2012-05-04 01:03:25 +08:00
|
|
|
install(TARGETS gtsam_unstable-shared LIBRARY DESTINATION lib )
|
|
|
|
endif(GTSAM_UNSTABLE_BUILD_SHARED_LIBRARY)
|
|
|
|
|
2012-05-04 22:44:21 +08:00
|
|
|
# Wrap version for gtsam_unstable
|
|
|
|
if (GTSAM_BUILD_WRAP)
|
|
|
|
# Set up codegen
|
|
|
|
include(GtsamMatlabWrap)
|
|
|
|
|
|
|
|
# Wrap codegen
|
2012-06-05 05:14:47 +08:00
|
|
|
#usage: wrap mexExecutable mexExtension interfacePath moduleName toolboxPath [mexFlags]
|
|
|
|
# mexExecutable : command to execute mex if on path, use 'mex'
|
2012-05-04 22:44:21 +08:00
|
|
|
# mexExtension : OS/CPU-dependent extension for MEX binaries
|
|
|
|
# interfacePath : *absolute* path to directory of module interface file
|
|
|
|
# moduleName : the name of the module, interface file must be called moduleName.h
|
|
|
|
# toolboxPath : the directory in which to generate the wrappers
|
|
|
|
# [mexFlags] : extra flags for the mex command
|
|
|
|
|
|
|
|
# TODO: generate these includes programmatically
|
2012-06-06 01:20:19 +08:00
|
|
|
# Choose include flags depending on build process
|
|
|
|
if (GTSAM_BUILD_MEX_BIN)
|
|
|
|
set(MEX_INCLUDE_ROOT ${GTSAM_SOURCE_ROOT_DIR})
|
|
|
|
set(MEX_LIB_ROOT ${CMAKE_BINARY_DIR})
|
|
|
|
else()
|
|
|
|
set(MEX_INCLUDE_ROOT ${CMAKE_INSTALL_PREFIX}/include)
|
|
|
|
set(MEX_LIB_ROOT ${CMAKE_INSTALL_PREFIX}/lib)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(mexFlags "-I${Boost_INCLUDE_DIR} -I${MEX_INCLUDE_ROOT} -I${MEX_INCLUDE_ROOT}/gtsam_unstable -I${MEX_INCLUDE_ROOT}/gtsam_unstable/dynamics -I${MEX_INCLUDE_ROOT}/gtsam_unstable/discrete -L${MEX_LIB_ROOT}/gtsam_unstable -L${MEX_LIB_ROOT}/gtsam -lgtsam -lgtsam_unstable")
|
|
|
|
if(MSVC OR CYGWIN OR WINGW)
|
|
|
|
set(mexFlags "${mexFlags} LINKFLAGS='$LINKFLAGS /LIBPATH:${Boost_LIBRARY_DIRS}'")
|
|
|
|
endif()
|
|
|
|
|
2012-05-04 22:44:21 +08:00
|
|
|
set(toolbox_path ${CMAKE_BINARY_DIR}/wrap/gtsam_unstable)
|
|
|
|
set(moduleName gtsam_unstable)
|
|
|
|
|
|
|
|
find_mexextension()
|
|
|
|
|
|
|
|
# Code generation command
|
|
|
|
add_custom_target(wrap_gtsam_unstable ALL COMMAND
|
2012-06-05 05:05:00 +08:00
|
|
|
${CMAKE_BINARY_DIR}/wrap/wrap
|
|
|
|
${MEX_COMMAND}
|
|
|
|
${GTSAM_MEX_BIN_EXTENSION}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${moduleName}
|
|
|
|
${toolbox_path}
|
|
|
|
"${mexFlags}"
|
2012-05-04 22:44:21 +08:00
|
|
|
DEPENDS wrap)
|
|
|
|
|
2012-05-28 04:05:42 +08:00
|
|
|
# Build command
|
2012-06-06 01:20:19 +08:00
|
|
|
if (GTSAM_BUILD_MEX_BIN)
|
2012-05-28 04:05:42 +08:00
|
|
|
# Actually compile the mex files when building the library
|
2012-06-06 01:20:19 +08:00
|
|
|
if (GTSAM_INSTALL_MEX_BIN)
|
2012-06-04 23:33:16 +08:00
|
|
|
add_custom_target(wrap_gtsam_unstable_build ALL
|
|
|
|
COMMAND make ${GTSAM_BUILD_MEX_BINARY_FLAGS}
|
|
|
|
WORKING_DIRECTORY ${toolbox_path}
|
|
|
|
DEPENDS wrap_gtsam_unstable)
|
|
|
|
else()
|
|
|
|
add_custom_target(wrap_gtsam_unstable_build
|
|
|
|
COMMAND make ${GTSAM_BUILD_MEX_BINARY_FLAGS}
|
|
|
|
WORKING_DIRECTORY ${toolbox_path}
|
|
|
|
DEPENDS wrap_gtsam_unstable)
|
|
|
|
endif()
|
2012-06-06 01:20:19 +08:00
|
|
|
endif ()
|
2012-05-28 04:05:42 +08:00
|
|
|
|
2012-05-04 22:44:21 +08:00
|
|
|
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
|
|
|
# Primary toolbox files
|
|
|
|
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 ${GTSAM_TOOLBOX_INSTALL_PATH})
|
|
|
|
endif (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
|
|
|
endif(GTSAM_BUILD_WRAP)
|