|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT FFMPEG_DIR) |
|
set(FFMPEG_DIR "$ENV{FFMPEG_DIR}" CACHE PATH "FFMPEG_DIR root directory") |
|
endif() |
|
|
|
if(FFMPEG_DIR) |
|
file(TO_CMAKE_PATH ${FFMPEG_DIR} FFMPEG_DIR) |
|
endif() |
|
|
|
MACRO(FFMPEG_FIND varname shortname headername) |
|
|
|
|
|
FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS |
|
NAMES "lib${shortname}/${headername}" |
|
PATHS |
|
"${FFMPEG_DIR}/include" |
|
) |
|
|
|
|
|
IF(${FFMPEG_${varname}_INCLUDE_DIRS} STREQUAL "FFMPEG_${varname}_INCLUDE_DIR-NOTFOUND") |
|
MESSAGE(STATUS "Can't find includes for ${shortname}...") |
|
ELSE() |
|
FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES |
|
NAMES ${shortname} |
|
PATHS |
|
${FFMPEG_DIR}/lib |
|
) |
|
|
|
|
|
SET(FFMPEG_${varname}_FOUND 1) |
|
SET(FFMPEG_${varname}_INCLUDE_DIRS ${FFMPEG_${varname}_INCLUDE_DIR}) |
|
SET(FFMPEG_${varname}_LIBS ${FFMPEG_${varname}_LIBRARIES}) |
|
ENDIF() |
|
ENDMACRO(FFMPEG_FIND) |
|
|
|
|
|
FFMPEG_FIND(LIBAVFORMAT avformat avformat.h) |
|
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h) |
|
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h) |
|
FFMPEG_FIND(LIBAVUTIL avutil avutil.h) |
|
FFMPEG_FIND(LIBSWSCALE swscale swscale.h) |
|
|
|
|
|
|
|
IF(FFMPEG_LIBAVFORMAT_FOUND |
|
AND FFMPEG_LIBAVDEVICE_FOUND |
|
AND FFMPEG_LIBAVCODEC_FOUND |
|
AND FFMPEG_LIBAVUTIL_FOUND |
|
AND FFMPEG_LIBSWSCALE_FOUND) |
|
|
|
|
|
SET(FFMPEG_FOUND "YES") |
|
SET(FFMPEG_INCLUDE_DIR ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}) |
|
SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS}) |
|
SET(FFMPEG_LIBRARIES |
|
${FFMPEG_LIBAVFORMAT_LIBS} |
|
${FFMPEG_LIBAVDEVICE_LIBS} |
|
${FFMPEG_LIBAVCODEC_LIBS} |
|
${FFMPEG_LIBAVUTIL_LIBS} |
|
${FFMPEG_LIBSWSCALE_LIBS} ) |
|
|
|
|
|
if(WIN32) |
|
file(GLOB FFMPEG_DYNAMIC_LIBS "${FFMPEG_DIR}/bin/*.dll") |
|
if(NOT FFMPEG_DYNAMIC_LIBS) |
|
message("FFMPEG_DYNAMIC_LIBS is missing...") |
|
endif() |
|
set(FFMPEG_DYNAMIC_LIBS ${FFMPEG_DYNAMIC_LIBS} CACHE PATH "Windows dll location") |
|
endif() |
|
|
|
mark_as_advanced(FFMPEG_INCLUDE_DIR FFMPEG_LIBRARY_DIRS FFMPEG_LIBRARIES FFMPEG_DYNAMIC_LIBS) |
|
ELSE () |
|
MESSAGE(STATUS "Could not find FFMPEG") |
|
ENDIF() |
|
|
|
|
|
INCLUDE(FindPackageHandleStandardArgs) |
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFMPEG |
|
REQUIRED_VARS FFMPEG_INCLUDE_DIR FFMPEG_LIBRARIES |
|
FAIL_MESSAGE "FFmpeg wasn't found correctly. Set FFMPEG_DIR to the root SDK installation directory." |
|
) |
|
|
|
if(NOT FFMPEG_FOUND) |
|
set(FFMPEG_DIR "" CACHE STRING "Path to FFmpeg install directory") |
|
endif() |
|
|
|
|