Changeset View
Changeset View
Standalone View
Standalone View
build_files/cmake/Modules/FindFFmpeg.cmake
- This file was added.
| # - Find FFmpeg library and includes. | |||||
| # This module defines | |||||
| # FFMPEG_INCLUDE_DIRS, where to find libavcodec/ac3_parser.h. | |||||
| # FFMPEG_LIBRARIES, libraries to link against to use FFmpeg. | |||||
| # FFMPEG_ROOT_DIR, The base directory to search for FFmpeg. | |||||
| # This can also be an environment variable. | |||||
| # FFMPEG_FOUND, If false, do not try to use FFmpeg. | |||||
| # FFMPEG_<COMPONENT>_LIBRARY, several libraries bundled with FFmpeg. | |||||
| #============================================================================= | |||||
| # Copyright 2020 Blender Foundation. | |||||
| # | |||||
| # Distributed under the OSI-approved BSD 3-Clause License, | |||||
| # see accompanying file BSD-3-Clause-license.txt for details. | |||||
| #============================================================================= | |||||
| # If FFMPEG_ROOT_DIR was defined in the environment, use it. | |||||
| IF(NOT FFMPEG_ROOT_DIR AND NOT $ENV{FFMPEG_ROOT_DIR} STREQUAL "") | |||||
| set(FFMPEG_ROOT_DIR $ENV{FFMPEG_ROOT_DIR}) | |||||
| ENDIF() | |||||
| set(_ffmpeg_SEARCH_DIRS | |||||
| ${FFMPEG_ROOT_DIR} | |||||
| /opt/lib/ffmpeg | |||||
| ) | |||||
| set(_ffmpeg_FIND_COMPONENTS | |||||
| avcodec | |||||
| avdevice | |||||
| avformat | |||||
| avutil | |||||
| mp3lame | |||||
| ogg | |||||
| opus | |||||
| swresample | |||||
| swscale | |||||
| theora | |||||
| theoradec | |||||
| theoraenc | |||||
| vorbis | |||||
| vorbisenc | |||||
| vorbisfile | |||||
| vpx | |||||
| x264 | |||||
| xvidcore | |||||
| ) | |||||
| FIND_PATH(_ffmpeg_INCLUDE_DIR | |||||
| NAMES | |||||
| libavcodec/ac3_parser.h | |||||
| HINTS | |||||
| ${_ffmpeg_SEARCH_DIRS} | |||||
| PATH_SUFFIXES | |||||
| include | |||||
| ) | |||||
| set(_ffmpeg_LIBRARIES) | |||||
| foreach(COMPONENT ${_ffmpeg_FIND_COMPONENTS}) | |||||
| string(TOUPPER ${COMPONENT} _upper_COMPONENT) | |||||
| find_library(FFMPEG_${_upper_COMPONENT}_LIBRARY | |||||
| NAMES | |||||
| ${_upper_COMPONENT} | |||||
| HINTS | |||||
| ${LIBDIR}/ffmpeg | |||||
| PATH_SUFFIXES | |||||
| lib64 lib | |||||
| ) | |||||
| list(APPEND _ffmpeg_LIBRARIES ${FFMPEG_${_upper_COMPONENT}_LIBRARY}) | |||||
| mark_as_advanced(FFMPEG_${_upper_COMPONENT}_LIBRARY) | |||||
| endforeach(COMPONENT) | |||||
| # handle the QUIETLY and REQUIRED arguments and set FFMPEG_FOUND to TRUE if | |||||
| # all listed variables are TRUE | |||||
| INCLUDE(FindPackageHandleStandardArgs) | |||||
| FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG | |||||
| _ffmpeg_LIBRARIES _ffmpeg_INCLUDE_DIR) | |||||
| IF(FFMPEG_FOUND) | |||||
| set(FFMPEG_LIBRARIES ${_ffmpeg_LIBRARIES}) | |||||
| set(FFMPEG_INCLUDE_DIRS ${_ffmpeg_INCLUDE_DIR}) | |||||
| ENDIF(FFMPEG_FOUND) | |||||
| mark_as_advanced( | |||||
| FFMPEG_INCLUDE_DIR | |||||
| ) | |||||
| unset(_ffmpeg_SEARCH_DIRS) | |||||
| unset(_ffmpeg_FIND_COMPONENTS) | |||||
| unset(_ffmpeg_LIBRARIES) | |||||
| unset(_ffmpeg_INCLUDE_DIR) | |||||