[ffmpeg] use pkgconfig to get system dependencies for cmake (#17985)

* [ffmpeg] use ffbuild/config.mak to get dependencies

* [ffmpeg] bump port version

* [ffmpeg] x-add-version

* [ffmpeg] fix dependency issue on x64-linux

* [ffmpeg] x-add-version

* [ffmpeg] link order fix on linux

* [ffmpeg] x-add-version

* [ffmpeg] bump port version

* [ffmpeg] x-add-version

* [ffmpeg] exclude -lgcc and -lgcc_s (causes issues on azure for unknown reasons)

* [ffmpeg] x-add-version

* [ffmpeg] handle -lgcc and -lgcc_s appropriately

* [ffmpeg] x-add-version

* [ffmpeg] use x_vcpkg_pkgconfig_get_modules to get info, added some more fixes to generated for pkgconfig files

* [ffmpeg] report dependencies (for now, helps debugging)

* [vcpkg-pkgconfig-get-modules] bump port version

* [ffmpeg] [vcpkg-pkgconfig-get-modules] x-add-version

* [ffmpeg] fix variant issue

* [ffmpeg] x-add-version

* [ffmpeg] reformat manifest

* [ffmpeg] x-add-version

* [ffmpeg] remove duplicate avfilter library from dependencies

* [ffmpeg] fix -pthread / -pthreads on linux

* [ffmpeg] x-add-version

* [ffmpeg] fix dynamic builds when no libraries need to be linked

* [ffmpeg] x-add-version

* [ffmpeg] disable openh264 on uwp when building all

* [ffmpeg] x-add-version

* [avcpp] fix uwp build failure due to deprecations treated as errors

* [avcpp] bump port version

* [avcpp] x-add-version

* [avcpp] smaller patch

* [avcpp] x-add-version

* [ffmpeg] x-add-version
This commit is contained in:
Matthias C. M. Troffaes 2021-06-09 23:25:20 +01:00 committed by GitHub
parent 17378cf96b
commit 1d6e1be7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 181 additions and 430 deletions

View File

@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5fed05..7875b91 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,11 @@ set (AVCPP_WARNING_OPTIONS
$<$<CXX_COMPILER_ID:MSVC>:
/W4>)
+# fixes vcpkg uwp failures due to /sdl
+if(MSVC)
+ add_compile_options(/wd4996)
+endif()
+
# -pthread sets also some useful compile-time flags
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)

View File

@ -9,6 +9,7 @@ vcpkg_from_github(
HEAD_REF master HEAD_REF master
PATCHES PATCHES
0001-remove-problematic-compound-literal.patch 0001-remove-problematic-compound-literal.patch
0002-av_init_packet_deprecation.patch
) )
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" AVCPP_ENABLE_STATIC) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" AVCPP_ENABLE_STATIC)

View File

@ -1,6 +1,7 @@
{ {
"name": "avcpp", "name": "avcpp",
"version-date": "2021-05-06", "version-date": "2021-05-06",
"port-version": 1,
"description": "Wrapper for the FFmpeg that simplify usage it from C++ projects.", "description": "Wrapper for the FFmpeg that simplify usage it from C++ projects.",
"homepage": "https://github.com/h4tr3d/avcpp", "homepage": "https://github.com/h4tr3d/avcpp",
"dependencies": [ "dependencies": [

View File

@ -39,309 +39,38 @@ if(SEARCH_PATH STREQUAL "/")
set(SEARCH_PATH "") set(SEARCH_PATH "")
endif() endif()
function(select_library_configurations_from_names)
cmake_parse_arguments(_slc "" "BASENAME" "NAMES;NAMES_RELEASE;NAMES_DEBUG" ${ARGN})
list(APPEND _slc_NAMES_RELEASE ${_slc_NAMES})
list(APPEND _slc_NAMES_DEBUG ${_slc_NAMES})
find_library(${_slc_BASENAME}_LIBRARY_RELEASE NAMES ${_slc_NAMES_RELEASE} PATHS ${SEARCH_PATH}/lib/ NO_DEFAULT_PATH)
find_library(${_slc_BASENAME}_LIBRARY_DEBUG NAMES ${_slc_NAMES_DEBUG} PATHS ${SEARCH_PATH}/debug/lib/ NO_DEFAULT_PATH)
select_library_configurations(${_slc_BASENAME})
set(${_slc_BASENAME}_LIBRARIES ${${_slc_BASENAME}_LIBRARIES} PARENT_SCOPE)
endfunction()
function(select_library_configurations_from_targets)
cmake_parse_arguments(_slc "" "BASENAME" "TARGETS" ${ARGN})
foreach(_target ${_slc_TARGETS})
get_target_property(_rel ${_target} IMPORTED_LOCATION_RELEASE)
get_target_property(_dbg ${_target} IMPORTED_LOCATION_DEBUG)
get_target_property(_deps ${_target} INTERFACE_LINK_LIBRARIES)
list(APPEND ${_slc_BASENAME}_LIBRARY_RELEASE ${_rel})
list(APPEND ${_slc_BASENAME}_LIBRARY_DEBUG ${_dbg})
foreach(_dep ${_deps})
if(TARGET ${_dep})
get_target_property(_dep_rel ${_dep} IMPORTED_LOCATION_RELEASE)
get_target_property(_dep_dbg ${_dep} IMPORTED_LOCATION_DEBUG)
if(_dep_rel MATCHES _dep_rel-NOTFOUND)
set(_dep_rel ${_dep_dbg})
elseif(_dep_dbg MATCHES _dep_dbg-NOTFOUND)
set(_dep_dbg ${_dep_rel})
endif()
list(APPEND ${_slc_BASENAME}_LIBRARY_RELEASE ${_dep_rel})
list(APPEND ${_slc_BASENAME}_LIBRARY_DEBUG ${_dep_dbg})
elseif(NOT ${_dep} MATCHES _deps-NOTFOUND)
if(${_dep} MATCHES ::)
#TODO Handle targets contained in cmake generator expressions
message(STATUS Unhandled dependency ${_slc_BASENAME}: ${_dep})
else()
list(APPEND ${_slc_BASENAME}_DEP_LIBRARIES ${_dep})
endif()
endif()
endforeach()
endforeach()
select_library_configurations(${_slc_BASENAME})
list(APPEND ${_slc_BASENAME}_LIBRARIES ${${_slc_BASENAME}_DEP_LIBRARIES})
set(${_slc_BASENAME}_LIBRARIES ${${_slc_BASENAME}_LIBRARIES} PARENT_SCOPE)
endfunction()
# for finding system libraries (e.g. Apple framework libraries)
function(find_platform_dependent_libraries)
cmake_parse_arguments(_fpd "" "" "NAMES" ${ARGN})
foreach(_name ${_fpd_NAMES})
find_library(${_name}_LIBRARY ${_name} REQUIRED)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${${_name}_LIBRARY})
endforeach()
set(FFMPEG_PLATFORM_DEPENDENT_LIBS ${FFMPEG_PLATFORM_DEPENDENT_LIBS} PARENT_SCOPE)
endfunction()
# for finding system libraries that may not always be available
function(find_platform_dependent_optional_libraries)
cmake_parse_arguments(_fpdo "" "" "NAMES" ${ARGN})
foreach(_name ${_fpdo_NAMES})
find_library(${_name}_LIBRARY ${_name})
if(NOT ${_name}_LIBRARY MATCHES ${_name}_LIBRARY-NOTFOUND)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${${_name}_LIBRARY})
endif()
endforeach()
set(FFMPEG_PLATFORM_DEPENDENT_LIBS ${FFMPEG_PLATFORM_DEPENDENT_LIBS} PARENT_SCOPE)
endfunction()
set(FFMPEG_VERSION "@FFMPEG_VERSION@") set(FFMPEG_VERSION "@FFMPEG_VERSION@")
find_dependency(Threads) function(append_dependencies out)
if(UNIX) cmake_parse_arguments(PARSE_ARGV 1 "arg" "DEBUG" "NAMES" "")
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS -pthread) if(${arg_DEBUG})
endif() set(config DEBUG)
set(path "${CURRENT_INSTALLED_DIR}/debug/lib/")
if(@ENABLE_ASS@) else()
select_library_configurations_from_names(BASENAME ASS NAMES ass libass) set(config RELEASE)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${ASS_LIBRARIES}) set(path "${CURRENT_INSTALLED_DIR}/lib/")
if(NOT @ENABLE_FREETYPE@) endif()
find_dependency(Freetype) foreach(lib_name ${arg_NAMES})
select_library_configurations_from_targets(BASENAME freetype TARGETS Freetype::Freetype) if("${lib_name}" STREQUAL "-pthread")
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${freetype_LIBRARIES}) list(APPEND ${out} "-pthread")
endif() elseif("${lib_name}" STREQUAL "-pthreads")
if(NOT @ENABLE_FRIBIDI@) list(APPEND ${out} "-pthreads")
select_library_configurations_from_names(BASENAME FRIBIDI NAMES fribidi libfribidi) elseif("${lib_name}" STREQUAL "gcc")
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${FRIBIDI_LIBRARIES}) list(APPEND ${out} "-lgcc")
endif() elseif("${lib_name}" STREQUAL "gcc_s")
select_library_configurations_from_names(BASENAME HARFBUZZ NAMES harfbuzz libharfbuzz) list(APPEND ${out} "-lgcc_s")
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${HARFBUZZ_LIBRARIES}) elseif("${lib_name}" STREQUAL "stdc++")
endif() list(APPEND ${out} "-lstdc++")
else()
if(@ENABLE_BZIP2@) # first look in ${path} specifically to ensure we find the right release/debug variant
find_dependency(BZip2) find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" PATHS "${path}" NO_DEFAULT_PATH)
select_library_configurations_from_targets(BASENAME BZip2 TARGETS BZip2::BZip2) # if not found there, must be a system dependency, so look elsewhere
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${BZip2_LIBRARIES}) find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" REQUIRED)
endif() list(APPEND ${out} "${FFMPEG_DEPENDENCY_${lib_name}_${config}}")
endif()
if(@ENABLE_DAV1D@) endforeach()
select_library_configurations_from_names(BASENAME DAV1D NAMES dav1d libdav1d) set("${out}" "${${out}}" PARENT_SCOPE)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${DAV1D_LIBRARIES}) endfunction()
if(UNIX)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS dl)
endif()
endif()
if(@ENABLE_ICONV@)
find_dependency(Iconv)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${Iconv_LIBRARIES})
endif()
if(@ENABLE_ILBC@)
select_library_configurations_from_names(BASENAME ILBC NAMES ilbc libilbc)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${ILBC_LIBRARIES})
endif()
if(@ENABLE_FDKAAC@)
select_library_configurations_from_names(BASENAME FDK NAMES fdk-aac libfdk-aac)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${FDK_LIBRARIES})
endif()
if(@ENABLE_FONTCONFIG@)
find_dependency(Fontconfig)
select_library_configurations_from_targets(BASENAME fontconfig TARGETS Fontconfig::Fontconfig)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${fontconfig_LIBRARIES})
endif()
if(@ENABLE_FREETYPE@)
find_dependency(Freetype)
select_library_configurations_from_targets(BASENAME freetype TARGETS Freetype::Freetype)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${freetype_LIBRARIES})
endif()
if(@ENABLE_FRIBIDI@)
select_library_configurations_from_names(BASENAME FRIBIDI NAMES fribidi libfribidi)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${FRIBIDI_LIBRARIES})
endif()
if(@ENABLE_LZMA@)
find_dependency(LibLZMA)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${LibLZMA_LIBRARIES})
endif()
if(@ENABLE_LAME@)
find_dependency(mp3lame)
select_library_configurations_from_targets(BASENAME mp3lame TARGETS mp3lame::mp3lame)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${mp3lame_LIBRARIES})
endif()
if(@ENABLE_MODPLUG@)
select_library_configurations_from_names(BASENAME MODPLUG NAMES modplug libmodplug)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${MODPLUG_LIBRARIES})
endif()
if(@ENABLE_NVCODEC@)
if(UNIX)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS dl)
endif()
endif()
if(@ENABLE_OPENCL@)
find_dependency(OpenCL)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${OpenCL_LIBRARIES})
endif()
if(@ENABLE_OPENGL@)
if(POLICY CMP0072)
cmake_policy (SET CMP0072 OLD)
endif(POLICY CMP0072)
find_dependency(OpenGL)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${OPENGL_LIBRARIES})
endif()
if(@ENABLE_OPENH264@)
select_library_configurations_from_names(BASENAME openh264 NAMES openh264)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${openh264_LIBRARIES})
endif()
if(@ENABLE_OPENJPEG@)
find_dependency(OpenJPEG)
select_library_configurations_from_targets(BASENAME openjpeg TARGETS openjp2)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${openjpeg_LIBRARIES})
endif()
if(@ENABLE_OPENSSL@)
find_dependency(OpenSSL)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${OPENSSL_LIBRARIES})
endif()
if(@ENABLE_OPUS@)
find_dependency(Opus)
select_library_configurations_from_targets(BASENAME Opus TARGETS Opus::opus)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${Opus_LIBRARIES})
endif()
if(@ENABLE_SDL2@)
find_dependency(SDL2)
if(TARGET SDL2::SDL2-static)
select_library_configurations_from_targets(BASENAME SDL2 TARGETS SDL2::SDL2-static)
else()
select_library_configurations_from_targets(BASENAME SDL2 TARGETS SDL2::SDL2)
endif()
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${SDL2_LIBRARIES})
endif()
if(@ENABLE_SNAPPY@)
find_dependency(Snappy)
select_library_configurations_from_targets(BASENAME Snappy TARGETS Snappy::snappy)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${Snappy_LIBRARIES})
endif()
if(@ENABLE_SOXR@)
select_library_configurations_from_names(BASENAME SOXR NAMES soxr)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${SOXR_LIBRARIES})
endif()
if(@ENABLE_SPEEX@)
if(WIN32)
select_library_configurations_from_names(BASENAME SPEEX NAMES_RELEASE libspeex NAMES_DEBUG libspeexd)
else()
select_library_configurations_from_names(BASENAME SPEEX NAMES speex libspeex)
endif()
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${SPEEX_LIBRARIES})
endif()
if(@ENABLE_SSH@)
find_dependency(libssh)
select_library_configurations_from_targets(BASENAME libssh TARGETS ssh)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${libssh_LIBRARIES})
endif()
if(@ENABLE_THEORA@)
find_dependency(Ogg) # ensure Ogg::ogg is defined as a target
find_dependency(unofficial-theora)
select_library_configurations_from_targets(BASENAME THEORA TARGETS unofficial::theora::theoraenc)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${THEORA_LIBRARIES})
endif()
if(@ENABLE_TESSERACT@)
find_dependency(Tesseract)
select_library_configurations_from_targets(BASENAME tesseract TARGETS libtesseract)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${tesseract_LIBRARIES})
endif()
if(@ENABLE_VORBIS@)
find_dependency(Vorbis)
select_library_configurations_from_targets(BASENAME vorbis TARGETS Vorbis::vorbis Vorbis::vorbisenc)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${vorbis_LIBRARIES})
endif()
if(@ENABLE_VPX@)
find_dependency(unofficial-libvpx)
select_library_configurations_from_targets(BASENAME libvpx TARGETS unofficial::libvpx::libvpx)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${libvpx_LIBRARIES})
endif()
if(@ENABLE_WEBP@)
find_dependency(WebP)
select_library_configurations_from_targets(BASENAME webp TARGETS WebP::webp WebP::webpdemux WebP::libwebpmux WebP::webpdecoder)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${webp_LIBRARIES})
endif()
if(@ENABLE_X264@)
select_library_configurations_from_names(BASENAME X264 NAMES x264 libx264)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${X264_LIBRARIES})
if(UNIX)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS dl)
endif()
endif()
if(@ENABLE_X265@)
select_library_configurations_from_names(BASENAME X265 NAMES x265 x265-static)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${X265_LIBRARIES})
if(UNIX)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS dl)
find_platform_dependent_optional_libraries(NAMES numa)
endif()
endif()
if(@ENABLE_XML2@)
find_dependency(LibXml2)
select_library_configurations_from_targets(BASENAME libxml2 TARGETS LibXml2::LibXml2)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${libxml2_LIBRARIES})
endif()
if(@ENABLE_ZLIB@)
find_dependency(ZLIB)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${ZLIB_LIBRARIES})
endif()
# Platform dependent libraries required by FFMPEG
if(UNIX AND NOT APPLE)
find_platform_dependent_optional_libraries(NAMES Xv X11 Xext)
find_platform_dependent_optional_libraries(NAMES va-drm va vdpau)
if(@ENABLE_AVDEVICE@)
find_platform_dependent_optional_libraries(NAMES xcb xcb-shm xcb-shape xcb-xfixes)
endif()
endif()
if(WIN32)
if(NOT CYGWIN)
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS wsock32 ws2_32 secur32 bcrypt strmiids Vfw32 Shlwapi mfplat mfuuid)
endif()
else()
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS m)
endif()
macro(FFMPEG_FIND varname shortname headername) macro(FFMPEG_FIND varname shortname headername)
if(NOT FFMPEG_${varname}_INCLUDE_DIRS) if(NOT FFMPEG_${varname}_INCLUDE_DIRS)
@ -363,25 +92,6 @@ macro(FFMPEG_FIND varname shortname headername)
endif() endif()
endmacro(FFMPEG_FIND) endmacro(FFMPEG_FIND)
if(APPLE)
find_platform_dependent_libraries(NAMES VideoToolbox CoreServices CoreMedia CoreVideo)
if(@ENABLE_OPENCL@)
find_platform_dependent_libraries(NAMES OpenCL)
endif()
if(@ENABLE_AVDEVICE@)
find_platform_dependent_libraries(NAMES AVFoundation CoreAudio CoreFoundation CoreGraphics Foundation)
endif()
if(@ENABLE_AVFILTER@)
find_platform_dependent_libraries(NAMES OpenGL AppKit CoreImage)
endif()
if(@ENABLE_AVFORMAT@)
find_platform_dependent_libraries(NAMES Security)
endif()
if(@ENABLE_AVCODEC@)
find_platform_dependent_libraries(NAMES AudioToolbox)
endif()
endif()
if(@ENABLE_AVDEVICE@) if(@ENABLE_AVDEVICE@)
FFMPEG_FIND(libavdevice avdevice avdevice.h) FFMPEG_FIND(libavdevice avdevice avdevice.h)
endif() endif()
@ -435,9 +145,12 @@ if (FFMPEG_libavutil_FOUND)
set(FFMPEG_libswscale_VERSION "@LIBSWSCALE_VERSION@" CACHE STRING "") set(FFMPEG_libswscale_VERSION "@LIBSWSCALE_VERSION@" CACHE STRING "")
endif() endif()
list(APPEND FFMPEG_LIBRARIES append_dependencies(FFMPEG_DEPS_LIBRARY_RELEASE NAMES "@FFMPEG_DEPENDENCIES_RELEASE@")
${FFMPEG_PLATFORM_DEPENDENT_LIBS} append_dependencies(FFMPEG_DEPS_LIBRARY_DEBUG NAMES "@FFMPEG_DEPENDENCIES_DEBUG@" DEBUG)
) if(FFMPEG_DEPS_LIBRARY_RELEASE OR FFMPEG_DEPS_LIBRARY_DEBUG)
select_library_configurations(FFMPEG_DEPS)
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_DEPS_LIBRARY})
endif()
set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES}) set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES})

View File

@ -103,6 +103,8 @@ set(_csc_PROJECT_PATH ffmpeg)
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
set(FFMPEG_PKGCONFIG_MODULES libavutil)
if("nonfree" IN_LIST FEATURES) if("nonfree" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-nonfree") set(OPTIONS "${OPTIONS} --enable-nonfree")
endif() endif()
@ -136,6 +138,7 @@ endif()
if("avcodec" IN_LIST FEATURES) if("avcodec" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avcodec") set(OPTIONS "${OPTIONS} --enable-avcodec")
set(ENABLE_AVCODEC ON) set(ENABLE_AVCODEC ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavcodec)
else() else()
set(OPTIONS "${OPTIONS} --disable-avcodec") set(OPTIONS "${OPTIONS} --disable-avcodec")
set(ENABLE_AVCODEC OFF) set(ENABLE_AVCODEC OFF)
@ -144,6 +147,7 @@ endif()
if("avdevice" IN_LIST FEATURES) if("avdevice" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avdevice") set(OPTIONS "${OPTIONS} --enable-avdevice")
set(ENABLE_AVDEVICE ON) set(ENABLE_AVDEVICE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavdevice)
else() else()
set(OPTIONS "${OPTIONS} --disable-avdevice") set(OPTIONS "${OPTIONS} --disable-avdevice")
set(ENABLE_AVDEVICE OFF) set(ENABLE_AVDEVICE OFF)
@ -152,6 +156,7 @@ endif()
if("avformat" IN_LIST FEATURES) if("avformat" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avformat") set(OPTIONS "${OPTIONS} --enable-avformat")
set(ENABLE_AVFORMAT ON) set(ENABLE_AVFORMAT ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavformat)
else() else()
set(OPTIONS "${OPTIONS} --disable-avformat") set(OPTIONS "${OPTIONS} --disable-avformat")
set(ENABLE_AVFORMAT OFF) set(ENABLE_AVFORMAT OFF)
@ -160,6 +165,7 @@ endif()
if("avfilter" IN_LIST FEATURES) if("avfilter" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avfilter") set(OPTIONS "${OPTIONS} --enable-avfilter")
set(ENABLE_AVFILTER ON) set(ENABLE_AVFILTER ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavfilter)
else() else()
set(OPTIONS "${OPTIONS} --disable-avfilter") set(OPTIONS "${OPTIONS} --disable-avfilter")
set(ENABLE_AVFILTER OFF) set(ENABLE_AVFILTER OFF)
@ -168,6 +174,7 @@ endif()
if("postproc" IN_LIST FEATURES) if("postproc" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-postproc") set(OPTIONS "${OPTIONS} --enable-postproc")
set(ENABLE_POSTPROC ON) set(ENABLE_POSTPROC ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libpostproc)
else() else()
set(OPTIONS "${OPTIONS} --disable-postproc") set(OPTIONS "${OPTIONS} --disable-postproc")
set(ENABLE_POSTPROC OFF) set(ENABLE_POSTPROC OFF)
@ -176,6 +183,7 @@ endif()
if("swresample" IN_LIST FEATURES) if("swresample" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-swresample") set(OPTIONS "${OPTIONS} --enable-swresample")
set(ENABLE_SWRESAMPLE ON) set(ENABLE_SWRESAMPLE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libswresample)
else() else()
set(OPTIONS "${OPTIONS} --disable-swresample") set(OPTIONS "${OPTIONS} --disable-swresample")
set(ENABLE_SWRESAMPLE OFF) set(ENABLE_SWRESAMPLE OFF)
@ -184,6 +192,7 @@ endif()
if("swscale" IN_LIST FEATURES) if("swscale" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-swscale") set(OPTIONS "${OPTIONS} --enable-swscale")
set(ENABLE_SWSCALE ON) set(ENABLE_SWSCALE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libswscale)
else() else()
set(OPTIONS "${OPTIONS} --disable-swscale") set(OPTIONS "${OPTIONS} --disable-swscale")
set(ENABLE_SWSCALE OFF) set(ENABLE_SWSCALE OFF)
@ -193,6 +202,7 @@ set(ENABLE_AVRESAMPLE OFF)
if("avresample" IN_LIST FEATURES) if("avresample" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avresample") set(OPTIONS "${OPTIONS} --enable-avresample")
set(ENABLE_AVRESAMPLE ON) set(ENABLE_AVRESAMPLE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavresample)
endif() endif()
set(STATIC_LINKAGE OFF) set(STATIC_LINKAGE OFF)
@ -200,10 +210,8 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(STATIC_LINKAGE ON) set(STATIC_LINKAGE ON)
endif() endif()
set(ENABLE_ASS OFF)
if("ass" IN_LIST FEATURES) if("ass" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libass") set(OPTIONS "${OPTIONS} --enable-libass")
set(ENABLE_ASS ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libass") set(OPTIONS "${OPTIONS} --disable-libass")
endif() endif()
@ -214,267 +222,201 @@ else()
set(OPTIONS "${OPTIONS} --disable-avisynth") set(OPTIONS "${OPTIONS} --disable-avisynth")
endif() endif()
set(ENABLE_BZIP2 OFF)
if("bzip2" IN_LIST FEATURES) if("bzip2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-bzlib") set(OPTIONS "${OPTIONS} --enable-bzlib")
set(ENABLE_BZIP2 ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-bzlib") set(OPTIONS "${OPTIONS} --disable-bzlib")
endif() endif()
set(ENABLE_DAV1D OFF)
if("dav1d" IN_LIST FEATURES) if("dav1d" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libdav1d") set(OPTIONS "${OPTIONS} --enable-libdav1d")
set(ENABLE_DAV1D ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libdav1d") set(OPTIONS "${OPTIONS} --disable-libdav1d")
endif() endif()
set(ENABLE_ICONV OFF)
if("iconv" IN_LIST FEATURES) if("iconv" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-iconv") set(OPTIONS "${OPTIONS} --enable-iconv")
set(ENABLE_ICONV ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-iconv") set(OPTIONS "${OPTIONS} --disable-iconv")
endif() endif()
set(ENABLE_ILBC OFF)
if("ilbc" IN_LIST FEATURES) if("ilbc" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libilbc") set(OPTIONS "${OPTIONS} --enable-libilbc")
set(ENABLE_ILBC ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libilbc") set(OPTIONS "${OPTIONS} --disable-libilbc")
endif() endif()
set(ENABLE_FDKAAC OFF)
if("fdk-aac" IN_LIST FEATURES) if("fdk-aac" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfdk-aac") set(OPTIONS "${OPTIONS} --enable-libfdk-aac")
set(ENABLE_FDKAAC ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libfdk-aac") set(OPTIONS "${OPTIONS} --disable-libfdk-aac")
endif() endif()
set(ENABLE_FONTCONFIG OFF)
if("fontconfig" IN_LIST FEATURES) if("fontconfig" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfontconfig") set(OPTIONS "${OPTIONS} --enable-libfontconfig")
set(ENABLE_FONTCONFIG ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libfontconfig") set(OPTIONS "${OPTIONS} --disable-libfontconfig")
endif() endif()
set(ENABLE_FREETYPE OFF)
if("freetype" IN_LIST FEATURES) if("freetype" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfreetype") set(OPTIONS "${OPTIONS} --enable-libfreetype")
set(ENABLE_FREETYPE ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libfreetype") set(OPTIONS "${OPTIONS} --disable-libfreetype")
endif() endif()
set(ENABLE_FRIBIDI OFF)
if("fribidi" IN_LIST FEATURES) if("fribidi" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfribidi") set(OPTIONS "${OPTIONS} --enable-libfribidi")
set(ENABLE_FRIBIDI ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libfribidi") set(OPTIONS "${OPTIONS} --disable-libfribidi")
endif() endif()
set(ENABLE_LZMA OFF)
if("lzma" IN_LIST FEATURES) if("lzma" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-lzma") set(OPTIONS "${OPTIONS} --enable-lzma")
set(ENABLE_LZMA ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-lzma") set(OPTIONS "${OPTIONS} --disable-lzma")
endif() endif()
set(ENABLE_LAME OFF)
if("mp3lame" IN_LIST FEATURES) if("mp3lame" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libmp3lame") set(OPTIONS "${OPTIONS} --enable-libmp3lame")
set(ENABLE_LAME ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libmp3lame") set(OPTIONS "${OPTIONS} --disable-libmp3lame")
endif() endif()
set(ENABLE_MODPLUG OFF)
if("modplug" IN_LIST FEATURES) if("modplug" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libmodplug") set(OPTIONS "${OPTIONS} --enable-libmodplug")
set(ENABLE_MODPLUG ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libmodplug") set(OPTIONS "${OPTIONS} --disable-libmodplug")
endif() endif()
set(ENABLE_NVCODEC OFF)
if("nvcodec" IN_LIST FEATURES) if("nvcodec" IN_LIST FEATURES)
#Note: the --enable-cuda option does not actually require the cuda sdk or toolset port dependency as ffmpeg uses runtime detection and dynamic loading #Note: the --enable-cuda option does not actually require the cuda sdk or toolset port dependency as ffmpeg uses runtime detection and dynamic loading
set(ENABLE_NVCODEC ON)
set(OPTIONS "${OPTIONS} --enable-cuda --enable-nvenc --enable-nvdec --enable-cuvid --enable-ffnvcodec") set(OPTIONS "${OPTIONS} --enable-cuda --enable-nvenc --enable-nvdec --enable-cuvid --enable-ffnvcodec")
else() else()
set(OPTIONS "${OPTIONS} --disable-cuda --disable-nvenc --disable-nvdec --disable-cuvid --disable-ffnvcodec") set(OPTIONS "${OPTIONS} --disable-cuda --disable-nvenc --disable-nvdec --disable-cuvid --disable-ffnvcodec")
endif() endif()
set(ENABLE_OPENCL OFF)
if("opencl" IN_LIST FEATURES) if("opencl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-opencl") set(OPTIONS "${OPTIONS} --enable-opencl")
set(ENABLE_OPENCL ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-opencl") set(OPTIONS "${OPTIONS} --disable-opencl")
endif() endif()
set(ENABLE_OPENGL OFF)
if("opengl" IN_LIST FEATURES) if("opengl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-opengl") set(OPTIONS "${OPTIONS} --enable-opengl")
set(ENABLE_OPENGL ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-opengl") set(OPTIONS "${OPTIONS} --disable-opengl")
endif() endif()
set(ENABLE_OPENH264 OFF)
if("openh264" IN_LIST FEATURES) if("openh264" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopenh264") set(OPTIONS "${OPTIONS} --enable-libopenh264")
set(ENABLE_OPENH264 ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libopenh264") set(OPTIONS "${OPTIONS} --disable-libopenh264")
endif() endif()
set(ENABLE_OPENJPEG OFF)
if("openjpeg" IN_LIST FEATURES) if("openjpeg" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopenjpeg") set(OPTIONS "${OPTIONS} --enable-libopenjpeg")
set(ENABLE_OPENJPEG ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libopenjpeg") set(OPTIONS "${OPTIONS} --disable-libopenjpeg")
endif() endif()
set(ENABLE_OPENSSL OFF)
if("openssl" IN_LIST FEATURES) if("openssl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-openssl") set(OPTIONS "${OPTIONS} --enable-openssl")
set(ENABLE_OPENSSL ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-openssl") set(OPTIONS "${OPTIONS} --disable-openssl")
endif() endif()
set(ENABLE_OPUS OFF)
if("opus" IN_LIST FEATURES) if("opus" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopus") set(OPTIONS "${OPTIONS} --enable-libopus")
set(ENABLE_OPUS ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libopus") set(OPTIONS "${OPTIONS} --disable-libopus")
endif() endif()
set(ENABLE_SDL2 OFF)
if("sdl2" IN_LIST FEATURES) if("sdl2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-sdl2") set(OPTIONS "${OPTIONS} --enable-sdl2")
set(ENABLE_SDL2 ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-sdl2") set(OPTIONS "${OPTIONS} --disable-sdl2")
endif() endif()
set(ENABLE_SNAPPY OFF)
if("snappy" IN_LIST FEATURES) if("snappy" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libsnappy") set(OPTIONS "${OPTIONS} --enable-libsnappy")
set(ENABLE_SNAPPY ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libsnappy") set(OPTIONS "${OPTIONS} --disable-libsnappy")
endif() endif()
set(ENABLE_SOXR OFF)
if("soxr" IN_LIST FEATURES) if("soxr" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libsoxr") set(OPTIONS "${OPTIONS} --enable-libsoxr")
set(ENABLE_SOXR ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libsoxr") set(OPTIONS "${OPTIONS} --disable-libsoxr")
endif() endif()
set(ENABLE_SPEEX OFF)
if("speex" IN_LIST FEATURES) if("speex" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libspeex") set(OPTIONS "${OPTIONS} --enable-libspeex")
set(ENABLE_SPEEX ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libspeex") set(OPTIONS "${OPTIONS} --disable-libspeex")
endif() endif()
set(ENABLE_SSH OFF)
if("ssh" IN_LIST FEATURES) if("ssh" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libssh") set(OPTIONS "${OPTIONS} --enable-libssh")
set(ENABLE_SSH ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libssh") set(OPTIONS "${OPTIONS} --disable-libssh")
endif() endif()
set(ENABLE_TENSORFLOW OFF)
if("tensorflow" IN_LIST FEATURES) if("tensorflow" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtensorflow") set(OPTIONS "${OPTIONS} --enable-libtensorflow")
set(ENABLE_TENSORFLOW ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libtensorflow") set(OPTIONS "${OPTIONS} --disable-libtensorflow")
endif() endif()
set(ENABLE_TESSERACT OFF)
if("tesseract" IN_LIST FEATURES) if("tesseract" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtesseract") set(OPTIONS "${OPTIONS} --enable-libtesseract")
set(ENABLE_TESSERACT ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libtesseract") set(OPTIONS "${OPTIONS} --disable-libtesseract")
endif() endif()
set(ENABLE_THEORA OFF)
if("theora" IN_LIST FEATURES) if("theora" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtheora") set(OPTIONS "${OPTIONS} --enable-libtheora")
set(ENABLE_THEORA ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libtheora") set(OPTIONS "${OPTIONS} --disable-libtheora")
endif() endif()
set(ENABLE_VORBIS OFF)
if("vorbis" IN_LIST FEATURES) if("vorbis" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libvorbis") set(OPTIONS "${OPTIONS} --enable-libvorbis")
set(ENABLE_VORBIS ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libvorbis") set(OPTIONS "${OPTIONS} --disable-libvorbis")
endif() endif()
set(ENABLE_VPX OFF)
if("vpx" IN_LIST FEATURES) if("vpx" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libvpx") set(OPTIONS "${OPTIONS} --enable-libvpx")
set(ENABLE_VPX ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libvpx") set(OPTIONS "${OPTIONS} --disable-libvpx")
endif() endif()
set(ENABLE_WEBP OFF)
if("webp" IN_LIST FEATURES) if("webp" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libwebp") set(OPTIONS "${OPTIONS} --enable-libwebp")
set(ENABLE_WEBP ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libwebp") set(OPTIONS "${OPTIONS} --disable-libwebp")
endif() endif()
set(ENABLE_X264 OFF)
if("x264" IN_LIST FEATURES) if("x264" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libx264") set(OPTIONS "${OPTIONS} --enable-libx264")
set(ENABLE_X264 ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libx264") set(OPTIONS "${OPTIONS} --disable-libx264")
endif() endif()
set(ENABLE_X265 OFF)
if("x265" IN_LIST FEATURES) if("x265" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libx265") set(OPTIONS "${OPTIONS} --enable-libx265")
set(ENABLE_X265 ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libx265") set(OPTIONS "${OPTIONS} --disable-libx265")
endif() endif()
set(ENABLE_XML2 OFF)
if("xml2" IN_LIST FEATURES) if("xml2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libxml2") set(OPTIONS "${OPTIONS} --enable-libxml2")
set(ENABLE_XML2 ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-libxml2") set(OPTIONS "${OPTIONS} --disable-libxml2")
endif() endif()
set(ENABLE_ZLIB OFF)
if("zlib" IN_LIST FEATURES) if("zlib" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-zlib") set(OPTIONS "${OPTIONS} --enable-zlib")
set(ENABLE_ZLIB ${STATIC_LINKAGE})
else() else()
set(OPTIONS "${OPTIONS} --disable-zlib") set(OPTIONS "${OPTIONS} --disable-zlib")
endif() endif()
@ -649,47 +591,97 @@ endif()
vcpkg_copy_pdbs() vcpkg_copy_pdbs()
if (VCPKG_TARGET_IS_WINDOWS) if (VCPKG_TARGET_IS_WINDOWS)
# Translate cygpath to local path foreach(_debug "" "/debug")
set(CYGPATH_CMD "${MSYS_ROOT}/usr/bin/cygpath.exe" -w) foreach(PKGCONFIG_MODULE IN LISTS FFMPEG_PKGCONFIG_MODULES)
set(PKGCONFIG_FILE "${CURRENT_PACKAGES_DIR}${_debug}/lib/pkgconfig/${PKGCONFIG_MODULE}.pc")
foreach(PKGCONFIG_PATH "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") # remove redundant cygwin style -libpath entries
file(GLOB PKGCONFIG_FILES "${PKGCONFIG_PATH}/*.pc") execute_process(
foreach(PKGCONFIG_FILE IN LISTS PKGCONFIG_FILES) COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -u "${CURRENT_INSTALLED_DIR}"
OUTPUT_VARIABLE CYG_INSTALLED_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
vcpkg_replace_string("${PKGCONFIG_FILE}" "-libpath:${CYG_INSTALLED_DIR}${_debug}/lib/pkgconfig/../../lib " "")
# transform libdir, includedir, and prefix paths from cygwin style to windows style
file(READ "${PKGCONFIG_FILE}" PKGCONFIG_CONTENT) file(READ "${PKGCONFIG_FILE}" PKGCONFIG_CONTENT)
foreach(PATH_NAME prefix libdir includedir) foreach(PATH_NAME prefix libdir includedir)
string(REGEX MATCH "${PATH_NAME}=[^\n]*\n" PATH_VALUE "${PKGCONFIG_CONTENT}") string(REGEX MATCH "${PATH_NAME}=[^\n]*" PATH_VALUE "${PKGCONFIG_CONTENT}")
string(REPLACE "${PATH_NAME}=" "" PATH_VALUE "${PATH_VALUE}") string(REPLACE "${PATH_NAME}=" "" PATH_VALUE "${PATH_VALUE}")
string(REPLACE "\n" "" PATH_VALUE "${PATH_VALUE}") if(NOT PATH_VALUE)
set("${PATH_NAME}_cygpath" "${PATH_VALUE}") message(FATAL_ERROR "failed to find pkgconfig variable ${PATH_NAME}")
endif()
execute_process(
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -w "${PATH_VALUE}"
OUTPUT_VARIABLE FIXED_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
file(TO_CMAKE_PATH "${FIXED_PATH}" FIXED_PATH)
vcpkg_replace_string("${PKGCONFIG_FILE}" "${PATH_NAME}=${PATH_VALUE}" "${PATH_NAME}=${FIXED_PATH}")
endforeach()
# list libraries with -l flag (so pkgconf knows they are libraries and not just linker flags)
foreach(LIBS_ENTRY Libs Libs.private)
string(REGEX MATCH "${LIBS_ENTRY}: [^\n]*" LIBS_VALUE "${PKGCONFIG_CONTENT}")
if(NOT LIBS_VALUE)
message(FATAL_ERROR "failed to find pkgconfig entry ${LIBS_ENTRY}")
endif()
string(REPLACE "${LIBS_ENTRY}: " "" LIBS_VALUE "${LIBS_VALUE}")
if(LIBS_VALUE)
set(LIBS_VALUE_OLD "${LIBS_VALUE}")
string(REGEX REPLACE "([^ ]+)[.]lib" "-l\\1" LIBS_VALUE "${LIBS_VALUE}")
set(LIBS_VALUE_NEW "${LIBS_VALUE}")
vcpkg_replace_string("${PKGCONFIG_FILE}" "${LIBS_ENTRY}: ${LIBS_VALUE_OLD}" "${LIBS_ENTRY}: ${LIBS_VALUE_NEW}")
endif()
endforeach() endforeach()
execute_process(
COMMAND ${CYGPATH_CMD} "${prefix_cygpath}"
OUTPUT_VARIABLE FIXED_PREFIX_PATH
)
string(REPLACE "\n" "" FIXED_PREFIX_PATH "${FIXED_PREFIX_PATH}")
file(TO_CMAKE_PATH "${FIXED_PREFIX_PATH}" FIXED_PREFIX_PATH)
execute_process(
COMMAND ${CYGPATH_CMD} "${libdir_cygpath}"
OUTPUT_VARIABLE FIXED_LIBDIR_PATH
)
string(REPLACE "\n" "" FIXED_LIBDIR_PATH ${FIXED_LIBDIR_PATH})
file(TO_CMAKE_PATH ${FIXED_LIBDIR_PATH} FIXED_LIBDIR_PATH)
execute_process(
COMMAND ${CYGPATH_CMD} "${includedir_cygpath}"
OUTPUT_VARIABLE FIXED_INCLUDE_PATH
)
string(REPLACE "\n" "" FIXED_INCLUDE_PATH "${FIXED_INCLUDE_PATH}")
file(TO_CMAKE_PATH ${FIXED_INCLUDE_PATH} FIXED_INCLUDE_PATH)
vcpkg_replace_string("${PKGCONFIG_FILE}" "${prefix_cygpath}" "${FIXED_PREFIX_PATH}")
vcpkg_replace_string("${PKGCONFIG_FILE}" "${libdir_cygpath}" "${FIXED_LIBDIR_PATH}")
vcpkg_replace_string("${PKGCONFIG_FILE}" "${includedir_cygpath}" "${FIXED_INCLUDE_PATH}")
endforeach() endforeach()
endforeach() endforeach()
endif() endif()
vcpkg_fixup_pkgconfig() vcpkg_fixup_pkgconfig()
# Handle dependencies
x_vcpkg_pkgconfig_get_modules(PREFIX FFMPEG_PKGCONFIG MODULES ${FFMPEG_PKGCONFIG_MODULES} LIBS)
function(append_dependencies_from_libs out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "LIBS" "")
string(REGEX REPLACE "[ ]+" ";" contents "${arg_LIBS}")
list(FILTER contents EXCLUDE REGEX "^-framework$")
list(FILTER contents EXCLUDE REGEX "^-L.+")
list(FILTER contents EXCLUDE REGEX "^-libpath:.+")
list(TRANSFORM contents REPLACE "^-Wl,-framework," "-l")
list(FILTER contents EXCLUDE REGEX "^-Wl,.+")
list(TRANSFORM contents REPLACE "^-l" "")
list(FILTER contents EXCLUDE REGEX "^avresample$")
list(FILTER contents EXCLUDE REGEX "^avutil$")
list(FILTER contents EXCLUDE REGEX "^avcodec$")
list(FILTER contents EXCLUDE REGEX "^avdevice$")
list(FILTER contents EXCLUDE REGEX "^avfilter$")
list(FILTER contents EXCLUDE REGEX "^avformat$")
list(FILTER contents EXCLUDE REGEX "^postproc$")
list(FILTER contents EXCLUDE REGEX "^swresample$")
list(FILTER contents EXCLUDE REGEX "^swscale$")
if(VCPKG_TARGET_IS_WINDOWS)
list(TRANSFORM contents TOLOWER)
endif()
if(contents)
list(APPEND "${out}" "${contents}")
set("${out}" "${${out}}" PARENT_SCOPE)
endif()
endfunction()
append_dependencies_from_libs(FFMPEG_DEPENDENCIES_RELEASE LIBS "${FFMPEG_PKGCONFIG_LIBS_RELEASE}")
append_dependencies_from_libs(FFMPEG_DEPENDENCIES_DEBUG LIBS "${FFMPEG_PKGCONFIG_LIBS_DEBUG}")
# must remove duplicates from the front to respect link order so reverse first
list(REVERSE FFMPEG_DEPENDENCIES_RELEASE)
list(REVERSE FFMPEG_DEPENDENCIES_DEBUG)
list(REMOVE_DUPLICATES FFMPEG_DEPENDENCIES_RELEASE)
list(REMOVE_DUPLICATES FFMPEG_DEPENDENCIES_DEBUG)
list(REVERSE FFMPEG_DEPENDENCIES_RELEASE)
list(REVERSE FFMPEG_DEPENDENCIES_DEBUG)
message("Dependencies (release): ${FFMPEG_DEPENDENCIES_RELEASE}")
message("Dependencies (debug): ${FFMPEG_DEPENDENCIES_DEBUG}")
# Handle version strings # Handle version strings
function(extract_regex_from_file out) function(extract_regex_from_file out)

View File

@ -1,12 +1,18 @@
{ {
"name": "ffmpeg", "name": "ffmpeg",
"version": "4.4", "version": "4.4",
"port-version": 2, "port-version": 3,
"description": [ "description": [
"a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.", "a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.",
"FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations." "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations."
], ],
"homepage": "https://ffmpeg.org", "homepage": "https://ffmpeg.org",
"dependencies": [
{
"name": "vcpkg-pkgconfig-get-modules",
"host": true
}
],
"default-features": [ "default-features": [
"avcodec", "avcodec",
"avdevice", "avdevice",
@ -29,7 +35,6 @@
"iconv", "iconv",
"lzma", "lzma",
"mp3lame", "mp3lame",
"openh264",
"openjpeg", "openjpeg",
"opus", "opus",
"snappy", "snappy",
@ -56,6 +61,13 @@
], ],
"platform": "!uwp" "platform": "!uwp"
}, },
{
"name": "ffmpeg",
"features": [
"openh264"
],
"platform": "!uwp"
},
{ {
"name": "ffmpeg", "name": "ffmpeg",
"features": [ "features": [

View File

@ -1,4 +1,5 @@
{ {
"name": "vcpkg-pkgconfig-get-modules", "name": "vcpkg-pkgconfig-get-modules",
"version-date": "2021-04-02" "version-date": "2021-04-02",
"port-version": 1
} }

View File

@ -61,7 +61,7 @@ function(x_vcpkg_pkgconfig_get_modules)
set(var_suffixes) set(var_suffixes)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}") z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/lib/pkgconfig${VCPKG_HOST_PATH_SEPARATOR}${CURRENT_PACKAGES_DIR}/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}")
if(arg_LIBS) if(arg_LIBS)
execute_process( execute_process(
COMMAND "${PKGCONFIG}" --libs ${arg_MODULES} COMMAND "${PKGCONFIG}" --libs ${arg_MODULES}
@ -96,7 +96,7 @@ function(x_vcpkg_pkgconfig_get_modules)
endif() endif()
endif() endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}") z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig${VCPKG_HOST_PATH_SEPARATOR}${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}")
if(arg_LIBS) if(arg_LIBS)
execute_process( execute_process(
COMMAND "${PKGCONFIG}" --libs ${arg_MODULES} COMMAND "${PKGCONFIG}" --libs ${arg_MODULES}

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "102cfc337c2a08e57246c399812a540315ae4531",
"version-date": "2021-05-06",
"port-version": 1
},
{ {
"git-tree": "aa82b322b6c59cf758147d78664f3d7ce66a77dc", "git-tree": "aa82b322b6c59cf758147d78664f3d7ce66a77dc",
"version-date": "2021-05-06", "version-date": "2021-05-06",

View File

@ -218,7 +218,7 @@
}, },
"avcpp": { "avcpp": {
"baseline": "2021-05-06", "baseline": "2021-05-06",
"port-version": 0 "port-version": 1
}, },
"avisynthplus": { "avisynthplus": {
"baseline": "3.7.0", "baseline": "3.7.0",
@ -1978,7 +1978,7 @@
}, },
"ffmpeg": { "ffmpeg": {
"baseline": "4.4", "baseline": "4.4",
"port-version": 2 "port-version": 3
}, },
"ffnvcodec": { "ffnvcodec": {
"baseline": "10.0.26.0", "baseline": "10.0.26.0",
@ -6498,7 +6498,7 @@
}, },
"vcpkg-pkgconfig-get-modules": { "vcpkg-pkgconfig-get-modules": {
"baseline": "2021-04-02", "baseline": "2021-04-02",
"port-version": 0 "port-version": 1
}, },
"vectorclass": { "vectorclass": {
"baseline": "2.00.01", "baseline": "2.00.01",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "90a0309bd2757ee32bb13e47e07fa7b8405e6594",
"version": "4.4",
"port-version": 3
},
{ {
"git-tree": "998009397c4df3ca2b7d2451c9ec43c817fdc6c7", "git-tree": "998009397c4df3ca2b7d2451c9ec43c817fdc6c7",
"version": "4.4", "version": "4.4",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "558512de1cc52fd9e246d6e7b99575418dd8500f",
"version-date": "2021-04-02",
"port-version": 1
},
{ {
"git-tree": "827541895526ebcd68711de9d05e98acd09bd323", "git-tree": "827541895526ebcd68711de9d05e98acd09bd323",
"version-date": "2021-04-02", "version-date": "2021-04-02",