78 lines
2.3 KiB
CMake
78 lines
2.3 KiB
CMake
cmake_minimum_required(VERSION 3.3)
|
|
|
|
# Find ros dependencies
|
|
find_package(ament_cmake REQUIRED)
|
|
find_package(rclcpp REQUIRED)
|
|
find_package(cv_bridge REQUIRED)
|
|
|
|
# Describe ROS project
|
|
option(ENABLE_ROS "Enable or disable building with ROS (if it is found)" ON)
|
|
if (NOT ENABLE_ROS)
|
|
message(FATAL_ERROR "Build with ROS1.cmake if you don't have ROS.")
|
|
endif ()
|
|
add_definitions(-DROS_AVAILABLE=2)
|
|
|
|
# Include our header files
|
|
include_directories(
|
|
src
|
|
${EIGEN3_INCLUDE_DIR}
|
|
${Boost_INCLUDE_DIRS}
|
|
)
|
|
|
|
# Set link libraries used by all binaries
|
|
list(APPEND thirdparty_libraries
|
|
${Boost_LIBRARIES}
|
|
${OpenCV_LIBRARIES}
|
|
)
|
|
|
|
##################################################
|
|
# Make the core library
|
|
##################################################
|
|
|
|
list(APPEND LIBRARY_SOURCES
|
|
src/dummy.cpp
|
|
src/sim/BsplineSE3.cpp
|
|
src/track/TrackBase.cpp
|
|
src/track/TrackAruco.cpp
|
|
src/track/TrackDescriptor.cpp
|
|
src/track/TrackKLT.cpp
|
|
src/track/TrackSIM.cpp
|
|
src/types/Landmark.cpp
|
|
src/feat/Feature.cpp
|
|
src/feat/FeatureInitializer.cpp
|
|
src/utils/print.cpp
|
|
)
|
|
file(GLOB_RECURSE LIBRARY_HEADERS "src/*.h")
|
|
add_library(ov_core_lib SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
|
|
ament_target_dependencies(ov_core_lib rclcpp cv_bridge)
|
|
target_link_libraries(ov_core_lib ${thirdparty_libraries})
|
|
target_include_directories(ov_core_lib PUBLIC src/)
|
|
install(TARGETS ov_core_lib
|
|
LIBRARY DESTINATION lib
|
|
RUNTIME DESTINATION bin
|
|
PUBLIC_HEADER DESTINATION include
|
|
)
|
|
install(DIRECTORY src/
|
|
DESTINATION include
|
|
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
|
|
)
|
|
ament_export_include_directories(include)
|
|
ament_export_libraries(ov_core_lib)
|
|
|
|
##################################################
|
|
# Make binary files!
|
|
##################################################
|
|
|
|
# TODO: UPGRADE THIS TO ROS2 AS ANOTHER FILE!!
|
|
#if (catkin_FOUND AND ENABLE_ROS)
|
|
# add_executable(test_tracking src/test_tracking.cpp)
|
|
# target_link_libraries(test_tracking ov_core_lib ${thirdparty_libraries})
|
|
#endif ()
|
|
|
|
add_executable(test_webcam src/test_webcam.cpp)
|
|
ament_target_dependencies(test_webcam rclcpp cv_bridge)
|
|
target_link_libraries(test_webcam ov_core_lib ${thirdparty_libraries})
|
|
install(TARGETS test_webcam DESTINATION lib/${PROJECT_NAME})
|
|
|
|
# finally define this as the package
|
|
ament_package() |