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

Commit

Permalink
manage ffmpeg dependency w/ hunter
Browse files Browse the repository at this point in the history
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}`
  • Loading branch information
headupinclouds authored and ruslo committed Apr 25, 2019
1 parent 5275998 commit fc1a3ae
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cmake/OpenCVFindLibsVideo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ endif(WITH_XIMEA)
ocv_clear_vars(HAVE_FFMPEG)
if(WITH_FFMPEG) # try FFmpeg autodetection
if(OPENCV_FFMPEG_USE_FIND_PACKAGE)
if(NOT HUNTER_ENABLED)

if(OPENCV_FFMPEG_USE_FIND_PACKAGE STREQUAL "1" OR OPENCV_FFMPEG_USE_FIND_PACKAGE STREQUAL "ON")
set(OPENCV_FFMPEG_USE_FIND_PACKAGE "FFMPEG")
endif()
Expand All @@ -195,6 +197,23 @@ if(WITH_FFMPEG) # try FFmpeg autodetection
else()
message(STATUS "Can't find FFmpeg via find_package(${OPENCV_FFMPEG_USE_FIND_PACKAGE})")
endif()

else(HUNTER_ENABLED)
hunter_add_package(ffmpeg)
find_package(ffmpeg CONFIG REQUIRED)

set(FFMPEG_FOUND TRUE)
foreach(lib avcodec avformat avutil swresample swscale)
get_target_property(
${lib}_INCLUDE_DIR
ffmpeg::${lib}
INTERFACE_INCLUDE_DIRECTORIES
)
list(APPEND FFMPEG_INCLUDE_DIRS "${${lib}_INCLUDE_DIR}")
list(APPEND FFMPEG_LIBRARIES "ffmpeg::${lib}")
endforeach()
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
endif()
elseif(WIN32 AND NOT ARM AND NOT OPENCV_FFMPEG_SKIP_DOWNLOAD)
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg.cmake")
download_win_ffmpeg(FFMPEG_CMAKE_SCRIPT)
Expand Down

0 comments on commit fc1a3ae

Please sign in to comment.