forked from Kitware/kwiver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindFFMPEG.cmake
111 lines (93 loc) · 2.41 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# 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
/usr/include
/usr/local/include
)
find_path( FFMPEG_INCLUDE2_DIR libavcodec/avcodec.h
/usr/include
/usr/include/ffmpeg
/usr/local/include
/usr/local/include/ffmpeg
)
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
/usr/bin
/usr/local/bin
${HOME}/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
/usr/lib
/usr/local/lib
/usr/lib64
/usr/local/lib64
)
find_library( FFMPEG_avformat_LIBRARY avformat
/usr/lib
/usr/local/lib
/usr/lib64
/usr/local/lib64
)
find_library( FFMPEG_avutil_LIBRARY avutil
/usr/lib
/usr/local/lib
/usr/lib64
/usr/local/lib64
)
find_library( FFMPEG_avfilter_LIBRARY avfilter
/usr/lib
/usr/local/lib
/usr/lib64
/usr/local/lib64
)
find_library( FFMPEG_swscale_LIBRARY swscale
/usr/lib
/usr/local/lib
/usr/lib64
/usr/local/lib64
)
find_library( FFMPEG_swresample_LIBRARY swresample
/usr/lib
/usr/local/lib
/usr/lib64
/usr/local/lib64
)
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()