2019-05-17 22:23:47 +08:00
|
|
|
function(ocv_create_builtin_videoio_plugin name target)
|
2019-01-14 18:33:38 +08:00
|
|
|
|
2019-03-02 16:31:56 +08:00
|
|
|
ocv_debug_message("ocv_create_builtin_videoio_plugin(${ARGV})")
|
|
|
|
|
2019-01-14 18:33:38 +08:00
|
|
|
if(NOT TARGET ${target})
|
|
|
|
message(FATAL_ERROR "${target} does not exist!")
|
|
|
|
endif()
|
|
|
|
if(NOT OpenCV_SOURCE_DIR)
|
|
|
|
message(FATAL_ERROR "OpenCV_SOURCE_DIR must be set to build the plugin!")
|
|
|
|
endif()
|
|
|
|
|
2019-03-02 16:31:56 +08:00
|
|
|
message(STATUS "Video I/O: add builtin plugin '${name}'")
|
|
|
|
|
2019-05-17 22:23:47 +08:00
|
|
|
foreach(src ${ARGN})
|
|
|
|
list(APPEND sources "${CMAKE_CURRENT_LIST_DIR}/src/${src}")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
add_library(${name} MODULE ${sources})
|
2019-01-14 18:33:38 +08:00
|
|
|
target_include_directories(${name} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
target_compile_definitions(${name} PRIVATE BUILD_PLUGIN)
|
|
|
|
target_link_libraries(${name} PRIVATE ${target})
|
|
|
|
|
|
|
|
foreach(mod opencv_videoio opencv_core opencv_imgproc opencv_imgcodecs)
|
|
|
|
target_link_libraries(${name} PRIVATE ${mod})
|
|
|
|
target_include_directories(${name} PRIVATE "${OPENCV_MODULE_${mod}_LOCATION}/include")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set_target_properties(${name} PROPERTIES
|
|
|
|
CXX_STANDARD 11
|
|
|
|
CXX_VISIBILITY_PRESET hidden
|
|
|
|
)
|
|
|
|
install(TARGETS ${name} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT plugins OPTIONAL)
|
|
|
|
|
2019-03-02 16:31:56 +08:00
|
|
|
add_dependencies(opencv_videoio_plugins ${name})
|
|
|
|
|
2019-01-14 18:33:38 +08:00
|
|
|
endfunction()
|