meson: build tinyalsa plugin
[platform/upstream/gstreamer.git] / sys / meson.build
1 #FIXME
2 #subdir('acmenc')
3 #subdir('acmmp3dec')
4 subdir('androidmedia')
5 subdir('applemedia')
6 subdir('bluez')
7 subdir('d3dvideosink')
8 subdir('decklink')
9 subdir('directsound')
10 #subdir('dshowdecwrapper')
11 #subdir('dshowsrcwrapper')
12 #subdir('dshowvideosink')
13 subdir('dvb')
14 subdir('fbdev')
15 subdir('ipcpipeline')
16 subdir('kms')
17 subdir('msdk')
18 subdir('opensles')
19 subdir('shm')
20 subdir('tinyalsa')
21 subdir('uvch264')
22 subdir('vcd')
23 #subdir('vdpau')
24 subdir('wasapi')
25 subdir('winks')
26 subdir('winscreencap')
27
28 # CUDA dependency
29 cuda_dep = dependency('', required : false)
30 cudart_dep = dependency('', required : false)
31 cuda_libdir = ''
32 cuda_incdir = ''
33
34 if host_machine.system() == 'windows'
35   # On windows, CUDA_PATH env will be set by installer
36   cuda_root = run_command(python3, '-c', 'import os; print(os.environ.get("CUDA_PATH"))').stdout().strip()
37   if cuda_root != '' and cuda_root != 'None'
38     arc = ''
39     if build_machine.cpu_family() == 'x86_64'
40       arc = 'x64'
41     else
42       arc = 'Win32'
43     endif
44     cuda_libdir = join_paths (cuda_root, 'lib', arc)
45     cuda_incdir = join_paths (cuda_root, 'include')
46     cuda_lib = cc.find_library('cuda', dirs: cuda_libdir, required: false)
47     cudart_lib = cc.find_library('cudart', dirs: cuda_libdir, required: false)
48     if cuda_lib.found()
49       cuda_header_found = cc.has_header('cuda.h', args: '-I' + cuda_incdir)
50       cuda_lib_found = cc.has_function('cuInit', dependencies: cuda_lib)
51       if cuda_header_found and cuda_lib_found
52         cuda_dep = declare_dependency(include_directories: include_directories(cuda_incdir),
53                                       dependencies: cuda_lib)
54       endif
55     endif
56
57     if cudart_lib.found()
58       cudart_header_found = cc.has_header('cuda_runtime_api.h', args: '-I' + cuda_incdir)
59       cudart_lib_found = cc.has_function('cudaGetErrorString', dependencies: cudart_lib)
60       if cudart_header_found and cudart_lib_found
61         cudart_dep = declare_dependency(dependencies: cudart_lib)
62       endif
63     endif
64   endif
65 else
66   cuda_versions = [
67     '10.0',
68     '9.2',
69     '9.1',
70     '9.0',
71     '8.0',
72     '7.5',
73     '7.0',
74     '6.5',
75   ]
76   cuda_ver = ''
77
78   # FIXME: use break syntax when we use meson >= '0.49'
79   foreach v : cuda_versions
80     if cuda_ver == ''
81       cuda_dep = dependency('cuda-' + v, required: false)
82       cudart_dep = dependency('cudart-' + v, required: false)
83       if cuda_dep.found() and cudart_dep.found()
84         cuda_ver = v
85       endif
86     endif
87   endforeach
88
89   if cuda_dep.found()
90     cuda_header_found = cc.has_header('cuda.h', dependencies: cuda_dep)
91     cuda_lib_found = cc.has_function('cuInit', dependencies: cuda_dep)
92     if not cuda_header_found or not cuda_lib_found
93       message ('Missing required header and/or function in cuda dependency')
94       cuda_dep = dependency('', required : false)
95     endif
96   endif
97
98   if cudart_dep.found()
99     cudart_header_found = cc.has_header('cuda_runtime_api.h', dependencies: cudart_dep)
100     cudart_lib_found = cc.has_function('cudaGetErrorString', dependencies: cudart_dep)
101     if not cudart_header_found or not cudart_lib_found
102       message ('Missing required header and/or function in cudart dependency')
103       cudart_dep = dependency('', required : false)
104     endif
105   endif
106 endif
107
108 if cuda_dep.found() and cudart_dep.found()
109   subdir('nvdec')
110   subdir('nvenc')
111 elif get_option('nvdec').enabled()
112   error('The nvdec plugin was enabled explicitly, but required CUDA dependencies were not found.')
113 elif get_option('nvenc').enabled()
114   error('The nvenc plugin was enabled explicitly, but required CUDA dependencies were not found.')
115 endif