vcpkg/ports/ffmpeg/FindFFMPEG.cmake.in
Stefano Sinigardi f1e7a3f167
[opencv4] update to v4.3 (#11130)
* [opencv4] draft update to v4.3

* restore uwp patch

* fix qt and ipp features

* fix libepoxy and meson on osx

* fix baseline, trigger a full rebuild due to meson tool changes

* remove jpeg feature on windows due to a bug with MSVC

* minor fixes for some features

* ffmpeg x11 lib not required anymore on apple for downstream projects

* small fixes for ogre and qt5

* remove a broken module

* fix installation path

* fix openexr which was broken and regressed opencv downstream projects

* first round of ci passes

* improve compatibility with android toolchain

* [openexr] upgrade to v2.5.0 to fix regressions, might require fixes in dependent projects and might deserve its own PR

* fix OpenEXR link for downstream projects

* do not install unrequested features

* fix compatibility with newer OpenEXR

* [OpenCV3] update to v3.4.10

* fix openexr on windows, was creating symlinks that broke vcpkg

* fix openexr wrapper

* [openexr] cmake config files are installed into a lowered-case folder

* remove mangled paths trying to fix android setup

* disable dnn on android, fix mangled cmake config paths again

* fix downstream CUDA dependency

* fix compatibility with vs16.6

* remove from baseline ports now passing tests

* [alembic] fixes for new openexr

* fix baseline

* [field3d] fixes for new openexr

* [field3d] improve fixes, windows still unsupported despite what is said upstream

* apply fixes required from review

* add missing field3d patch

* [field3d] disable mpi integration

* [opencv2] remove cublas integration

* [vtk] do not create libharu::libharu target if already existing

* Update ports/opencv4/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/opencv3/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* improve compatibility with newer CUDNN

* [OpenCV3, OpenCV4] improve compatibility with CUDA 11

* [OpenCV2] improve compatibility with CUDA 11

* [field3d] regenerate patch ignoring space at eol

* [vcpkg] Use SSH keys instead of password authentication when minting Linux scale sets (#11999)

* [field3d] regenerate patch ignoring space at eol

* [field3d] regenerate patch, again

* [field3d] fixes for windows

* [libass] fix regression

* ci.baseline.txt update

* [CUDA11] use FindCUDA from CMake 3.18 to ease transition later

* re-bump vtk and ffmpeg, which were lost with merges from master

* [OpenCV4] Halide feature is not broken anymore

* [field3d] regenerate hdf5 patch

* [OpenCV4] remove GTK features: it can be built only on *nix but GTK on vcpkg cannot be built on *nix systems...

* merge ci.baseline.txt from master and fix field3d patch

* remove rebuilding

* restore vtk CONTROL file

* update CONTROL files

* Trigger rebuild

* Update ports/freeimage/CONTROL

* Update ports/freeimage/CONTROL

* [opencv3/4] avoid tesseract dependency on uwp builds

* [opencv] add missing module search

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
2020-07-27 17:43:23 -07:00

179 lines
7.0 KiB
CMake

# Distributed under the OSI-approved BSD 3-Clause License.
#
#.rst:
# FindFFMPEG
# --------
#
# Find the FFPMEG libraries
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# The following variables will be defined:
#
# ``FFMPEG_FOUND``
# True if FFMPEG found on the local system
#
# ``FFMPEG_INCLUDE_DIRS``
# Location of FFMPEG header files
#
# ``FFMPEG_LIBRARY_DIRS``
# Location of FFMPEG libraries
#
# ``FFMPEG_LIBRARIES``
# List of the FFMPEG libraries found
#
#
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
include(${CMAKE_ROOT}/Modules/CMakeFindDependencyMacro.cmake)
set(FFMPEG_VERSION "4.2")
find_dependency(Threads)
if(UNIX)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS -pthread)
endif()
if(UNIX AND NOT APPLE)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS -lX11)
endif()
if(@ENABLE_BZIP2@)
find_dependency(BZip2)
get_target_property(BZip2_LIBRARY_RELEASE BZip2::BZip2 IMPORTED_LOCATION_RELEASE)
get_target_property(BZip2_LIBRARY_DEBUG BZip2::BZip2 IMPORTED_LOCATION_DEBUG)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${BZip2_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${BZip2_LIBRARY_RELEASE}>")
endif()
if(@ENABLE_LZMA@)
find_dependency(LibLZMA)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LibLZMA_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${LibLZMA_LIBRARY_RELEASE}>")
endif()
# Platform dependent libraries required by FFMPEG
if(WIN32)
if(NOT CYGWIN)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS wsock32 ws2_32 secur32 bcrypt)
endif()
else()
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS m)
endif()
macro(FFMPEG_FIND varname shortname headername)
if(NOT FFMPEG_${varname}_INCLUDE_DIRS)
find_path(FFMPEG_${varname}_INCLUDE_DIRS NAMES lib${shortname}/${headername} ${headername} PATH_SUFFIXES ffmpeg)
endif()
if(NOT FFMPEG_${varname}_LIBRARY)
find_library(FFMPEG_${varname}_LIBRARY_RELEASE NAMES ${shortname} PATH_SUFFIXES ffmpeg ffmpeg/lib)
get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY)
find_library(FFMPEG_${varname}_LIBRARY_DEBUG NAMES ${shortname}d ${shortname} PATHS debug PATH_SUFFIXES ffmpeg ffmpeg/lib ffmpeg/debug/lib debug/ffmpeg/lib)
get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY)
select_library_configurations(FFMPEG_${varname})
endif()
if (FFMPEG_${varname}_LIBRARY AND FFMPEG_${varname}_INCLUDE_DIRS)
set(FFMPEG_${varname}_FOUND 1)
list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR})
endif()
endmacro(FFMPEG_FIND)
macro(FFMPEG_FIND_GENEX varname shortname headername)
if(NOT FFMPEG_${varname}_INCLUDE_DIRS)
find_path(FFMPEG_${varname}_INCLUDE_DIRS NAMES lib${shortname}/${headername} ${headername} PATH_SUFFIXES ffmpeg)
endif()
if(NOT FFMPEG_${varname}_LIBRARY)
find_library(FFMPEG_${varname}_LIBRARY_RELEASE NAMES ${shortname} PATH_SUFFIXES ffmpeg ffmpeg/lib)
get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY)
find_library(FFMPEG_${varname}_LIBRARY_DEBUG NAMES ${shortname}d ${shortname} PATHS debug PATH_SUFFIXES ffmpeg ffmpeg/lib ffmpeg/debug/lib debug/ffmpeg/lib)
get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY)
set(FFMPEG_${varname}_LIBRARY "$<$<CONFIG:Debug>:${FFMPEG_${varname}_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${FFMPEG_${varname}_LIBRARY_RELEASE}>" CACHE STRING "")
set(FFMPEG_${varname}_LIBRARIES ${FFMPEG_${varname}_LIBRARY} CACHE STRING "")
endif()
if (FFMPEG_${varname}_LIBRARY AND FFMPEG_${varname}_INCLUDE_DIRS)
set(FFMPEG_${varname}_FOUND 1)
list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR})
endif()
endmacro(FFMPEG_FIND_GENEX)
if(WIN32)
FFMPEG_FIND_GENEX(libzlib zlib zlib.h)
else()
FFMPEG_FIND_GENEX(libzlib z zlib.h)
endif()
if(APPLE)
find_library(VT_UNIT VideoToolbox)
if (NOT VT_UNIT)
message(FATAL_ERROR "VideoToolbox not found")
endif()
find_library(AT_UNIT AudioToolbox)
if (NOT AT_UNIT)
message(FATAL_ERROR "AudioToolbox not found")
endif()
find_library(SEC_UNIT Security)
if (NOT SEC_UNIT)
message(FATAL_ERROR "Security not found")
endif()
find_library(CF_UNIT CoreFoundation)
if (NOT CF_UNIT)
message(FATAL_ERROR "CoreFoundation not found")
endif()
find_library(CM_UNIT CoreMedia)
if (NOT CM_UNIT)
message(FATAL_ERROR "CoreMedia not found")
endif()
find_library(CV_UNIT CoreVideo)
if (NOT CV_UNIT)
message(FATAL_ERROR "CoreVideo not found")
endif()
find_package(Iconv QUIET)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${VT_UNIT} ${AT_UNIT} ${SEC_UNIT} ${CF_UNIT} ${CM_UNIT} ${CV_UNIT} ${Iconv_LIBRARIES})
endif()
FFMPEG_FIND(libavcodec avcodec avcodec.h)
FFMPEG_FIND(libavdevice avdevice avdevice.h)
FFMPEG_FIND(libavfilter avfilter avfilter.h)
FFMPEG_FIND(libavformat avformat avformat.h)
FFMPEG_FIND(libavresample avresample avresample.h)
FFMPEG_FIND(libavutil avutil avutil.h)
FFMPEG_FIND(libswresample swresample swresample.h)
FFMPEG_FIND(libswscale swscale swscale.h)
if (FFMPEG_libavcodec_FOUND AND FFMPEG_libavdevice_FOUND AND FFMPEG_libavfilter_FOUND AND FFMPEG_libavformat_FOUND AND FFMPEG_libavutil_FOUND AND FFMPEG_libswresample_FOUND AND FFMPEG_libswscale_FOUND AND FFMPEG_libzlib_FOUND)
list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_libavformat_INCLUDE_DIRS} ${FFMPEG_libavdevice_INCLUDE_DIRS} ${FFMPEG_libavcodec_INCLUDE_DIRS} ${FFMPEG_libavutil_INCLUDE_DIRS} ${FFMPEG_libswscale_INCLUDE_DIRS})
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_LIBRARY_DIRS)
set(FFMPEG_libavcodec_VERSION "${FFMPEG_VERSION}" CACHE STRING "")
set(FFMPEG_libavdevice_VERSION "${FFMPEG_VERSION}" CACHE STRING "")
set(FFMPEG_libavfilter_VERSION "${FFMPEG_VERSION}" CACHE STRING "")
set(FFMPEG_libavformat_VERSION "${FFMPEG_VERSION}" CACHE STRING "")
if(FFMPEG_libavresample_FOUND)
set(FFMPEG_libavresample_VERSION "${FFMPEG_VERSION}" CACHE STRING "")
endif()
set(FFMPEG_libavutil_VERSION "${FFMPEG_VERSION}" CACHE STRING "")
set(FFMPEG_libswresample_VERSION "${FFMPEG_VERSION}" CACHE STRING "")
set(FFMPEG_libswscale_VERSION "${FFMPEG_VERSION}" CACHE STRING "")
list(APPEND FFMPEG_LIBRARIES
${FFMPEG_libavdevice_LIBRARY}
${FFMPEG_libavfilter_LIBRARY}
${FFMPEG_libavformat_LIBRARY}
${FFMPEG_libswscale_LIBRARY}
${FFMPEG_libavcodec_LIBRARY}
${FFMPEG_libswresample_LIBRARY}
${FFMPEG_libavresample_LIBRARY}
${FFMPEG_libavutil_LIBRARY}
${FFMPEG_libzlib_LIBRARY}
${FFMPEG_PLATFORM_DEPENDENT_LIBS}
)
set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES})
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "")
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "")
set(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBRARY_DIRS} CACHE STRING "")
endif()
find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_LIBRARY_DIRS FFMPEG_INCLUDE_DIRS)