]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | # Distributed under the OSI-approved BSD 3-Clause License. |
2 | # | |
3 | #.rst: | |
4 | # FindFFMPEG | |
5 | # -------- | |
6 | # | |
7 | # Find the FFPMEG libraries | |
8 | # | |
9 | # Result Variables | |
10 | # ^^^^^^^^^^^^^^^^ | |
11 | # | |
12 | # The following variables will be defined: | |
13 | # | |
14 | # ``FFMPEG_FOUND`` | |
15 | # True if FFMPEG found on the local system | |
16 | # | |
17 | # ``FFMPEG_INCLUDE_DIRS`` | |
18 | # Location of FFMPEG header files | |
19 | # | |
20 | # ``FFMPEG_LIBRARY_DIRS`` | |
21 | # Location of FFMPEG libraries | |
22 | # | |
23 | # ``FFMPEG_LIBRARIES`` | |
24 | # List of the FFMPEG libraries found | |
25 | # | |
26 | # | |
27 | ||
28 | include(FindPackageHandleStandardArgs) | |
29 | include(SelectLibraryConfigurations) | |
30 | include(CMakeFindDependencyMacro) | |
31 | ||
32 | if(NOT FFMPEG_FOUND) | |
33 | ||
34 | # Compute the installation path relative to this file. | |
35 | get_filename_component(SEARCH_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) | |
36 | get_filename_component(SEARCH_PATH "${SEARCH_PATH}" PATH) | |
37 | get_filename_component(SEARCH_PATH "${SEARCH_PATH}" PATH) | |
38 | if(SEARCH_PATH STREQUAL "/") | |
39 | set(SEARCH_PATH "") | |
40 | endif() | |
41 | ||
42 | function(select_library_configurations_from_names) | |
43 | cmake_parse_arguments(_slc "" "BASENAME" "NAMES;NAMES_RELEASE;NAMES_DEBUG" ${ARGN}) | |
44 | list(APPEND _slc_NAMES_RELEASE ${_slc_NAMES}) | |
45 | list(APPEND _slc_NAMES_DEBUG ${_slc_NAMES}) | |
46 | find_library(${_slc_BASENAME}_LIBRARY_RELEASE NAMES ${_slc_NAMES_RELEASE} PATHS ${SEARCH_PATH}/lib/ NO_DEFAULT_PATH) | |
47 | find_library(${_slc_BASENAME}_LIBRARY_DEBUG NAMES ${_slc_NAMES_DEBUG} PATHS ${SEARCH_PATH}/debug/lib/ NO_DEFAULT_PATH) | |
48 | select_library_configurations(${_slc_BASENAME}) | |
49 | set(${_slc_BASENAME}_LIBRARIES ${${_slc_BASENAME}_LIBRARIES} PARENT_SCOPE) | |
50 | endfunction() | |
51 | ||
52 | function(select_library_configurations_from_targets) | |
53 | cmake_parse_arguments(_slc "" "BASENAME" "TARGETS" ${ARGN}) | |
54 | foreach(_target ${_slc_TARGETS}) | |
55 | get_target_property(_rel ${_target} IMPORTED_LOCATION_RELEASE) | |
56 | get_target_property(_dbg ${_target} IMPORTED_LOCATION_DEBUG) | |
57 | get_target_property(_deps ${_target} INTERFACE_LINK_LIBRARIES) | |
58 | list(APPEND ${_slc_BASENAME}_LIBRARY_RELEASE ${_rel}) | |
59 | list(APPEND ${_slc_BASENAME}_LIBRARY_DEBUG ${_dbg}) | |
60 | foreach(_dep ${_deps}) | |
61 | if(TARGET ${_dep}) | |
62 | get_target_property(_dep_rel ${_dep} IMPORTED_LOCATION_RELEASE) | |
63 | get_target_property(_dep_dbg ${_dep} IMPORTED_LOCATION_DEBUG) | |
64 | if(_dep_rel MATCHES _dep_rel-NOTFOUND) | |
65 | set(_dep_rel ${_dep_dbg}) | |
66 | elseif(_dep_dbg MATCHES _dep_dbg-NOTFOUND) | |
67 | set(_dep_dbg ${_dep_rel}) | |
68 | endif() | |
69 | list(APPEND ${_slc_BASENAME}_LIBRARY_RELEASE ${_dep_rel}) | |
70 | list(APPEND ${_slc_BASENAME}_LIBRARY_DEBUG ${_dep_dbg}) | |
71 | elseif(NOT ${_dep} MATCHES _deps-NOTFOUND) | |
72 | if(${_dep} MATCHES ::) | |
73 | #TODO Handle targets contained in cmake generator expressions | |
74 | message(STATUS Unhandled dependency ${_slc_BASENAME}: ${_dep}) | |
75 | else() | |
76 | list(APPEND ${_slc_BASENAME}_DEP_LIBRARIES ${_dep}) | |
77 | endif() | |
78 | endif() | |
79 | endforeach() | |
80 | endforeach() | |
81 | select_library_configurations(${_slc_BASENAME}) | |
82 | list(APPEND ${_slc_BASENAME}_LIBRARIES ${${_slc_BASENAME}_DEP_LIBRARIES}) | |
83 | set(${_slc_BASENAME}_LIBRARIES ${${_slc_BASENAME}_LIBRARIES} PARENT_SCOPE) | |
84 | endfunction() | |
85 | ||
86 | # for finding system libraries (e.g. Apple framework libraries) | |
87 | function(find_platform_dependent_libraries) | |
88 | cmake_parse_arguments(_fpd "" "" "NAMES" ${ARGN}) | |
89 | foreach(_name ${_fpd_NAMES}) | |
90 | find_library(${_name}_LIBRARY ${_name} REQUIRED) | |
91 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${${_name}_LIBRARY}) | |
92 | endforeach() | |
93 | set(FFMPEG_PLATFORM_DEPENDENT_LIBS ${FFMPEG_PLATFORM_DEPENDENT_LIBS} PARENT_SCOPE) | |
94 | endfunction() | |
95 | ||
96 | # for finding system libraries that may not always be available | |
97 | function(find_platform_dependent_optional_libraries) | |
98 | cmake_parse_arguments(_fpdo "" "" "NAMES" ${ARGN}) | |
99 | foreach(_name ${_fpdo_NAMES}) | |
100 | find_library(${_name}_LIBRARY ${_name}) | |
101 | if(NOT ${_name}_LIBRARY MATCHES ${_name}_LIBRARY-NOTFOUND) | |
102 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${${_name}_LIBRARY}) | |
103 | endif() | |
104 | endforeach() | |
105 | set(FFMPEG_PLATFORM_DEPENDENT_LIBS ${FFMPEG_PLATFORM_DEPENDENT_LIBS} PARENT_SCOPE) | |
106 | endfunction() | |
107 | ||
108 | set(FFMPEG_VERSION "@FFMPEG_VERSION@") | |
109 | ||
110 | find_dependency(Threads) | |
111 | if(UNIX) | |
112 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS -pthread) | |
113 | endif() | |
114 | ||
115 | if(@ENABLE_ASS@) | |
116 | select_library_configurations_from_names(BASENAME ASS NAMES ass libass) | |
117 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${ASS_LIBRARIES}) | |
118 | if(NOT @ENABLE_FREETYPE@) | |
119 | find_dependency(Freetype) | |
120 | select_library_configurations_from_targets(BASENAME freetype TARGETS Freetype::Freetype) | |
121 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${freetype_LIBRARIES}) | |
122 | endif() | |
123 | if(NOT @ENABLE_FRIBIDI@) | |
124 | select_library_configurations_from_names(BASENAME FRIBIDI NAMES fribidi libfribidi) | |
125 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${FRIBIDI_LIBRARIES}) | |
126 | endif() | |
127 | select_library_configurations_from_names(BASENAME HARFBUZZ NAMES harfbuzz libharfbuzz) | |
128 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${HARFBUZZ_LIBRARIES}) | |
129 | endif() | |
130 | ||
131 | if(@ENABLE_BZIP2@) | |
132 | find_dependency(BZip2) | |
133 | select_library_configurations_from_targets(BASENAME BZip2 TARGETS BZip2::BZip2) | |
134 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${BZip2_LIBRARIES}) | |
135 | endif() | |
136 | ||
137 | if(@ENABLE_DAV1D@) | |
138 | select_library_configurations_from_names(BASENAME DAV1D NAMES dav1d libdav1d) | |
139 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${DAV1D_LIBRARIES}) | |
140 | if(UNIX) | |
141 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS dl) | |
142 | endif() | |
143 | endif() | |
144 | ||
145 | if(@ENABLE_ICONV@) | |
146 | find_dependency(Iconv) | |
147 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${Iconv_LIBRARIES}) | |
148 | endif() | |
149 | ||
150 | if(@ENABLE_ILBC@) | |
151 | select_library_configurations_from_names(BASENAME ILBC NAMES ilbc libilbc) | |
152 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${ILBC_LIBRARIES}) | |
153 | endif() | |
154 | ||
155 | if(@ENABLE_FDKAAC@) | |
156 | select_library_configurations_from_names(BASENAME FDK NAMES fdk-aac libfdk-aac) | |
157 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${FDK_LIBRARIES}) | |
158 | endif() | |
159 | ||
160 | if(@ENABLE_FONTCONFIG@) | |
161 | find_dependency(Fontconfig) | |
162 | select_library_configurations_from_targets(BASENAME fontconfig TARGETS Fontconfig::Fontconfig) | |
163 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${fontconfig_LIBRARIES}) | |
164 | endif() | |
165 | ||
166 | if(@ENABLE_FREETYPE@) | |
167 | find_dependency(Freetype) | |
168 | select_library_configurations_from_targets(BASENAME freetype TARGETS Freetype::Freetype) | |
169 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${freetype_LIBRARIES}) | |
170 | endif() | |
171 | ||
172 | if(@ENABLE_FRIBIDI@) | |
173 | select_library_configurations_from_names(BASENAME FRIBIDI NAMES fribidi libfribidi) | |
174 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${FRIBIDI_LIBRARIES}) | |
175 | endif() | |
176 | ||
177 | if(@ENABLE_LZMA@) | |
178 | find_dependency(LibLZMA) | |
179 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${LibLZMA_LIBRARIES}) | |
180 | endif() | |
181 | ||
182 | if(@ENABLE_LAME@) | |
183 | find_dependency(mp3lame) | |
184 | select_library_configurations_from_targets(BASENAME mp3lame TARGETS mp3lame::mp3lame) | |
185 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${mp3lame_LIBRARIES}) | |
186 | endif() | |
187 | ||
188 | if(@ENABLE_MODPLUG@) | |
189 | select_library_configurations_from_names(BASENAME MODPLUG NAMES modplug libmodplug) | |
190 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${MODPLUG_LIBRARIES}) | |
191 | endif() | |
192 | ||
193 | if(@ENABLE_NVCODEC@) | |
194 | if(UNIX) | |
195 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS dl) | |
196 | endif() | |
197 | endif() | |
198 | ||
199 | if(@ENABLE_OPENCL@) | |
200 | find_dependency(OpenCL) | |
201 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${OpenCL_LIBRARIES}) | |
202 | endif() | |
203 | ||
204 | if(@ENABLE_OPENGL@) | |
205 | if(POLICY CMP0072) | |
206 | cmake_policy (SET CMP0072 OLD) | |
207 | endif(POLICY CMP0072) | |
208 | find_dependency(OpenGL) | |
209 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${OPENGL_LIBRARIES}) | |
210 | endif() | |
211 | ||
212 | if(@ENABLE_OPENH264@) | |
213 | select_library_configurations_from_names(BASENAME openh264 NAMES openh264) | |
214 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${openh264_LIBRARIES}) | |
215 | endif() | |
216 | ||
217 | if(@ENABLE_OPENJPEG@) | |
218 | find_dependency(OpenJPEG) | |
219 | select_library_configurations_from_targets(BASENAME openjpeg TARGETS openjp2) | |
220 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${openjpeg_LIBRARIES}) | |
221 | endif() | |
222 | ||
223 | if(@ENABLE_OPENSSL@) | |
224 | find_dependency(OpenSSL) | |
225 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${OPENSSL_LIBRARIES}) | |
226 | endif() | |
227 | ||
228 | if(@ENABLE_OPUS@) | |
229 | find_dependency(Opus) | |
230 | select_library_configurations_from_targets(BASENAME Opus TARGETS Opus::opus) | |
231 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${Opus_LIBRARIES}) | |
232 | endif() | |
233 | ||
234 | if(@ENABLE_SDL2@) | |
235 | find_dependency(SDL2) | |
236 | if(TARGET SDL2::SDL2-static) | |
237 | select_library_configurations_from_targets(BASENAME SDL2 TARGETS SDL2::SDL2-static) | |
238 | else() | |
239 | select_library_configurations_from_targets(BASENAME SDL2 TARGETS SDL2::SDL2) | |
240 | endif() | |
241 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${SDL2_LIBRARIES}) | |
242 | endif() | |
243 | ||
244 | if(@ENABLE_SNAPPY@) | |
245 | find_dependency(Snappy) | |
246 | select_library_configurations_from_targets(BASENAME Snappy TARGETS Snappy::snappy) | |
247 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${Snappy_LIBRARIES}) | |
248 | endif() | |
249 | ||
250 | if(@ENABLE_SOXR@) | |
251 | select_library_configurations_from_names(BASENAME SOXR NAMES soxr) | |
252 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${SOXR_LIBRARIES}) | |
253 | endif() | |
254 | ||
255 | if(@ENABLE_SPEEX@) | |
256 | if(WIN32) | |
257 | select_library_configurations_from_names(BASENAME SPEEX NAMES_RELEASE libspeex NAMES_DEBUG libspeexd) | |
258 | else() | |
259 | select_library_configurations_from_names(BASENAME SPEEX NAMES speex libspeex) | |
260 | endif() | |
261 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${SPEEX_LIBRARIES}) | |
262 | endif() | |
263 | ||
264 | if(@ENABLE_SSH@) | |
265 | find_dependency(libssh) | |
266 | select_library_configurations_from_targets(BASENAME libssh TARGETS ssh) | |
267 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${libssh_LIBRARIES}) | |
268 | endif() | |
269 | ||
270 | if(@ENABLE_THEORA@) | |
271 | find_dependency(Ogg) # ensure Ogg::ogg is defined as a target | |
272 | find_dependency(unofficial-theora) | |
273 | select_library_configurations_from_targets(BASENAME THEORA TARGETS unofficial::theora::theoraenc) | |
274 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${THEORA_LIBRARIES}) | |
275 | endif() | |
276 | ||
277 | if(@ENABLE_TESSERACT@) | |
278 | find_dependency(Tesseract) | |
279 | select_library_configurations_from_targets(BASENAME tesseract TARGETS libtesseract) | |
280 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${tesseract_LIBRARIES}) | |
281 | endif() | |
282 | ||
283 | if(@ENABLE_VORBIS@) | |
284 | find_dependency(Vorbis) | |
285 | select_library_configurations_from_targets(BASENAME vorbis TARGETS Vorbis::vorbis Vorbis::vorbisenc) | |
286 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${vorbis_LIBRARIES}) | |
287 | endif() | |
288 | ||
289 | if(@ENABLE_VPX@) | |
290 | find_dependency(unofficial-libvpx) | |
291 | select_library_configurations_from_targets(BASENAME libvpx TARGETS unofficial::libvpx::libvpx) | |
292 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${libvpx_LIBRARIES}) | |
293 | endif() | |
294 | ||
295 | if(@ENABLE_WAVPACK@) | |
296 | find_dependency(wavpack) | |
297 | select_library_configurations_from_targets(BASENAME wavpack TARGETS WavPack::wavpack) | |
298 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${wavpack_LIBRARIES}) | |
299 | endif() | |
300 | ||
301 | if(@ENABLE_WEBP@) | |
302 | find_dependency(WebP) | |
303 | select_library_configurations_from_targets(BASENAME webp TARGETS WebP::webp WebP::webpdemux WebP::libwebpmux WebP::webpdecoder) | |
304 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${webp_LIBRARIES}) | |
305 | endif() | |
306 | ||
307 | if(@ENABLE_X264@) | |
308 | select_library_configurations_from_names(BASENAME X264 NAMES x264 libx264) | |
309 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${X264_LIBRARIES}) | |
310 | if(UNIX) | |
311 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS dl) | |
312 | endif() | |
313 | endif() | |
314 | ||
315 | if(@ENABLE_X265@) | |
316 | select_library_configurations_from_names(BASENAME X265 NAMES x265 x265-static) | |
317 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${X265_LIBRARIES}) | |
318 | if(UNIX) | |
319 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS dl) | |
320 | find_platform_dependent_optional_libraries(NAMES numa) | |
321 | endif() | |
322 | endif() | |
323 | ||
324 | if(@ENABLE_XML2@) | |
325 | find_dependency(LibXml2) | |
326 | select_library_configurations_from_targets(BASENAME libxml2 TARGETS LibXml2::LibXml2) | |
327 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${libxml2_LIBRARIES}) | |
328 | endif() | |
329 | ||
330 | if(@ENABLE_ZLIB@) | |
331 | find_dependency(ZLIB) | |
332 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${ZLIB_LIBRARIES}) | |
333 | endif() | |
334 | ||
335 | # Platform dependent libraries required by FFMPEG | |
336 | if(UNIX AND NOT APPLE) | |
337 | find_platform_dependent_optional_libraries(NAMES Xv X11 Xext) | |
338 | find_platform_dependent_optional_libraries(NAMES va-drm va vdpau) | |
339 | if(@ENABLE_AVDEVICE@) | |
340 | find_platform_dependent_optional_libraries(NAMES xcb xcb-shm xcb-shape xcb-xfixes) | |
341 | endif() | |
342 | endif() | |
343 | ||
344 | if(WIN32) | |
345 | if(NOT CYGWIN) | |
346 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS wsock32 ws2_32 secur32 bcrypt strmiids Vfw32 Shlwapi mfplat mfuuid) | |
347 | endif() | |
348 | else() | |
349 | list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS m) | |
350 | endif() | |
351 | ||
352 | macro(FFMPEG_FIND varname shortname headername) | |
353 | if(NOT FFMPEG_${varname}_INCLUDE_DIRS) | |
354 | find_path(FFMPEG_${varname}_INCLUDE_DIRS NAMES lib${shortname}/${headername} ${headername} PATHS ${SEARCH_PATH}/include NO_DEFAULT_PATH) | |
355 | endif() | |
356 | if(NOT FFMPEG_${varname}_LIBRARY) | |
357 | find_library(FFMPEG_${varname}_LIBRARY_RELEASE NAMES ${shortname} PATHS ${SEARCH_PATH}/lib/ NO_DEFAULT_PATH) | |
358 | find_library(FFMPEG_${varname}_LIBRARY_DEBUG NAMES ${shortname}d ${shortname} PATHS ${SEARCH_PATH}/debug/lib/ NO_DEFAULT_PATH) | |
359 | get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY) | |
360 | get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY) | |
361 | select_library_configurations(FFMPEG_${varname}) | |
362 | set(FFMPEG_${varname}_LIBRARY ${FFMPEG_${varname}_LIBRARY} CACHE STRING "") | |
363 | endif() | |
364 | if (FFMPEG_${varname}_LIBRARY AND FFMPEG_${varname}_INCLUDE_DIRS) | |
365 | set(FFMPEG_${varname}_FOUND TRUE BOOL) | |
366 | list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_${varname}_INCLUDE_DIRS}) | |
367 | list(APPEND FFMPEG_LIBRARIES ${FFMPEG_${varname}_LIBRARY}) | |
368 | list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR}) | |
369 | endif() | |
370 | endmacro(FFMPEG_FIND) | |
371 | ||
372 | if(APPLE) | |
373 | find_platform_dependent_libraries(NAMES VideoToolbox CoreServices CoreMedia CoreVideo) | |
374 | if(@ENABLE_OPENCL@) | |
375 | find_platform_dependent_libraries(NAMES OpenCL) | |
376 | endif() | |
377 | if(@ENABLE_AVDEVICE@) | |
378 | find_platform_dependent_libraries(NAMES AVFoundation CoreAudio CoreFoundation CoreGraphics Foundation) | |
379 | endif() | |
380 | if(@ENABLE_AVFILTER@) | |
381 | find_platform_dependent_libraries(NAMES OpenGL AppKit CoreImage) | |
382 | endif() | |
383 | if(@ENABLE_AVFORMAT@) | |
384 | find_platform_dependent_libraries(NAMES Security) | |
385 | endif() | |
386 | if(@ENABLE_AVCODEC@) | |
387 | find_platform_dependent_libraries(NAMES AudioToolbox) | |
388 | endif() | |
389 | endif() | |
390 | ||
391 | if(@ENABLE_AVDEVICE@) | |
392 | FFMPEG_FIND(libavdevice avdevice avdevice.h) | |
393 | endif() | |
394 | if(@ENABLE_AVFILTER@) | |
395 | FFMPEG_FIND(libavfilter avfilter avfilter.h) | |
396 | endif() | |
397 | if(@ENABLE_AVFORMAT@) | |
398 | FFMPEG_FIND(libavformat avformat avformat.h) | |
399 | endif() | |
400 | if(@ENABLE_AVCODEC@) | |
401 | FFMPEG_FIND(libavcodec avcodec avcodec.h) | |
402 | endif() | |
403 | if(@ENABLE_AVRESAMPLE@) | |
404 | FFMPEG_FIND(libavresample avresample avresample.h) | |
405 | endif() | |
406 | if(@ENABLE_POSTPROC@) | |
407 | FFMPEG_FIND(libpostproc postproc postprocess.h) | |
408 | endif() | |
409 | if(@ENABLE_SWRESAMPLE@) | |
410 | FFMPEG_FIND(libswresample swresample swresample.h) | |
411 | endif() | |
412 | if(@ENABLE_SWSCALE@) | |
413 | FFMPEG_FIND(libswscale swscale swscale.h) | |
414 | endif() | |
415 | FFMPEG_FIND(libavutil avutil avutil.h) | |
416 | ||
417 | if (FFMPEG_libavutil_FOUND) | |
418 | list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) | |
419 | list(REMOVE_DUPLICATES FFMPEG_LIBRARY_DIRS) | |
420 | set(FFMPEG_libavutil_VERSION "@LIBAVUTIL_VERSION@" CACHE STRING "") | |
421 | ||
422 | if(FFMPEG_libavcodec_FOUND) | |
423 | set(FFMPEG_libavcodec_VERSION "@LIBAVCODEC_VERSION@" CACHE STRING "") | |
424 | endif() | |
425 | if(FFMPEG_libavdevice_FOUND) | |
426 | set(FFMPEG_libavdevice_VERSION "@LIBAVDEVICE_VERSION@" CACHE STRING "") | |
427 | endif() | |
428 | if(FFMPEG_libavfilter_FOUND) | |
429 | set(FFMPEG_libavfilter_VERSION "@LIBAVFILTER_VERSION@" CACHE STRING "") | |
430 | endif() | |
431 | if(FFMPEG_libavformat_FOUND) | |
432 | set(FFMPEG_libavformat_VERSION "@LIBAVFORMAT_VERSION@" CACHE STRING "") | |
433 | endif() | |
434 | if(FFMPEG_libavresample_FOUND) | |
435 | set(FFMPEG_libavresample_VERSION "@LIBAVRESAMPLE_VERSION@" CACHE STRING "") | |
436 | endif() | |
437 | if(FFMPEG_libswresample_FOUND) | |
438 | set(FFMPEG_libswresample_VERSION "@LIBSWRESAMPLE_VERSION@" CACHE STRING "") | |
439 | endif() | |
440 | if(FFMPEG_libswscale_FOUND) | |
441 | set(FFMPEG_libswscale_VERSION "@LIBSWSCALE_VERSION@" CACHE STRING "") | |
442 | endif() | |
443 | ||
444 | list(APPEND FFMPEG_LIBRARIES | |
445 | ${FFMPEG_PLATFORM_DEPENDENT_LIBS} | |
446 | ) | |
447 | ||
448 | set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES}) | |
449 | ||
450 | set(FFMPEG_FOUND TRUE CACHE BOOL "") | |
451 | set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "") | |
452 | set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "") | |
453 | set(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBRARY_DIRS} CACHE STRING "") | |
454 | endif() | |
455 | ||
456 | find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_LIBRARY_DIRS FFMPEG_INCLUDE_DIRS) | |
457 | ||
458 | endif() |