mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 03:34:26 +08:00
[ffmpeg] fix linking with iconv feature (#13481)
* [ffmpeg] fix linking with iconv feature * [ffmpeg] use official iconv cmake target (broken for now, needs fix in libiconv, see #11776) * [ffmpeg] fix typo in theora configuration * [ffmpeg] switch to $<NOT:$<CONFIG:Debug>> for selecting release libraries * [ffmpeg] use find_dependency(Iconv) on macos to better handle downstream REQUIRED * Bump port version. * [ffmpeg] remove iconv dependency on mac when it's not needed Patch originally provided by @cenit
This commit is contained in:
parent
d548c67744
commit
9ac48a6c49
@ -43,108 +43,106 @@ 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}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${BZip2_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${BZip2_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_ICONV@)
|
||||
find_dependency(unofficial-iconv)
|
||||
get_target_property(ICONV_LIBRARY_RELEASE unofficial::iconv::libiconv IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(ICONV_LIBRARY_DEBUG unofficial::iconv::libiconv IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${ICONV_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${ICONV_LIBRARY_RELEASE}>")
|
||||
find_dependency(Iconv)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${Iconv_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(@ENABLE_FDKAAC@)
|
||||
find_library(FDK_LIBRARY_RELEASE NAMES fdk-aac libfdk-aac PATHS ${_IMPORT_PREFIX}/lib/ NO_DEFAULT_PATH)
|
||||
find_library(FDK_LIBRARY_DEBUG NAMES fdk-aac libfdk-aac PATHS ${_IMPORT_PREFIX}/debug/lib/ NO_DEFAULT_PATH)
|
||||
select_library_configurations(FDK)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${FDK_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${FDK_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${FDK_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${FDK_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}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LibLZMA_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${LibLZMA_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_LAME@)
|
||||
find_dependency(mp3lame)
|
||||
get_target_property(LAME_LIBRARY_RELEASE mp3lame::mp3lame IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(LAME_LIBRARY_DEBUG mp3lame::mp3lame IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LAME_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${LAME_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LAME_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${LAME_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_OPENCL@)
|
||||
find_dependency(OpenCL)
|
||||
get_target_property(OPENCL_LIBRARY_RELEASE OpenCL::OpenCL IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(OPENCL_LIBRARY_DEBUG OpenCL::OpenCL IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${OPENCL_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${OPENCL_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${OPENCL_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${OPENCL_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_OPENSSL@)
|
||||
find_dependency(OpenSSL)
|
||||
get_target_property(LIBSSL_LIBRARY_RELEASE OpenSSL::SSL IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(LIBSSL_LIBRARY_DEBUG OpenSSL::SSL IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LIBSSL_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${LIBSSL_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LIBSSL_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${LIBSSL_LIBRARY_RELEASE}>")
|
||||
get_target_property(LIBCRYPTO_LIBRARY_RELEASE OpenSSL::Crypto IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(LIBCRYPTO_LIBRARY_DEBUG OpenSSL::Crypto IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LIBCRYPTO_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${LIBCRYPTO_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LIBCRYPTO_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${LIBCRYPTO_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_OPUS@)
|
||||
find_dependency(Opus)
|
||||
get_target_property(OPUS_LIBRARY_RELEASE Opus::opus IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(OPUS_LIBRARY_DEBUG Opus::opus IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${OPUS_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${OPUS_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${OPUS_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${OPUS_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_SDL2@)
|
||||
find_dependency(SDL2)
|
||||
get_target_property(SDL2_LIBRARY_RELEASE SDL2::SDL2 IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(SDL2_LIBRARY_DEBUG SDL2::SDL2 IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${SDL2_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${SDL2_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${SDL2_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${SDL2_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_SNAPPY@)
|
||||
find_dependency(Snappy)
|
||||
get_target_property(SNAPPY_LIBRARY_RELEASE Snappy::snappy IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(SNAPPY_LIBRARY_DEBUG Snappy::snappy IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${SNAPPY_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${SNAPPY_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${SNAPPY_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${SNAPPY_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_SOXR@)
|
||||
find_library(SOXR_LIBRARY_RELEASE NAMES soxr PATHS ${_IMPORT_PREFIX}/lib/ NO_DEFAULT_PATH)
|
||||
find_library(SOXR_LIBRARY_DEBUG NAMES soxr PATHS ${_IMPORT_PREFIX}/debug/lib/ NO_DEFAULT_PATH)
|
||||
select_library_configurations(SOXR)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${SOXR_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${SOXR_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${SOXR_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${SOXR_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_SPEEX@)
|
||||
find_library(SPEEX_LIBRARY_RELEASE NAMES speex libspeex PATHS ${_IMPORT_PREFIX}/lib/ NO_DEFAULT_PATH)
|
||||
find_library(SPEEX_LIBRARY_DEBUG NAMES speex libspeex PATHS ${_IMPORT_PREFIX}/debug/lib/ NO_DEFAULT_PATH)
|
||||
select_library_configurations(SPEEX)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${SPEEX_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${SPEEX_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${SPEEX_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${SPEEX_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_THEORA@)
|
||||
find_library(THEORA_LIBRARY_RELEASE NAMES theora PATHS ${_IMPORT_PREFIX}/lib/ NO_DEFAULT_PATH)
|
||||
find_library(THEORA_LIBRARY_DEBUG NAMES theora PATHS ${_IMPORT_PREFIX}/debug/lib/ NO_DEFAULT_PATH)
|
||||
select_library_configurations(SPEEX)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${THEORA_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${THEORA_LIBRARY_RELEASE}>")
|
||||
select_library_configurations(THEORA)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${THEORA_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${THEORA_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_VORBIS@)
|
||||
find_dependency(Vorbis)
|
||||
get_target_property(VORBIS_LIBRARY_RELEASE Vorbis::vorbis IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(VORBIS_LIBRARY_DEBUG Vorbis::vorbis IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${VORBIS_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${VORBIS_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${VORBIS_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${VORBIS_LIBRARY_RELEASE}>")
|
||||
get_target_property(VORBISENC_LIBRARY_RELEASE Vorbis::vorbisenc IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(VORBISENC_LIBRARY_DEBUG Vorbis::vorbisenc IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${VORBISENC_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${VORBISENC_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${VORBISENC_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${VORBISENC_LIBRARY_RELEASE}>")
|
||||
get_target_property(VORBIS_DEP_LIBRARIES Vorbis::vorbis INTERFACE_LINK_LIBRARIES)
|
||||
foreach(deps ${VORBIS_DEP_LIBRARIES})
|
||||
if(TARGET ${deps})
|
||||
get_target_property(VORBIS_DEP_LIBRARY_RELEASE ${deps} IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(VORBIS_DEP_LIBRARY_DEBUG ${deps} INTERFACE_LINK_LIBRARIES)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${VORBIS_DEP_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${VORBIS_DEP_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${VORBIS_DEP_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${VORBIS_DEP_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@ -153,35 +151,35 @@ if(@ENABLE_VPX@)
|
||||
find_dependency(unofficial-libvpx)
|
||||
get_target_property(VPX_LIBRARY_RELEASE unofficial::libvpx::libvpx IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(VPX_LIBRARY_DEBUG unofficial::libvpx::libvpx IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${VPX_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${VPX_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${VPX_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${VPX_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_WAVPACK@)
|
||||
find_dependency(wavpack)
|
||||
get_target_property(WAVPACK_LIBRARY_RELEASE WavPack::wavpack IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(WAVPACK_LIBRARY_DEBUG WavPack::wavpack IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${WAVPACK_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${WAVPACK_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${WAVPACK_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${WAVPACK_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_X264@)
|
||||
find_library(X264_LIBRARY_RELEASE NAMES x264 libx264 PATHS ${_IMPORT_PREFIX}/lib/ NO_DEFAULT_PATH)
|
||||
find_library(X264_LIBRARY_DEBUG NAMES x264 libx264 PATHS ${_IMPORT_PREFIX}/debug/lib/ NO_DEFAULT_PATH)
|
||||
select_library_configurations(X264)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${X264_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${X264_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${X264_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${X264_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_X265@)
|
||||
find_library(X265_LIBRARY_RELEASE NAMES x265 x265-static PATHS ${_IMPORT_PREFIX}/lib/ NO_DEFAULT_PATH)
|
||||
find_library(X265_LIBRARY_DEBUG NAMES x265 x265-static PATHS ${_IMPORT_PREFIX}/debug/lib/ NO_DEFAULT_PATH)
|
||||
select_library_configurations(X265)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${X265_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${X265_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${X265_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${X265_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
if(@ENABLE_ZLIB@)
|
||||
find_dependency(ZLIB)
|
||||
get_target_property(ZLIB_LIBRARY_RELEASE ZLIB::ZLIB IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(ZLIB_LIBRARY_DEBUG ZLIB::ZLIB IMPORTED_LOCATION_DEBUG)
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${ZLIB_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${ZLIB_LIBRARY_RELEASE}>")
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${ZLIB_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${ZLIB_LIBRARY_RELEASE}>")
|
||||
endif()
|
||||
|
||||
# Platform dependent libraries required by FFMPEG
|
||||
@ -213,7 +211,7 @@ macro(FFMPEG_FIND varname shortname headername)
|
||||
get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY)
|
||||
get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY)
|
||||
#select_library_configurations(FFMPEG_${varname})
|
||||
set(FFMPEG_${varname}_LIBRARY "$<$<CONFIG:Debug>:${FFMPEG_${varname}_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${FFMPEG_${varname}_LIBRARY_RELEASE}>" CACHE STRING "")
|
||||
set(FFMPEG_${varname}_LIBRARY "$<$<CONFIG:Debug>:${FFMPEG_${varname}_LIBRARY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${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)
|
||||
@ -249,8 +247,7 @@ if(APPLE)
|
||||
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})
|
||||
list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${VT_UNIT} ${AT_UNIT} ${SEC_UNIT} ${CF_UNIT} ${CM_UNIT} ${CV_UNIT})
|
||||
endif()
|
||||
|
||||
if(@ENABLE_AVCODEC@)
|
||||
|
Loading…
x
Reference in New Issue
Block a user