erik replied to the topic 'The Imaging Source and INDI' in the forum. 5 years ago

Hey, thanks for the hint with the lx200 library.

I had a look at that and tried to do it similar, I changed the CMakeLists.txt accordingly and adapted the FindINDI.cmake in indi-3rdparty as well, but I seem to have been missing something, 'cause the newly written driver inheriting from V4L2_Driver does not link to the created library. Undefineed references to all member function..

CMakeFiles/indi_v4ltis_ccd.dir/v4ltis_ccd.o: In function `V4LTISCCD::V4LTISCCD()':
/home/erik/indi-3rdparty/indi-v4ltis/v4ltis_ccd.cpp:157: undefined reference to `V4L2_Driver::V4L2_Driver()'
CMakeFiles/indi_v4ltis_ccd.dir/v4ltis_ccd.o: In function `V4LTISCCD::~V4LTISCCD()':
/home/erik/indi-3rdparty/indi-v4ltis/v4ltis_ccd.cpp:162: undefined reference to `V4L2_Driver::~V4L2_Driver()'
CMakeFiles/indi_v4ltis_ccd.dir/v4ltis_ccd.o: In function `V4LTISCCD::initProperties()':
/home/erik/indi-3rdparty/indi-v4ltis/v4ltis_ccd.cpp:174: undefined reference to `V4L2_Driver::initProperties()'
CMakeFiles/indi_v4ltis_ccd.dir/v4ltis_ccd.o: In function `V4LTISCCD::ISGetProperties(char const*)':
/home/erik/indi-3rdparty/indi-v4ltis/v4ltis_ccd.cpp:182: undefined reference to `V4L2_Driver::ISGetProperties(char const*)'
CMakeFiles/indi_v4ltis_ccd.dir/v4ltis_ccd.o: In function `V4LTISCCD::ISNewSwitch(char const*, char const*, ISState*, char**, int)':
/home/erik/indi-3rdparty/indi-v4ltis/v4ltis_ccd.cpp:187: undefined reference to `V4L2_Driver::ISNewSwitch(char const*, char const*, ISState*, char**, int)'
CMakeFiles/indi_v4ltis_ccd.dir/v4ltis_ccd.o: In function `V4LTISCCD::ISNewText(char const*, char const*, char**, char**, int)':
/home/erik/indi-3rdparty/indi-v4ltis/v4ltis_ccd.cpp:192: undefined reference to `V4L2_Driver::ISNewText(char const*, char const*, char**, char**, int)'
CMakeFiles/indi_v4ltis_ccd.dir/v4ltis_ccd.o: In function `V4LTISCCD::ISNewNumber(char const*, char const*, double*, char**, int)':
/home/erik/indi-3rdparty/indi-v4ltis/v4ltis_ccd.cpp:197: undefined reference to `V4L2_Driver::ISNewNumber(char const*, char const*, double*, char**, int)'
CMakeFiles/indi_v4ltis_ccd.dir/v4ltis_ccd.o: In function `V4LTISCCD::updateProperties()':
/home/erik/indi-3rdparty/indi-v4ltis/v4ltis_ccd.cpp:202: undefined reference to `V4L2_Driver::updateProperties()'

Anyway, here are the changes I made to build the v4l library:
########### INDI::CCD V4L Driver ###############
IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
    SET(v4l2driverccd_SRC
        ${CMAKE_CURRENT_SOURCE_DIR}/libs/lx/Lx.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/video/v4l2driver.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/video/indi_v4l2driver.cpp)

    IF (UNITY_BUILD)
        ENABLE_UNITY_BUILD(v4l2driverccd v4l2driverccd_SRC 10 cpp)
    ENDIF ()

    add_library(indiv4l SHARED ${v4l2driverccd_SRC} ${libwebcam_C_SRC} ${libwebcam_CXX_SRC})
    set_target_properties(indiv4l PROPERTIES VERSION ${CMAKE_INDI_VERSION_STRING} SOVERSION ${INDI_SOVERSION} OUTPUT_NAME indiv4l)
    add_executable(indi_v4l2_ccd ${v4l2driverccd_SRC} ${libwebcam_C_SRC} ${libwebcam_CXX_SRC})
    target_link_libraries(indi_v4l2_ccd ${JPEG_LIBRARY} indidriver)
    install(TARGETS indi_v4l2_ccd RUNTIME DESTINATION bin )

    install(TARGETS indiv4l LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
    install(FILES
        ${CMAKE_CURRENT_SOURCE_DIR}/drivers/video/v4l2driver.h
        ${CMAKE_CURRENT_SOURCE_DIR}/libs/lx/Lx.h
        DESTINATION ${INCLUDE_INSTALL_DIR}/libindi COMPONENT Devel)

    install(FILES
        ${CMAKE_CURRENT_SOURCE_DIR}/libs/webcam/v4l2_base.h
        DESTINATION ${INCLUDE_INSTALL_DIR}/libindi/webcam COMPONENT Devel)
    
    install(FILES
        ${CMAKE_CURRENT_SOURCE_DIR}/libs/webcam/v4l2_decode/v4l2_decode.h
        DESTINATION ${INCLUDE_INSTALL_DIR}/libindi/v4l2_decode COMPONENT Devel)

    # For DBK21 camera
    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/drivers/video/80-dbk21-camera.rules DESTINATION ${UDEVRULES_INSTALL_DIR})


ENDIF ()

I did include that into the paragraph of the v4l driver.
As for the FindINDI.cmake I just added this line
INDI_declare_component(v4l  indiv4l)

To my understanding, shoudn't be the v4l library now be included into the INDI_LIBRARIES variable in cmake? I seem to be missing something obvious.

Cheers
Erik

PS.: Once it works, shall I do a pull request?

Read More...