2012-01-27 05:13:08 +04:00
|
|
|
# - Try to find FFmpeg
|
|
|
|
# Using Pkg-config if available for path
|
|
|
|
#
|
|
|
|
# FFMPEG_FOUND - all required ffmpeg components found on system
|
|
|
|
# FFMPEG_INCLUDE_DIRS - combined include directories
|
|
|
|
# FFMPEG_LIBRARIES - combined libraries to link
|
|
|
|
|
2012-09-26 17:45:30 +04:00
|
|
|
set(REQUIRED_AVCODEC_VERSION 0.8)
|
|
|
|
set(REQUIRED_AVCODEC_API_VERSION 53.25.0)
|
|
|
|
|
2012-01-27 05:13:08 +04:00
|
|
|
include(FindPkgConfig)
|
|
|
|
|
2012-11-03 03:27:01 +04:00
|
|
|
if(PKG_CONFIG_FOUND)
|
2012-01-27 05:13:08 +04:00
|
|
|
pkg_check_modules(AVCODEC libavcodec)
|
|
|
|
pkg_check_modules(AVUTIL libavutil)
|
2012-11-03 03:27:01 +04:00
|
|
|
endif()
|
2012-01-27 05:13:08 +04:00
|
|
|
|
|
|
|
# avcodec
|
2012-02-29 09:30:03 +04:00
|
|
|
find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h PATHS ${AVCODEC_INCLUDE_DIRS})
|
2012-01-27 05:13:08 +04:00
|
|
|
find_library(AVCODEC_LIBRARY avcodec PATHS ${AVCODEC_LIBRARY_DIRS})
|
|
|
|
|
|
|
|
# avutil
|
2012-02-29 09:30:03 +04:00
|
|
|
find_path(AVUTIL_INCLUDE_DIR libavutil/avutil.h PATHS ${AVUTIL_INCLUDE_DIRS})
|
2012-01-27 05:13:08 +04:00
|
|
|
find_library(AVUTIL_LIBRARY avutil PATHS ${AVUTIL_LIBRARY_DIRS})
|
|
|
|
|
|
|
|
if(AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY)
|
|
|
|
set(AVCODEC_FOUND TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(AVUTIL_INCLUDE_DIR AND AVUTIL_LIBRARY)
|
|
|
|
set(AVUTIL_FOUND TRUE)
|
|
|
|
endif()
|
|
|
|
|
2012-11-03 03:27:01 +04:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2012-01-27 05:13:08 +04:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND)
|
|
|
|
|
2012-09-26 17:45:30 +04:00
|
|
|
if (AVCODEC_VERSION)
|
|
|
|
if (${AVCODEC_VERSION} VERSION_LESS ${REQUIRED_AVCODEC_API_VERSION})
|
|
|
|
message(FATAL_ERROR "libavcodec version >= ${REQUIRED_AVCODEC_VERSION} (API >= ${REQUIRED_AVCODEC_API_VERSION}) is required")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message("Note: To build libavcodec version >= ${REQUIRED_AVCODEC_VERSION} (API >= ${REQUIRED_AVCODEC_API_VERSION}) is required")
|
|
|
|
endif()
|
|
|
|
|
2012-01-27 05:13:08 +04:00
|
|
|
if(FFMPEG_FOUND)
|
|
|
|
set(FFMPEG_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR})
|
|
|
|
set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
2012-11-03 03:27:01 +04:00
|
|
|
mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES)
|
|
|
|
|