# The rplidar plugin compiles the vendor SDK straight into the plugin .so. # XLIDAR_RPLIDAR_SDK_DIR must point at a directory holding include/ + src/; # when unset, common local layouts are probed. Without an SDK the plugin is # skipped (the rest of the build is unaffected). if(NOT XLIDAR_RPLIDAR_SDK_DIR) foreach(candidate ${CMAKE_SOURCE_DIR}/third_party/rplidar_sdk ${CMAKE_SOURCE_DIR}/../rplidar_sdk/sdk ${CMAKE_SOURCE_DIR}/../xloc-monorepo/xlocd/deps/rplidar_sdk) if(EXISTS ${candidate}/include/sl_lidar.h) set(XLIDAR_RPLIDAR_SDK_DIR ${candidate}) break() endif() endforeach() endif() if(NOT XLIDAR_RPLIDAR_SDK_DIR OR NOT EXISTS ${XLIDAR_RPLIDAR_SDK_DIR}/include/sl_lidar.h) message(WARNING "driver_rplidar: Slamtec SDK not found " "(set -DXLIDAR_RPLIDAR_SDK_DIR=...) — plugin skipped") return() endif() message(STATUS "driver_rplidar: using SDK at ${XLIDAR_RPLIDAR_SDK_DIR}") file(GLOB_RECURSE RPLIDAR_SDK_SOURCES CONFIGURE_DEPENDS ${XLIDAR_RPLIDAR_SDK_DIR}/src/*.cpp) # The SDK ships win32/macOS arch files; keep Linux only. list(FILTER RPLIDAR_SDK_SOURCES EXCLUDE REGEX "arch/(win32|macOS)/") xlidar_add_plugin(driver_rplidar rplidar_driver.cpp ${RPLIDAR_SDK_SOURCES}) target_include_directories(driver_rplidar SYSTEM PRIVATE ${XLIDAR_RPLIDAR_SDK_DIR}/include ${XLIDAR_RPLIDAR_SDK_DIR}/src )