-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathFindFFMPEG.cmake
97 lines (78 loc) · 2.33 KB
/
FindFFMPEG.cmake
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
86
87
88
89
90
91
92
93
94
95
96
97
# Find the FFmpeg library
#
# Sets
# FFMPEG_FOUND. If false, don't try to use ffmpeg
# FFMPEG_FOUND_SEVERAL. If true, there are several directories with headers (not only ../ffmpeg/)
# FFMPEG_INCLUDE_DIR
# FFMPEG_LIBRARIES
set( FFMPEG_FOUND "NO" )
find_path( FFMPEG_INCLUDE1_DIR ffmpeg/avcodec.h )
find_path( FFMPEG_INCLUDE2_DIR libavcodec/avcodec.h )
if( FFMPEG_INCLUDE1_DIR)
set(FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE1_DIR} )
set( FFMPEG_FOUND_SEVERAL "NO" )
endif()
if( FFMPEG_INCLUDE2_DIR)
set(FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE2_DIR} )
set( FFMPEG_FOUND_SEVERAL "YES" )
endif()
if( FFMPEG_INCLUDE_DIR )
find_program( FFMPEG_CONFIG ffmpeg-config
HINTS
${FFMPEG_INCLUDE_DIR}/../bin
)
if( FFMPEG_CONFIG )
exec_program( ${FFMPEG_CONFIG} ARGS "--libs avformat" OUTPUT_VARIABLE FFMPEG_LIBS )
set( FFMPEG_FOUND "YES" )
set( FFMPEG_LIBRARIES "${FFMPEG_LIBS}" )
else()
find_library( FFMPEG_avcodec_LIBRARY avcodec
HINTS
${FFMPEG_INCLUDE_DIR}/../lib
${FFMPEG_INCLUDE_DIR}/../bin
)
find_library( FFMPEG_avformat_LIBRARY avformat
HINTS
${FFMPEG_INCLUDE_DIR}/../lib
${FFMPEG_INCLUDE_DIR}/../bin
)
find_library( FFMPEG_avutil_LIBRARY avutil
HINTS
${FFMPEG_INCLUDE_DIR}/../lib
${FFMPEG_INCLUDE_DIR}/../bin
)
find_library( FFMPEG_avfilter_LIBRARY avfilter
HINTS
${FFMPEG_INCLUDE_DIR}/../lib
${FFMPEG_INCLUDE_DIR}/../bin
)
find_library( FFMPEG_swscale_LIBRARY swscale
HINTS
${FFMPEG_INCLUDE_DIR}/../lib
${FFMPEG_INCLUDE_DIR}/../bin
)
find_library( FFMPEG_swresample_LIBRARY swresample
HINTS
${FFMPEG_INCLUDE_DIR}/../lib
${FFMPEG_INCLUDE_DIR}/../bin
)
if( FFMPEG_avcodec_LIBRARY )
if( FFMPEG_avformat_LIBRARY )
set( FFMPEG_FOUND "YES" )
set( FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY} ${FFMPEG_avcodec_LIBRARY} )
if( FFMPEG_avutil_LIBRARY )
set( FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_avutil_LIBRARY} )
endif()
if( FFMPEG_avfilter_LIBRARY )
set( FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_avfilter_LIBRARY} )
endif()
if( FFMPEG_swscale_LIBRARY )
set( FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_swscale_LIBRARY} )
endif()
if( FFMPEG_swresample_LIBRARY )
set( FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_swresample_LIBRARY} )
endif()
endif()
endif()
endif()
endif()