[Filter] Remove gst dep from single-shot
[platform/upstream/nnstreamer.git] / tests / meson.build
1 # Build nnstreamer subplugins and apps for test cases
2 subdir('nnstreamer_example')
3
4 # Set unittest install dir
5 unittest_install_dir = join_paths(unittest_base_dir, 'tests')
6
7 # Build and copy exe for ssat
8 copy = find_program('cp', required: true)
9 libpng_dep = dependency('libpng', required: false)
10 if libpng_dep.found()
11   b2p = executable('bmp2png',
12     'bmp2png.c',
13     dependencies: [libpng_dep, glib_dep],
14     install: get_option('install-test'),
15     install_dir: unittest_install_dir
16   )
17
18   custom_target('copy-bmp2png',
19     input: b2p,
20     output: 'b2p',
21     command: [copy, '@INPUT@', meson.current_source_dir()],
22     build_by_default: true
23   )
24 endif
25
26 # ssat repo_dynamic
27 subdir('nnstreamer_repo_dynamicity')
28
29 # filter_reload (Currently, the reload test for tensor filter requires tflite)
30 if tflite_support_is_available
31   subdir('nnstreamer_filter_reload')
32 endif
33
34 # gtest
35 gtest_dep = dependency('gtest', required: false)
36 if gtest_dep.found()
37   lesser_code_quality_accepted_for_unittest_code = declare_dependency(compile_args: ['-Wno-unused-parameter', '-Wno-missing-field-initializers'])
38
39   # Shared library of internal APIs for nnstreamer-gtest
40   unittest_util_shared = shared_library('nnstreamer_unittest_util',
41     join_paths(meson.current_source_dir(), 'unittest_util.c'),
42     dependencies: nnstreamer_dep,
43     include_directories: nnstreamer_inc,
44     install: get_option('install-test'),
45     install_dir: nnstreamer_libdir
46   )
47   unittest_util_dep = declare_dependency(link_with: unittest_util_shared,
48     dependencies: nnstreamer_dep,
49     compile_args: ['-DFAKEDLOG=1'],
50     include_directories: include_directories('.')
51   )
52
53   nnstreamer_unittest_deps = [
54     unittest_util_dep,
55     nnstreamer_internal_deps,
56     glib_dep,
57     gst_dep,
58     gst_app_dep,
59     gst_check_dep,
60     gtest_dep,
61     lesser_code_quality_accepted_for_unittest_code
62   ]
63
64   # Run unittest_common
65   unittest_common = executable('unittest_common',
66     join_paths('common', 'unittest_common.cc'),
67     dependencies: [nnstreamer_unittest_deps],
68     install: get_option('install-test'),
69     install_dir: unittest_install_dir
70   )
71
72   test('unittest_common', unittest_common, env: testenv)
73
74   # Run unittest_sink
75   gst18_dep = dependency('gstreamer-' + gst_api_verision, version : '>=1.8', required : false)
76   if gst18_dep.found()
77     unittest_sink = executable('unittest_sink',
78       join_paths('nnstreamer_sink', 'unittest_sink.cc'),
79       dependencies: [nnstreamer_unittest_deps],
80       install: get_option('install-test'),
81       install_dir: unittest_install_dir
82     )
83
84     test('unittest_sink', unittest_sink, timeout: 120, env: testenv)
85
86     # Run unittest_plugins
87     unittest_plugins = executable('unittest_plugins',
88       join_paths('nnstreamer_plugins', 'unittest_plugins.cc'),
89       dependencies: [nnstreamer_unittest_deps],
90       install: get_option('install-test'),
91       install_dir: unittest_install_dir
92     )
93
94     test('unittest_plugins', unittest_plugins, env: testenv)
95
96     # Run unittest_if
97     unittest_if = executable('unittest_if',
98       join_paths('nnstreamer_if', 'unittest_if.cc'),
99       dependencies: [nnstreamer_unittest_deps],
100       install: get_option('install-test'),
101       install_dir: unittest_install_dir
102     )
103
104     test('unittest_if', unittest_if, env: testenv)
105
106     # Run unittest_rate
107     unittest_rate = executable('unittest_rate',
108       join_paths('nnstreamer_rate', 'unittest_rate.cc'),
109       dependencies: [nnstreamer_unittest_deps],
110       install: get_option('install-test'),
111       install_dir: unittest_install_dir
112     )
113
114     test('unittest_rate', unittest_rate, env: testenv)
115
116     # Run unittest_filter_single
117     unittest_filter_single = executable('unittest_filter_single',
118       join_paths('nnstreamer_filter_single', 'unittest_filter_single.cc'),
119       dependencies: [nnstreamer_unittest_deps],
120       install: get_option('install-test'),
121       install_dir: unittest_install_dir
122     )
123
124     test('unittest_filter_single', unittest_filter_single, env: testenv)
125
126     # Run unittest_join
127     unittest_join = executable('unittest_join',
128       join_paths('gstreamer_join', 'unittest_join.cc'),
129       dependencies: [nnstreamer_unittest_deps, join_dep],
130       install: get_option('install-test'),
131       install_dir: unittest_install_dir
132     )
133
134     test('unittest_join', unittest_join, env: testenv)
135
136     # Run unittest_query
137     unittest_query = executable('unittest_query',
138       join_paths('nnstreamer_query', 'unittest_query.cc'),
139       dependencies: [nnstreamer_unittest_deps],
140       install: get_option('install-test'),
141       install_dir: unittest_install_dir
142     )
143
144     test('unittest_query', unittest_query, env: testenv)
145
146     # Run unittest_mqtt
147     if mqtt_support_is_available
148       unittest_mqtt_w_helper = executable('unittest_mqtt_w_helper',
149           join_paths('gstreamer_mqtt', 'unittest_mqtt_w_helper.cc'),
150           dependencies: [gstmqtt_mocking_dep, nnstreamer_unittest_deps],
151           install: get_option('install-test'),
152           install_dir: unittest_install_dir)
153
154       test('unittest_mqtt_w_helper', unittest_mqtt_w_helper, env: testenv)
155
156       unittest_mqtt = executable('unittest_mqtt',
157           join_paths('gstreamer_mqtt', 'unittest_mqtt.cc'),
158           dependencies: [nnstreamer_unittest_deps],
159           install: get_option('install-test'),
160           install_dir: unittest_install_dir)
161
162       test('unittest_mqtt', unittest_mqtt, env: testenv)
163     endif
164
165     # Run unittest_src_iio
166     if build_platform != 'macos'
167       unittest_src_iio = executable('unittest_src_iio',
168         join_paths('nnstreamer_source', 'unittest_src_iio.cc'),
169         dependencies: [nnstreamer_unittest_deps],
170         install: get_option('install-test'),
171         install_dir: unittest_install_dir
172       )
173
174       test('unittest_src_iio', unittest_src_iio, timeout: 120, env: testenv)
175     endif
176
177     # Run unittest_converter
178     if flatbuf_support_is_available
179       unittest_converter = executable('unittest_converter',
180         join_paths('nnstreamer_converter', 'unittest_converter.cc'),
181         dependencies: [nnstreamer_unittest_deps, flatbuf_dep, nnstreamer_python3_helper_dep],
182         install: get_option('install-test'),
183         install_dir: unittest_install_dir
184       )
185
186       test('unittest_converter', unittest_converter, env: testenv)
187     endif
188   endif
189
190   # Armnn unittest
191   if armnn_support_is_available
192     unittest_filter_armnn = executable('unittest_filter_armnn',
193       join_paths('nnstreamer_filter_armnn', 'unittest_filter_armnn.cc'),
194       dependencies: [nnstreamer_unittest_deps, armnn_plugin_dep],
195       install: get_option('install-test'),
196       install_dir: unittest_install_dir
197     )
198
199     test('unittest_filter_armnn', unittest_filter_armnn, env: testenv)
200   endif
201
202   # Lua unittest
203   if lua_support_is_available
204     unittest_filter_lua = executable('unittest_filter_lua',
205       join_paths('nnstreamer_filter_lua', 'unittest_filter_lua.cc'),
206       dependencies: [nnstreamer_unittest_deps],
207       install: get_option('install-test'),
208       install_dir: unittest_install_dir
209     )
210
211     test('unittest_filter_lua', unittest_filter_lua, env: testenv)
212   endif
213
214   # SNPE unittest
215   if snpe_support_is_available
216     unittest_filter_snpe = executable('unittest_filter_snpe',
217       join_paths('nnstreamer_filter_snpe', 'unittest_filter_snpe.cc'),
218       dependencies: [nnstreamer_unittest_deps],
219       install: get_option('install-test'),
220       install_dir: unittest_install_dir
221     )
222
223     test('unittest_filter_snpe', unittest_filter_snpe, env: testenv)
224   endif
225
226   # tensorflow2-lite unittest
227   if tflite2_support_is_available
228     unittest_filter_tensorflow2_lite = executable('unittest_filter_tensorflow2_lite',
229       join_paths('nnstreamer_filter_tensorflow2_lite', 'unittest_filter_tensorflow2_lite.cc'),
230       dependencies: [nnstreamer_unittest_deps],
231       install: get_option('install-test'),
232       install_dir: unittest_install_dir
233     )
234
235     test('unittest_filter_tensorflow2_lite', unittest_filter_tensorflow2_lite, env: testenv)
236   endif
237
238   # Run unittest_decoder
239   if flatbuf_support_is_available
240     unittest_decoder = executable('unittest_decoder',
241       join_paths('nnstreamer_decoder', 'unittest_decoder.cc'),
242       dependencies: [nnstreamer_unittest_deps, flatbuf_dep],
243       install: get_option('install-test'),
244       install_dir: unittest_install_dir
245     )
246
247     test('unittest_decoder', unittest_decoder, env: testenv)
248   endif
249
250   # gRPC unittest
251   if grpc_support_is_available
252     unittest_grpc = executable('unittest_grpc',
253       join_paths('nnstreamer_grpc', 'unittest_grpc.cc'),
254       dependencies: nnstreamer_unittest_deps,
255       install: get_option('install-test'),
256       install_dir: unittest_install_dir
257     )
258
259     test('unittest_grpc', unittest_grpc, env: testenv)
260   endif
261
262   # Tizen sensor-src
263   if get_option('enable-tizen-sensor')
264     subdir('tizen_sensor')
265   endif
266
267   # Tensor filter extensions basic test cases
268   subdir('nnstreamer_filter_extensions_common')
269
270   # Tizen NNFW runtime
271   if nnfw_runtime_support_is_available
272     subdir('tizen_nnfw_runtime')
273   endif
274
275   if (tflite_support_is_available or tflite2_support_is_available) and get_option('enable-edgetpu')
276     subdir('nnstreamer_filter_edgetpu')
277   endif
278
279   if mvncsdk2_support_is_available
280     subdir('nnstreamer_filter_mvncsdk2')
281   endif
282
283   if tvm_support_is_available
284     subdir('nnstreamer_filter_tvm')
285   endif
286
287   if get_option('enable-cppfilter')
288     subdir('cpp_methods')
289   endif
290
291   if get_option('enable-openvino')
292     subdir('nnstreamer_filter_openvino')
293   endif
294 endif # gtest_dep.found()
295
296 tensor_filter_ext_enabled = tflite_support_is_available or \
297     tflite2_support_is_available or \
298     tf_support_is_available or \
299     have_python3 or \
300     pytorch_support_is_available or caffe2_support_is_available or \
301     nnfw_runtime_support_is_available or get_option('enable-edgetpu') or \
302     mvncsdk2_support_is_available or get_option('enable-openvino')
303 if get_option('install-test') and tensor_filter_ext_enabled
304   install_subdir('test_models', install_dir: unittest_install_dir)
305 endif
306
307
308 # Install Unittest
309 if get_option('install-test')
310   install_data('gen24bBMP.py', install_dir: unittest_install_dir)
311   install_data('test_utils.py', install_dir: unittest_install_dir)
312   install_subdir('nnstreamer_converter', install_dir: unittest_install_dir)
313   install_subdir('nnstreamer_merge', install_dir: unittest_install_dir)
314   install_subdir('nnstreamer_decoder', install_dir: unittest_install_dir)
315   install_subdir('nnstreamer_decoder_boundingbox', install_dir: unittest_install_dir)
316   install_subdir('nnstreamer_decoder_pose', install_dir: unittest_install_dir)
317   install_subdir('nnstreamer_demux', install_dir: unittest_install_dir)
318   install_subdir('nnstreamer_filter_custom', install_dir: unittest_install_dir)
319   if tflite_support_is_available
320     install_subdir('nnstreamer_filter_tensorflow_lite', install_dir: unittest_install_dir)
321     install_subdir('nnstreamer_decoder_image_labeling', install_dir: unittest_install_dir)
322     install_subdir('nnstreamer_decoder_image_segment', install_dir: unittest_install_dir)
323     install_subdir('nnstreamer_filter_reload', install_dir: unittest_install_dir)
324   endif
325   if tflite2_support_is_available
326     install_subdir('nnstreamer_filter_tensorflow2_lite', install_dir: unittest_install_dir)
327   endif
328   if have_python3
329     if flatbuf_support_is_available
330       install_subdir('nnstreamer_converter_python3', install_dir: unittest_install_dir)
331       install_subdir('nnstreamer_decoder_python3', install_dir: unittest_install_dir)
332     endif
333     install_subdir('nnstreamer_filter_python3', install_dir: unittest_install_dir)
334   endif
335   if tf_support_is_available
336     install_subdir('nnstreamer_filter_tensorflow', install_dir: unittest_install_dir)
337   endif
338   if pytorch_support_is_available
339     install_subdir('nnstreamer_filter_pytorch', install_dir: unittest_install_dir)
340   endif
341   if caffe2_support_is_available
342     install_subdir('nnstreamer_filter_caffe2', install_dir: unittest_install_dir)
343   endif
344   if flatbuf_support_is_available
345     install_subdir('nnstreamer_flatbuf', install_dir: unittest_install_dir)
346     install_subdir('nnstreamer_flexbuf', install_dir: unittest_install_dir)
347   endif
348   if protobuf_support_is_available
349     install_subdir('nnstreamer_protobuf', install_dir: unittest_install_dir)
350   endif
351   install_subdir('nnstreamer_mux', install_dir: unittest_install_dir)
352   install_subdir('nnstreamer_rate', install_dir: unittest_install_dir)
353   install_subdir('nnstreamer_repo', install_dir: unittest_install_dir)
354   install_subdir('nnstreamer_repo_dynamicity', install_dir: unittest_install_dir)
355   install_subdir('nnstreamer_repo_lstm', install_dir: unittest_install_dir)
356   install_subdir('nnstreamer_repo_rnn', install_dir: unittest_install_dir)
357   install_subdir('nnstreamer_split', install_dir: unittest_install_dir)
358   install_subdir('transform_arithmetic', install_dir: unittest_install_dir)
359   install_subdir('transform_clamp', install_dir: unittest_install_dir)
360   install_subdir('transform_dimchg', install_dir: unittest_install_dir)
361   install_subdir('transform_stand', install_dir: unittest_install_dir)
362   install_subdir('transform_transpose', install_dir: unittest_install_dir)
363   install_subdir('transform_typecast', install_dir: unittest_install_dir)
364 endif