2021-05-14 08:21:33 +00:00
|
|
|
# Locate FFmpeg
|
2021-05-09 20:52:26 +00:00
|
|
|
#
|
2021-05-14 08:21:33 +00:00
|
|
|
# This module defines:
|
|
|
|
# FFMPEG_FOUND
|
|
|
|
# FFMPEG_INCLUDE_DIRS
|
|
|
|
# FFMPEG_LIBRARIES
|
2021-05-09 20:52:26 +00:00
|
|
|
#
|
2021-05-14 08:14:14 +00:00
|
|
|
# Created by Robert Osfield
|
|
|
|
# Modified by Lukas Lalinsky
|
|
|
|
# Modified by Leon Styhre
|
2021-05-14 08:21:33 +00:00
|
|
|
#
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:21:33 +00:00
|
|
|
# Macro to find headers and library directories.
|
|
|
|
# Example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
|
2021-05-14 08:14:14 +00:00
|
|
|
macro(FFMPEG_FIND varname shortname headername)
|
|
|
|
find_path(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
|
2021-05-10 19:58:14 +00:00
|
|
|
PATHS
|
|
|
|
${FFMPEG_ROOT}/include
|
|
|
|
$ENV{FFMPEG_DIR}/include
|
|
|
|
~/Library/Frameworks
|
|
|
|
/Library/Frameworks
|
|
|
|
/usr/local/include
|
2021-05-14 08:14:14 +00:00
|
|
|
/usr/pkg/include # NetBSD
|
|
|
|
/usr/include
|
2021-05-10 19:58:14 +00:00
|
|
|
/sw/include # Fink
|
|
|
|
/opt/local/include # DarwinPorts
|
|
|
|
/opt/csw/include # Blastwave
|
|
|
|
/opt/include
|
|
|
|
/usr/freeware/include
|
|
|
|
NO_DEFAULT_PATH
|
2021-05-14 08:14:14 +00:00
|
|
|
PATH_SUFFIXES
|
|
|
|
ffmpeg
|
|
|
|
ffmpeg4 # NetBSD
|
2021-05-10 19:58:14 +00:00
|
|
|
DOC "Location of FFMPEG Headers"
|
|
|
|
)
|
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
|
|
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/pkg/lib/ffmpeg4/pkgconfig")
|
|
|
|
endif()
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
pkg_check_modules(FFMPEG_${varname} lib${shortname} REQUIRED)
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
if(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
|
|
|
|
set(FFMPEG_${varname}_FOUND 1)
|
|
|
|
message("-- " ${FFMPEG_${varname}_LINK_LIBRARIES})
|
|
|
|
endif(FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
endmacro(FFMPEG_FIND)
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
set(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG")
|
2021-05-10 19:58:14 +00:00
|
|
|
|
|
|
|
FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
|
|
|
|
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
|
|
|
|
FFMPEG_FIND(LIBAVCODEC_FFT avcodec avfft.h)
|
|
|
|
FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
|
|
|
|
FFMPEG_FIND(LIBSWRESAMPLE swresample swresample.h)
|
2021-05-14 08:21:33 +00:00
|
|
|
FFMPEG_FIND(LIBSWSCALE swscale swscale.h)
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
set(FFMPEG_FOUND "NO")
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
if(FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND
|
|
|
|
FFMPEG_LIBSWRESAMPLE_FOUND AND FFMPEG_LIBSWSCALE_FOUND)
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
set(FFMPEG_FOUND "YES")
|
|
|
|
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
|
|
|
|
set(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
|
2021-05-10 19:58:14 +00:00
|
|
|
|
2021-05-14 08:14:14 +00:00
|
|
|
set(FFMPEG_LIBRARIES
|
2021-05-13 11:00:11 +00:00
|
|
|
${FFMPEG_LIBAVFORMAT_LINK_LIBRARIES}
|
|
|
|
${FFMPEG_LIBAVCODEC_LINK_LIBRARIES}
|
|
|
|
${FFMPEG_LIBAVUTIL_LINK_LIBRARIES}
|
|
|
|
${FFMPEG_LIBSWRESAMPLE_LINK_LIBRARIES}
|
|
|
|
${FFMPEG_LIBSWSCALE_LINK_LIBRARIES})
|
2021-05-14 08:14:14 +00:00
|
|
|
endif()
|