Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FindFFmpeg.cmake « Modules « cmake « build_files - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5f506a33e13c31922b87dccaee8638d00282a4b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# - Find FFmpeg library and includes.
# Set FFMPEG_FIND_COMPONENTS to the canonical names of the libraries
# before using the module.
# 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, the given individual component libraries.
#=============================================================================
# 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
)

if(NOT FFMPEG_FIND_COMPONENTS)
  set(FFMPEG_FIND_COMPONENTS
    # List taken from http://ffmpeg.org/download.html#build-mac
    avcodec
    avdevice
    avfilter
    avformat
    avutil
    swscale
    swresample
  )
endif()

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
      ${_component}
    HINTS
      ${_ffmpeg_SEARCH_DIRS}
    PATH_SUFFIXES
      lib64 lib
  )
  if(NOT FFMPEG_${_upper_COMPONENT}_LIBRARY)
    message(WARNING "Could NOT find FFmpeg ${_upper_COMPONENT}.")
  endif()
  list(APPEND _ffmpeg_LIBRARIES ${FFMPEG_${_upper_COMPONENT}_LIBRARY})
  mark_as_advanced(FFMPEG_${_upper_COMPONENT}_LIBRARY)
endforeach()

# 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()

mark_as_advanced(
  FFMPEG_INCLUDE_DIR
)

unset(_ffmpeg_SEARCH_DIRS)
unset(_ffmpeg_LIBRARIES)
unset(_ffmpeg_INCLUDE_DIR)