2019-01-14 18:33:38 +08:00
|
|
|
set(VIDEOIO_PLUGIN_LIST "" CACHE STRING "List of videoio backends to be compiled as plugins (ffmpeg, gstreamer)")
|
|
|
|
set(VIDEOIO_ENABLE_PLUGINS "ON" CACHE BOOL "Allow building videoio plugin support")
|
|
|
|
set(VIDEOIO_ENABLE_STRICT_PLUGIN_CHECK "ON" CACHE BOOL "Make sure OpenCV version is the same in plugin and host code")
|
|
|
|
mark_as_advanced(VIDEOIO_PLUGIN_LIST VIDEOIO_ENABLE_PLUGINS VIDEOIO_ENABLE_STRICT_PLUGIN_CHECK)
|
|
|
|
|
2019-03-02 16:31:56 +08:00
|
|
|
string(REPLACE "," ";" VIDEOIO_PLUGIN_LIST "${VIDEOIO_PLUGIN_LIST}") # support comma-separated list (,) too
|
|
|
|
|
|
|
|
# Make virtual opencv_videoio_plugins target
|
|
|
|
if(NOT TARGET opencv_videoio_plugins)
|
|
|
|
add_custom_target(opencv_videoio_plugins ALL)
|
|
|
|
endif()
|
|
|
|
|
2015-05-20 22:59:42 +08:00
|
|
|
ocv_add_module(videoio opencv_imgproc opencv_imgcodecs WRAP java python)
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
set(videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp)
|
2014-07-10 22:27:32 +08:00
|
|
|
|
|
|
|
set(videoio_srcs
|
2018-12-26 20:50:20 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/videoio_registry.cpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/videoio_c.cpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/cap.cpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/cap_images.cpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/cap_mjpeg_encoder.cpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/cap_mjpeg_decoder.cpp"
|
2019-03-03 06:36:18 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/backend_plugin.cpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/backend_static.cpp"
|
2018-12-26 20:50:20 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/src/container_avi.cpp")
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2014-08-08 19:57:54 +08:00
|
|
|
file(GLOB videoio_ext_hdrs
|
2018-12-26 20:50:20 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/legacy/*.h")
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2015-05-15 21:29:06 +08:00
|
|
|
# Removing WinRT API headers by default
|
|
|
|
list(REMOVE_ITEM videoio_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/cap_winrt.hpp")
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(DEFINED WINRT AND NOT DEFINED ENABLE_WINRT_MODE_NATIVE)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
|
|
|
|
endif()
|
|
|
|
|
2015-05-15 21:29:06 +08:00
|
|
|
# Dependencies used by the implementation referenced
|
|
|
|
# below are not available on WinRT 8.0.
|
|
|
|
# Enabling it for WiRT 8.1+ only.
|
2015-12-09 10:42:25 +08:00
|
|
|
if(DEFINED WINRT AND NOT DEFINED WINRT_8_0 AND NOT DEFINED ENABLE_WINRT_MODE_NATIVE)
|
2015-05-15 21:29:06 +08:00
|
|
|
|
|
|
|
# WinRT detected. Adding WinRT API header
|
2015-07-11 00:18:07 +08:00
|
|
|
message(STATUS " ${name}: WinRT detected. Adding WinRT API header")
|
2015-05-15 21:29:06 +08:00
|
|
|
list(APPEND videoio_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/cap_winrt.hpp")
|
|
|
|
|
|
|
|
# Adding WinRT internal sources and headers
|
|
|
|
list(APPEND videoio_srcs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt_capture.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt_bridge.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt_video.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt/CaptureFrameGrabber.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt/MediaStreamSink.cpp)
|
|
|
|
list(APPEND videoio_hdrs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt_capture.hpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt_bridge.hpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt_video.hpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt/MFIncludes.hpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt/CaptureFrameGrabber.hpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt/MediaSink.hpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt/MediaStreamSink.hpp)
|
|
|
|
endif()
|
|
|
|
|
2019-05-17 22:23:47 +08:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/cmake/plugin.cmake)
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
set(tgts)
|
|
|
|
|
|
|
|
if(TARGET ocv.3rdparty.mediasdk)
|
2019-05-17 22:23:47 +08:00
|
|
|
if("mfx" IN_LIST VIDEOIO_PLUGIN_LIST)
|
|
|
|
ocv_create_builtin_videoio_plugin("opencv_videoio_intel_mfx" ocv.3rdparty.mediasdk "cap_mfx_common.cpp" "cap_mfx_reader.cpp" "cap_mfx_writer.cpp" "cap_mfx_plugin.cpp")
|
|
|
|
else()
|
|
|
|
list(APPEND videoio_srcs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_common.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_reader.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_writer.cpp)
|
|
|
|
list(APPEND videoio_hdrs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_common.hpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_reader.hpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_writer.hpp)
|
|
|
|
list(APPEND tgts ocv.3rdparty.mediasdk)
|
|
|
|
endif()
|
2017-03-23 16:55:43 +08:00
|
|
|
endif()
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.dshow)
|
2014-08-01 22:11:20 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dshow.cpp)
|
|
|
|
list(APPEND videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dshow.hpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.dshow)
|
2014-07-10 22:27:32 +08:00
|
|
|
endif()
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.msmf)
|
2014-09-25 18:05:54 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_msmf.hpp)
|
2014-08-01 22:11:20 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_msmf.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.msmf)
|
2014-07-10 22:27:32 +08:00
|
|
|
endif()
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.xine)
|
2014-08-01 22:11:20 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_xine.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.xine)
|
|
|
|
endif()
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.dc1394_2)
|
2014-08-01 22:11:20 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dc1394_v2.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.dc1394_2)
|
|
|
|
endif()
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.gstreamer)
|
2019-01-14 18:33:38 +08:00
|
|
|
if("gstreamer" IN_LIST VIDEOIO_PLUGIN_LIST)
|
|
|
|
ocv_create_builtin_videoio_plugin("opencv_videoio_gstreamer" ocv.3rdparty.gstreamer "cap_gstreamer.cpp")
|
|
|
|
else()
|
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_gstreamer.cpp)
|
|
|
|
list(APPEND tgts ocv.3rdparty.gstreamer)
|
|
|
|
endif()
|
2018-12-26 20:50:20 +08:00
|
|
|
endif()
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.v4l)
|
2014-08-01 22:11:20 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_v4l.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.v4l)
|
2014-07-10 22:27:32 +08:00
|
|
|
endif()
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.openni2)
|
2014-08-01 22:11:20 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_openni2.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.openni2)
|
|
|
|
endif()
|
2014-07-20 20:49:47 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.ximea)
|
2014-08-01 22:11:20 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_ximea.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.ximea)
|
|
|
|
endif()
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.ffmpeg)
|
2019-01-14 18:33:38 +08:00
|
|
|
if("ffmpeg" IN_LIST VIDEOIO_PLUGIN_LIST)
|
|
|
|
ocv_create_builtin_videoio_plugin("opencv_videoio_ffmpeg" ocv.3rdparty.ffmpeg "cap_ffmpeg.cpp")
|
|
|
|
else()
|
|
|
|
list(APPEND videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/cap_ffmpeg_impl.hpp)
|
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_ffmpeg.cpp)
|
|
|
|
list(APPEND tgts ocv.3rdparty.ffmpeg)
|
|
|
|
endif()
|
2018-12-26 20:50:20 +08:00
|
|
|
endif()
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.pvapi)
|
2014-08-01 22:11:20 +08:00
|
|
|
set(videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_pvapi.cpp ${videoio_srcs})
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.pvapi)
|
2014-07-10 22:27:32 +08:00
|
|
|
endif()
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.aravis)
|
2016-10-08 03:55:49 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_aravis.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.aravis)
|
|
|
|
endif()
|
2016-10-08 03:55:49 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.avfoundation)
|
2016-09-09 20:38:00 +08:00
|
|
|
if(IOS)
|
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation.mm)
|
|
|
|
else()
|
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation_mac.mm)
|
|
|
|
endif()
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.avfoundation)
|
2016-05-09 02:50:16 +08:00
|
|
|
endif()
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.librealsense)
|
2018-05-16 22:27:25 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_librealsense.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.librealsense)
|
|
|
|
endif()
|
2018-05-16 22:27:25 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.gphoto2)
|
2015-05-21 06:41:39 +08:00
|
|
|
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_gphoto2.cpp)
|
2018-12-26 20:50:20 +08:00
|
|
|
list(APPEND tgts ocv.3rdparty.gphoto2)
|
2014-07-10 22:27:32 +08:00
|
|
|
endif()
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
if(TARGET ocv.3rdparty.cap_ios)
|
|
|
|
list(APPEND videoio_srcs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_ios_abstract_camera.mm
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_ios_photo_camera.mm
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_ios_video_camera.mm)
|
|
|
|
list(APPEND tgts ocv.3rdparty.cap_ios)
|
2014-07-10 22:27:32 +08:00
|
|
|
endif()
|
|
|
|
|
2019-03-20 02:28:45 +08:00
|
|
|
if(TARGET ocv.3rdparty.android_mediandk)
|
|
|
|
list(APPEND videoio_srcs
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/src/cap_android_mediandk.cpp)
|
|
|
|
list(APPEND tgts ocv.3rdparty.android_mediandk)
|
|
|
|
endif()
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
ocv_set_module_sources(HEADERS ${videoio_ext_hdrs} ${videoio_hdrs} SOURCES ${videoio_srcs})
|
2014-07-10 22:27:32 +08:00
|
|
|
ocv_module_include_directories()
|
2018-12-26 20:50:20 +08:00
|
|
|
ocv_create_module()
|
|
|
|
ocv_add_accuracy_tests(${tgts})
|
|
|
|
ocv_add_perf_tests(${tgts})
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2019-01-14 18:33:38 +08:00
|
|
|
if(VIDEOIO_ENABLE_PLUGINS)
|
|
|
|
ocv_target_compile_definitions(${the_module} PRIVATE ENABLE_PLUGINS)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VIDEOIO_ENABLE_STRICT_PLUGIN_CHECK)
|
|
|
|
ocv_target_compile_definitions(${the_module} PRIVATE STRICT_PLUGIN_CHECK)
|
|
|
|
endif()
|
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
ocv_target_link_libraries(${the_module} LINK_PRIVATE ${tgts})
|
2014-07-10 22:27:32 +08:00
|
|
|
|
2018-12-26 20:50:20 +08:00
|
|
|
# copy FFmpeg dll to the output folder
|
2018-05-31 20:39:59 +08:00
|
|
|
if(WIN32 AND HAVE_FFMPEG_WRAPPER)
|
2014-07-10 22:27:32 +08:00
|
|
|
if(MSVC64 OR MINGW64)
|
|
|
|
set(FFMPEG_SUFFIX _64)
|
|
|
|
endif()
|
2017-03-15 18:19:59 +08:00
|
|
|
set(ffmpeg_dir "${OpenCV_BINARY_DIR}/3rdparty/ffmpeg")
|
2014-07-10 22:27:32 +08:00
|
|
|
set(ffmpeg_bare_name "opencv_ffmpeg${FFMPEG_SUFFIX}.dll")
|
|
|
|
set(ffmpeg_bare_name_ver "opencv_ffmpeg${OPENCV_DLLVERSION}${FFMPEG_SUFFIX}.dll")
|
2017-03-15 18:19:59 +08:00
|
|
|
set(ffmpeg_path "${ffmpeg_dir}/${ffmpeg_bare_name}")
|
2014-07-10 22:27:32 +08:00
|
|
|
if(MSVC_IDE)
|
2018-12-26 20:50:20 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Release/${ffmpeg_bare_name_ver}"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Debug/${ffmpeg_bare_name_ver}")
|
2014-07-10 22:27:32 +08:00
|
|
|
elseif(MSVC AND (CMAKE_GENERATOR MATCHES "Visual"))
|
2018-12-26 20:50:20 +08:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${ffmpeg_bare_name_ver}")
|
2014-07-10 22:27:32 +08:00
|
|
|
else()
|
2018-12-26 20:50:20 +08:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${ffmpeg_bare_name_ver}")
|
2014-07-10 22:27:32 +08:00
|
|
|
endif()
|
|
|
|
install(FILES "${ffmpeg_path}" DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT libs RENAME "${ffmpeg_bare_name_ver}")
|
2015-12-18 20:06:19 +08:00
|
|
|
if(INSTALL_CREATE_DISTRIB)
|
2017-03-15 18:19:59 +08:00
|
|
|
install(FILES "${ffmpeg_dir}/opencv_ffmpeg.dll" DESTINATION "bin/" COMPONENT libs RENAME "opencv_ffmpeg${OPENCV_DLLVERSION}.dll")
|
|
|
|
install(FILES "${ffmpeg_dir}/opencv_ffmpeg_64.dll" DESTINATION "bin/" COMPONENT libs RENAME "opencv_ffmpeg${OPENCV_DLLVERSION}_64.dll")
|
2015-12-18 20:06:19 +08:00
|
|
|
endif()
|
2014-07-10 22:27:32 +08:00
|
|
|
endif()
|