-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
95 lines (81 loc) · 2.64 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.0)
project(FFmpegExamples)
# Names of libraries the FFmpeg consists of
set(
ffmpeg_lib_names
avutil
avcodec
avformat
avfilter
avdevice
postproc
swscale
swresample
)
# Names of header files that are 'main entry' for a respective library
set(
ffmpeg_headers_to_find
libavutil/avutil.h
libavcodec/avcodec.h
libavformat/avformat.h
libavfilter/avfilter.h
libavdevice/avdevice.h
libpostproc/postprocess.h # here the name of a header file differs from the library name
libswscale/swscale.h
libswresample/swresample.h
)
# Names of official examples of FFmpeg that are integrated to this project
set(
example_names
avio_list_dir
avio_reading
decode_audio
decode_video
demuxing_decoding
encode_audio
encode_video
extract_mvs
filter_audio
filtering_audio
filtering_video
http_multiclient
hw_decode
metadata
muxing
remuxing
resampling_audio
scaling_video
transcode_aac
transcoding
# The Intel Quick Sync Video (QSV) example will work if these conditions are met:
# - building happens NOT on macOS
# - the libmfx-dev package is installed (available on Ubuntu 19.10+)
# - there is a custom ffmpeg built with --enable-libmfx and installed
# qsvdec
# The Video Acceleration API (VAAPI) examples will work if these conditions are met:
# - the libva-dev package is installed
# - there is a custom ffmpeg built with --enable-vaapi and installed
# vaapi_encode
# vaapi_transcode
)
# Function that adds FFmpeg libraries as dependencies to a specified target
# ARGV0 is a target name
# ARGV1+ vararg of dependencies to link against
function(add_ffmpeg_dependencies)
set(executable_name ${ARGV0})
math(EXPR dep_upper_bound "${ARGC} - 1")
foreach (dep_index RANGE 1 ${dep_upper_bound})
list(GET ARGV ${dep_index} dep_name)
list(FIND ffmpeg_lib_names ${dep_name} lib_index)
list(GET ffmpeg_headers_to_find ${lib_index} dep_header)
find_path( ${dep_name}_include_dir ${dep_header} )
find_library( ${dep_name}_library ${dep_name} )
target_include_directories( ${executable_name} PRIVATE ${${dep_name}_include_dir} )
target_link_libraries( ${executable_name} PRIVATE ${${dep_name}_library})
endforeach ()
endfunction()
foreach (example_name ${example_names})
add_subdirectory(examples/${example_name})
endforeach ()
# Additional playground module
add_subdirectory(playground)