[TF2/Filter] Added a framework to support TF2-Lite (2.3.0)
[platform/upstream/nnstreamer.git] / tests / meson.build
1 # These custom filters are used in unittest_sink.
2 library('nnscustom_framecounter',
3   join_paths('nnstreamer_sink', 'nnscustom_framecounter.c'),
4   dependencies: [glib_dep, gst_dep, nnstreamer_dep],
5   install: get_option('install-test'),
6   install_dir: customfilter_install_dir
7 )
8
9 library('nnscustom_drop_buffer',
10   join_paths('nnstreamer_sink', 'nnscustom_drop_buffer.c'),
11   dependencies: [glib_dep, gst_dep, nnstreamer_dep],
12   install: get_option('install-test'),
13   install_dir: customfilter_install_dir
14 )
15
16 # Build and copy exe for ssat
17 copy = find_program('cp', required: true)
18 libpng_dep = dependency('libpng', required: false)
19 if libpng_dep.found()
20   b2p = executable('bmp2png',
21     'bmp2png.c',
22     dependencies: [libpng_dep, glib_dep],
23     install: get_option('install-test'),
24     install_dir: unittest_install_dir
25   )
26
27   custom_target('copy-bmp2png',
28     input: b2p,
29     output: 'b2p',
30     command: [copy, '@INPUT@', meson.current_source_dir()],
31     build_by_default: true
32   )
33 endif
34
35 # ssat repo_dynamic
36 subdir('nnstreamer_repo_dynamicity')
37
38 # filter_reload (Currently, the reload test for tensor filter requires tflite)
39 if tflite_support_is_available
40   subdir('nnstreamer_filter_reload')
41 endif
42
43 # gtest
44 gtest_dep = dependency('gtest', required: false)
45 if gtest_dep.found()
46   nnstreamer_unittest_deps = [
47     nnstreamer_dep,
48     nnstreamer_internal_deps,
49     glib_dep,
50     gst_dep,
51     gst_app_dep,
52     gst_check_dep,
53     gtest_dep
54   ]
55
56   # Shared library of internal APIs for nnstreamer-gtest
57   unittest_util_shared = shared_library('nnstreamer_unittest_util',
58     join_paths(meson.current_source_dir(), 'unittest_util.c'),
59     dependencies: nnstreamer_base_deps,
60     include_directories: nnstreamer_inc,
61     install: get_option('install-test'),
62     install_dir: nnstreamer_libdir
63   )
64   unittest_util_dep = declare_dependency(link_with: unittest_util_shared,
65     dependencies: nnstreamer_base_deps,
66     include_directories: include_directories('.')
67   )
68
69   # Run unittest_common
70   unittest_common = executable('unittest_common',
71     join_paths('common', 'unittest_common.cc'),
72     dependencies: [nnstreamer_unittest_deps],
73     install: get_option('install-test'),
74     install_dir: unittest_install_dir
75   )
76
77   test('unittest_common', unittest_common, env: testenv)
78
79   # Run unittest_sink
80   gst18_dep = dependency('gstreamer-' + gst_api_verision, version : '>=1.8', required : false)
81   if gst18_dep.found()
82     unittest_sink = executable('unittest_sink',
83       join_paths('nnstreamer_sink', 'unittest_sink.cc'),
84       dependencies: [nnstreamer_unittest_deps, unittest_util_dep],
85       install: get_option('install-test'),
86       install_dir: unittest_install_dir
87     )
88
89     test('unittest_sink', unittest_sink, timeout: 120, env: testenv)
90
91     # Run unittest_plugins
92     unittest_plugins = executable('unittest_plugins',
93       join_paths('nnstreamer_plugins', 'unittest_plugins.cc'),
94       dependencies: [nnstreamer_unittest_deps],
95       install: get_option('install-test'),
96       install_dir: unittest_install_dir
97     )
98
99     test('unittest_plugins', unittest_plugins, env: testenv)
100
101   # Run unittest_src_iio
102     if build_platform != 'macos'
103       unittest_src_iio = executable('unittest_src_iio',
104         join_paths('nnstreamer_source', 'unittest_src_iio.cc'),
105         dependencies: [nnstreamer_unittest_deps, unittest_util_dep],
106         install: get_option('install-test'),
107         install_dir: unittest_install_dir
108       )
109
110       test('unittest_src_iio', unittest_src_iio, timeout: 120, env: testenv)
111     endif
112   endif
113
114   # Armnn unittest
115   if armnn_support_is_available
116     unittest_filter_armnn = executable('unittest_filter_armnn',
117       join_paths('nnstreamer_filter_armnn', 'unittest_filter_armnn.cc'),
118       dependencies: [glib_dep, gst_dep, nnstreamer_dep, gtest_dep, armnn_plugin_dep],
119       install: get_option('install-test'),
120       install_dir: unittest_install_dir
121     )
122
123     test('unittest_filter_armnn', unittest_filter_armnn, env: testenv)
124   endif
125
126   # Tizen C-API
127   if get_option('enable-capi')
128     subdir('tizen_capi')
129   endif
130
131   # Tensor filter extensions basic test cases
132   subdir('nnstreamer_filter_extensions_common')
133
134   # Tizen NNFW runtime
135   if nnfw_runtime_support_is_available
136     subdir('tizen_nnfw_runtime')
137   endif
138
139   if tflite_support_is_available and get_option('enable-edgetpu')
140     subdir('nnstreamer_filter_edgetpu')
141   endif
142
143   if mvncsdk2_support_is_available
144     subdir('nnstreamer_filter_mvncsdk2')
145   endif
146
147   if get_option('enable-cppfilter')
148     subdir('cpp_methods')
149   endif
150
151   if get_option('enable-openvino')
152     subdir('nnstreamer_filter_openvino')
153   endif
154 endif # gtest_dep.found()
155
156 # Install data required for unittest
157 unittest_tests_install_dir = join_paths(unittest_install_dir,'tests')
158
159 tensor_filter_ext_enabled = tflite_support_is_available or \
160     tf_support_is_available or \
161     have_python2 or have_python3 or \
162     pytorch_support_is_available or caffe2_support_is_available or \
163     nnfw_runtime_support_is_available or get_option('enable-edgetpu') or \
164     mvncsdk2_support_is_available or get_option('enable-openvino')
165 if get_option('install-test') and (get_option('enable-capi') or tensor_filter_ext_enabled)
166   install_subdir('test_models', install_dir: unittest_tests_install_dir)
167 endif
168
169
170 # Install Unittest
171 if get_option('install-test')
172   install_data('gen24bBMP.py', install_dir: unittest_tests_install_dir)
173   install_subdir('nnstreamer_converter', install_dir: unittest_tests_install_dir)
174   install_subdir('nnstreamer_merge', install_dir: unittest_tests_install_dir)
175   install_subdir('nnstreamer_decoder', install_dir: unittest_tests_install_dir)
176   install_subdir('nnstreamer_demux', install_dir: unittest_tests_install_dir)
177   install_subdir('nnstreamer_filter_custom', install_dir: unittest_tests_install_dir)
178   if tflite_support_is_available
179     install_subdir('nnstreamer_filter_tensorflow_lite', install_dir: unittest_tests_install_dir)
180     install_subdir('nnstreamer_decoder_image_labeling', install_dir: unittest_tests_install_dir)
181     install_subdir('nnstreamer_filter_reload', install_dir: unittest_tests_install_dir)
182   endif
183   if tflite2_support_is_available
184     install_subdir('nnstreamer_filter_tensorflow2_lite', install_dir: unittest_tests_install_dir)
185   endif
186   if have_python2 or have_python3
187     install_subdir('nnstreamer_filter_python', install_dir: unittest_tests_install_dir)
188   endif
189   if tf_support_is_available
190     install_subdir('nnstreamer_filter_tensorflow', install_dir: unittest_tests_install_dir)
191   endif
192   if pytorch_support_is_available
193     install_subdir('nnstreamer_filter_pytorch', install_dir: unittest_tests_install_dir)
194   endif
195   if caffe2_support_is_available
196     install_subdir('nnstreamer_filter_caffe2', install_dir: unittest_tests_install_dir)
197   endif
198   if mvncsdk2_support_is_available
199     install_subdir('unittest_filter_mvncsdk2', install_dir: unittest_tests_install_dir)
200   endif
201   install_subdir('nnstreamer_mux', install_dir: unittest_tests_install_dir)
202   install_subdir('nnstreamer_repo', install_dir: unittest_tests_install_dir)
203   install_subdir('nnstreamer_repo_dynamicity', install_dir: unittest_tests_install_dir)
204   install_subdir('nnstreamer_repo_lstm', install_dir: unittest_tests_install_dir)
205   install_subdir('nnstreamer_repo_rnn', install_dir: unittest_tests_install_dir)
206   install_subdir('nnstreamer_split', install_dir: unittest_tests_install_dir)
207   install_subdir('transform_arithmetic', install_dir: unittest_tests_install_dir)
208   install_subdir('transform_dimchg', install_dir: unittest_tests_install_dir)
209   install_subdir('transform_stand', install_dir: unittest_tests_install_dir)
210   install_subdir('transform_transpose', install_dir: unittest_tests_install_dir)
211   install_subdir('transform_typecast', install_dir: unittest_tests_install_dir)
212   if get_option('enable-cppfilter')
213     install_subdir('cpp_methods', install_dir: unittest_tests_install_dir)
214   endif
215 endif