Skip to content
This repository was archived by the owner on Mar 22, 2020. It is now read-only.

Commit fc1a3ae

Browse files
headupincloudsruslo
authored andcommitted
manage ffmpeg dependency w/ hunter
This adds support for ffmpeg as a hunter package w/ appropriate options: `-DWITH_FFMPEG=ON -DOPENCV_FFMPEG_USE_FIND_PACKAGE=ON` * update Hunter release * update HunterGate * enable ffmpeg package w/ `if(HUNTER_ENABLED)` * translate ffmpeg CONFIG libs to CMake's variable style usage, i.e. `${FFMPEG_INCLUDE_DIRS}, ${FFMPEG_LIBRARIES}`
1 parent 5275998 commit fc1a3ae

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

cmake/OpenCVFindLibsVideo.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ endif(WITH_XIMEA)
186186
ocv_clear_vars(HAVE_FFMPEG)
187187
if(WITH_FFMPEG) # try FFmpeg autodetection
188188
if(OPENCV_FFMPEG_USE_FIND_PACKAGE)
189+
if(NOT HUNTER_ENABLED)
190+
189191
if(OPENCV_FFMPEG_USE_FIND_PACKAGE STREQUAL "1" OR OPENCV_FFMPEG_USE_FIND_PACKAGE STREQUAL "ON")
190192
set(OPENCV_FFMPEG_USE_FIND_PACKAGE "FFMPEG")
191193
endif()
@@ -195,6 +197,23 @@ if(WITH_FFMPEG) # try FFmpeg autodetection
195197
else()
196198
message(STATUS "Can't find FFmpeg via find_package(${OPENCV_FFMPEG_USE_FIND_PACKAGE})")
197199
endif()
200+
201+
else(HUNTER_ENABLED)
202+
hunter_add_package(ffmpeg)
203+
find_package(ffmpeg CONFIG REQUIRED)
204+
205+
set(FFMPEG_FOUND TRUE)
206+
foreach(lib avcodec avformat avutil swresample swscale)
207+
get_target_property(
208+
${lib}_INCLUDE_DIR
209+
ffmpeg::${lib}
210+
INTERFACE_INCLUDE_DIRECTORIES
211+
)
212+
list(APPEND FFMPEG_INCLUDE_DIRS "${${lib}_INCLUDE_DIR}")
213+
list(APPEND FFMPEG_LIBRARIES "ffmpeg::${lib}")
214+
endforeach()
215+
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
216+
endif()
198217
elseif(WIN32 AND NOT ARM AND NOT OPENCV_FFMPEG_SKIP_DOWNLOAD)
199218
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg.cmake")
200219
download_win_ffmpeg(FFMPEG_CMAKE_SCRIPT)

0 commit comments

Comments
 (0)