test_sbpl and test_adjacency_list were always built, also in the standalone pnkx_nav_core build that is deployed to the robot. Enable them with -DBUILD_ROBOT_SBPL_TESTS=ON.
106 lines
4.2 KiB
CMake
106 lines
4.2 KiB
CMake
cmake_minimum_required(VERSION 2.8)
|
|
# Package robot_sbpl: the vendored SBPL with the abort flag (cancel/pause cut a running search).
|
|
# Named like the other robot_* packages so it cannot collide with ros-noetic-sbpl (apt, 2020): that
|
|
# package installs libsbpl.so without the abort flag in /opt/ros/noetic/lib, and a ROS environment
|
|
# puts that directory on LD_LIBRARY_PATH, which the loader searches before any RUNPATH. With the
|
|
# same file name the apt build silently replaced this one at runtime. Headers keep the sbpl/ prefix.
|
|
PROJECT( robot_sbpl )
|
|
|
|
# version (e.g. for packaging)
|
|
set(SBPL_MAJOR_VERSION 1)
|
|
set(SBPL_MINOR_VERSION 3)
|
|
set(SBPL_PATCH_VERSION 1)
|
|
set(SBPL_VERSION ${SBPL_MAJOR_VERSION}.${SBPL_MINOR_VERSION}.${SBPL_PATCH_VERSION})
|
|
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
|
|
include_directories(src/include)
|
|
|
|
add_library(robot_sbpl SHARED
|
|
src/discrete_space_information/environment_nav2D.cpp
|
|
src/discrete_space_information/environment_navxythetalat.cpp
|
|
src/discrete_space_information/environment_navxythetamlevlat.cpp
|
|
src/discrete_space_information/environment_nav2Duu.cpp
|
|
src/discrete_space_information/environment_XXX.cpp
|
|
src/discrete_space_information/environment_robarm.cpp
|
|
src/heuristics/embedded_heuristic.cpp
|
|
src/planners/adplanner.cpp
|
|
src/planners/ANAplanner.cpp
|
|
src/planners/araplanner.cpp
|
|
src/planners/lazyARA.cpp
|
|
src/planners/mhaplanner.cpp
|
|
src/planners/ppcpplanner.cpp
|
|
src/planners/rstarplanner.cpp
|
|
src/planners/viplanner.cpp
|
|
src/utils/heap.cpp
|
|
src/utils/mdp.cpp
|
|
src/utils/utils.cpp
|
|
src/utils/2Dgridsearch.cpp
|
|
src/utils/config.cpp
|
|
)
|
|
|
|
# Consumers that link the target (an in-tree build) get the headers that match the library.
|
|
target_include_directories(robot_sbpl PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/include>
|
|
$<INSTALL_INTERFACE:include>)
|
|
|
|
set(SBPL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
|
|
set(SBPL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
|
|
|
# support for pkg-config
|
|
set(PKG_NAME "robot_sbpl")
|
|
set(PKG_DESC "The Search Based Planning Library")
|
|
set(PKG_SBPL_LIBS "-lrobot_sbpl")
|
|
set(pkg_conf_file_in "${CMAKE_CURRENT_SOURCE_DIR}/robot_sbpl.pc.in")
|
|
set(pkg_conf_file "${PROJECT_BINARY_DIR}/InstallFiles/robot_sbpl.pc")
|
|
configure_file("${pkg_conf_file_in}" "${pkg_conf_file}" @ONLY)
|
|
install(FILES ${pkg_conf_file} DESTINATION lib/pkgconfig/ COMPONENT pkgconfig)
|
|
|
|
# support for cmake-config:
|
|
configure_file(robot_sbpl-config.cmake.in
|
|
"${PROJECT_BINARY_DIR}/InstallFiles/robot_sbpl-config.cmake" @ONLY)
|
|
configure_file(robot_sbpl-config-version.cmake.in
|
|
"${PROJECT_BINARY_DIR}/InstallFiles/robot_sbpl-config-version.cmake" @ONLY)
|
|
install(FILES
|
|
"${PROJECT_BINARY_DIR}/InstallFiles/robot_sbpl-config.cmake"
|
|
"${PROJECT_BINARY_DIR}/InstallFiles/robot_sbpl-config-version.cmake"
|
|
DESTINATION share/robot_sbpl/)
|
|
|
|
# support for build tree export
|
|
option(SBPL_BUILD_TREE_EXPORT "Enable build tree exports" OFF)
|
|
if (${SBPL_BUILD_TREE_EXPORT})
|
|
export(TARGETS robot_sbpl FILE robot_sbpl-targets.cmake)
|
|
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/include")
|
|
configure_file(
|
|
robot_sbpl-config-tree-export.cmake.in
|
|
"${PROJECT_BINARY_DIR}/robot_sbpl-config.cmake"
|
|
@ONLY)
|
|
export(PACKAGE robot_sbpl)
|
|
endif()
|
|
|
|
install(DIRECTORY src/include/sbpl DESTINATION include
|
|
FILES_MATCHING PATTERN "*.h")
|
|
# Exported like the other robot_* packages: a shared library that links robot_sbpl and installs its
|
|
# own export set (sbpl_lattice_planner) needs robot_sbpl in an export set too, or CMake fails at
|
|
# generate time.
|
|
install(TARGETS robot_sbpl
|
|
EXPORT robot_sbpl-targets
|
|
LIBRARY DESTINATION lib)
|
|
install(EXPORT robot_sbpl-targets
|
|
FILE robot_sbpl-targets.cmake
|
|
NAMESPACE robot_sbpl::
|
|
DESTINATION lib/cmake/robot_sbpl)
|
|
|
|
# Test programs are OFF by default: the standalone pnkx_nav_core build (the robot deployment
|
|
# path) pulls this directory in, and must not produce them. Enable with -DBUILD_ROBOT_SBPL_TESTS=ON
|
|
# to get test_sbpl (README.txt usage) and test_adjacency_list.
|
|
option(BUILD_ROBOT_SBPL_TESTS "Build the robot_sbpl test programs" OFF)
|
|
|
|
if(BUILD_ROBOT_SBPL_TESTS)
|
|
add_executable(test_sbpl src/test/main.cpp)
|
|
target_link_libraries(test_sbpl robot_sbpl)
|
|
|
|
add_executable(test_adjacency_list src/test/test_adjacency_list.cpp)
|
|
target_link_libraries(test_adjacency_list robot_sbpl)
|
|
endif()
|