# Driver plugins. Every plugin is a self-contained MODULE library named
# <dir>.so (no "lib" prefix), exporting exactly the two C entry points
# declared in include/lidar_interface.hpp. Plugins land in build/plugins/.

set(XLIDAR_PLUGIN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/plugins)
set(XLIDAR_PLUGIN_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)

# xlidar_add_plugin(<name> <sources...>) — shared boilerplate for one plugin.
function(xlidar_add_plugin name)
    add_library(${name} MODULE ${ARGN})
    set_target_properties(${name} PROPERTIES
        PREFIX ""                                       # driver_olei.so, not libdriver_olei.so
        LIBRARY_OUTPUT_DIRECTORY ${XLIDAR_PLUGIN_OUTPUT_DIR}
        CXX_VISIBILITY_PRESET hidden                    # only the two entry points are visible
        VISIBILITY_INLINES_HIDDEN ON
        POSITION_INDEPENDENT_CODE ON
    )
    target_include_directories(${name} PRIVATE
        ${CMAKE_SOURCE_DIR}/include
        ${XLIDAR_PLUGIN_COMMON_DIR}
    )
    target_link_libraries(${name} PRIVATE Threads::Threads)
endfunction()

add_subdirectory(driver_olei)
add_subdirectory(driver_sick_code)
add_subdirectory(driver_sick_safety)
add_subdirectory(driver_espe)
add_subdirectory(driver_rplidar)
