"docs/source/git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "ddb342ddd66c6ef679b3a309b70f308ae9882e64"
Commit d8a65450 authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Update ffmpeg discovery logic (#2124)

Summary:
Update ffmpeg discovery logic

Previously the build process used pkg-config to locate
an installation of ffmpeg, which does not work well Windows/CentOS.

This commit update the discovery process to use the custom
FindFFMPEG.cmake adopted from Kitware/VTK repository with addition of
conda environment.

 The custom discovery logic can support Windows and CentOS.

Pull Request resolved: https://github.com/pytorch/audio/pull/2124

Reviewed By: carolineechen

Differential Revision: D33429564

Pulled By: mthrok

fbshipit-source-id: 6cb50c1d8c58f51e0f3f3af5c5b541aa3a699bba
parent 6854eedf
...@@ -66,6 +66,7 @@ option(USE_CUDA "Enable CUDA support" OFF) ...@@ -66,6 +66,7 @@ option(USE_CUDA "Enable CUDA support" OFF)
option(USE_ROCM "Enable ROCM support" OFF) option(USE_ROCM "Enable ROCM support" OFF)
option(USE_OPENMP "Enable OpenMP support" OFF) option(USE_OPENMP "Enable OpenMP support" OFF)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# check that USE_CUDA and USE_ROCM are not set at the same time # check that USE_CUDA and USE_ROCM are not set at the same time
if(USE_CUDA AND USE_ROCM) if(USE_CUDA AND USE_ROCM)
......
...@@ -76,6 +76,7 @@ function (_ffmpeg_find component headername) ...@@ -76,6 +76,7 @@ function (_ffmpeg_find component headername)
"lib${component}/${headername}" "lib${component}/${headername}"
PATHS PATHS
"${FFMPEG_ROOT}/include" "${FFMPEG_ROOT}/include"
"$ENV{CONDA_PREFIX}/include"
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/usr/local/include /usr/local/include
...@@ -101,6 +102,7 @@ function (_ffmpeg_find component headername) ...@@ -101,6 +102,7 @@ function (_ffmpeg_find component headername)
"${component}" "${component}"
PATHS PATHS
"${FFMPEG_ROOT}/lib" "${FFMPEG_ROOT}/lib"
"$ENV{CONDA_PREFIX}/lib"
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/usr/local/lib /usr/local/lib
......
...@@ -17,30 +17,11 @@ endif() ...@@ -17,30 +17,11 @@ endif()
# ffmpeg # ffmpeg
################################################################################ ################################################################################
if (BUILD_FFMPEG) if (BUILD_FFMPEG)
if(WIN32) set(FFMPEG_FIND_COMPONENTS avdevice avfilter avformat avcodec avutil)
message(FATAL_ERROR "FFmpeg integration is not supported on Windows.") include(FindFFMPEG)
# TODO
# Since pkg-config is not well-supported on Windows (for example, ffmpeg
# installed from conda-forge does not include `.pc` medata file),
# to support windows, we need to fill interface manually.
#
# Something like this might work
# https://github.com/microsoft/vcpkg/issues/1379#issuecomment-312483740
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET
# requires ffmpeg>=4.1
libavdevice>=58
libavfilter>=7
libavformat>=58
libavcodec>=58
libswresample>=3
libswscale>=3
libavutil>=56
)
add_library(ffmpeg INTERFACE) add_library(ffmpeg INTERFACE)
target_include_directories(ffmpeg INTERFACE ${LIBAV_INCLUDE_DIRS}) target_include_directories(ffmpeg INTERFACE ${FFMPEG_INCLUDE_DIRS})
target_link_libraries(ffmpeg INTERFACE ${LIBAV_LINK_LIBRARIES}) target_link_libraries(ffmpeg INTERFACE ${FFMPEG_LIBRARIES})
endif() endif()
################################################################################ ################################################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment