-
Notifications
You must be signed in to change notification settings - Fork 44
/
meson.build
145 lines (124 loc) · 4.64 KB
/
meson.build
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Project Declaration
project('gst-hailo-tools', 'c', 'cpp',
version : '3.30.0',
default_options : [ 'buildtype=release',
'c_std=c11', 'cpp_std=c++17']
)
# Compiler Arguments
compiler = meson.get_compiler('cpp')
compiler_version = compiler.version().split('.')[0].to_int()
if compiler_version >= 9
message('GCC >= 9.0.0 detected, applying extra arguments.')
add_global_arguments('-Wpessimizing-move', language : 'cpp')
add_global_arguments('-Wredundant-move', language : 'cpp')
add_global_arguments('-fconcepts', language : 'cpp')
endif
# Include Directories
hailo_general_inc = [include_directories('./general')]
hailo_mat_inc = [include_directories('./plugins/common/')]
# Xtensor Include Directories
xtensor_base_inc = include_directories(get_option('libxtensor'), is_system: true)
xtensor_inc = [xtensor_base_inc]
if get_option('include_blas')
xtensor_blas_inc = include_directories(get_option('libblas'), is_system: true)
xtensor_inc += [xtensor_blas_inc]
endif
# Extra Compiler Arguments
xtensor_args = [] # '-mavx2', '-ffast-math' --> TODO: Causes arm issues
debug_args = ['-g', '-O0']
# Gstreamer Dependencies
gst_req = '>= 1.0.0'
gst_dep = dependency('gstreamer-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_dep'])
gst_base_dep = dependency('gstreamer-base-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_base_dep'])
gst_app_dep = dependency('gstreamer-app-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_app_dep'])
gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
fallback : ['gst-plugins-base', 'video_dep'])
# Opencv Dependencies
opencv_dep = dependency('opencv4', version : '>= 4.0', method : 'pkg-config')
if get_option('include_python')
# GObject dependencies
glib_dep = dependency('glib-2.0')
gmod_dep = dependency('gmodule-2.0')
gobj_dep = dependency('gobject-2.0')
pygobj_dep = dependency('pygobject-3.0')
gx_deps = [glib_dep, gmod_dep, gobj_dep, pygobj_dep]
# Pybind Include Directories
pymod = import('python')
python_version = 'python' + get_option('python_version')
python_installation = pymod.find_installation(python_version)
python_dep = python_installation.dependency(embed : true)
python_package_install_dir = run_command(python_version, '-m', 'pip', 'show', 'pip').stdout().split('Location:')[1].split()[0]
pybind_inc = [include_directories(get_option('pybind11'), is_system: true)]
# Pybind Dependecy
pybind_dep = declare_dependency(
compile_args : [
# see https://github.com/pybind/pybind11/issues/1604
'-fsized-deallocation',
'-fvisibility=hidden'
],
include_directories : pybind_inc,
dependencies : [python_dep],
)
endif
# Plugin Dependencies
plugin_deps = [gst_dep, gst_base_dep, gstvideo_dep, gst_app_dep]
post_deps = []
if get_option('include_blas')
is_ub20 = run_command('lsb_release', '-r').stdout().contains('20.04')
if is_ub20
libblas_dep = dependency('blas', version :'== 3.9.0')
liblapack_dep = dependency('lapack', version :'== 3.9.0')
else
libblas_dep = dependency('blas', version :'== 3.7.1')
liblapack_dep = dependency('lapack', version :'== 3.7.1')
endif
post_deps += [libblas_dep, liblapack_dep]
plugin_deps += [libblas_dep, liblapack_dep]
endif
# Library Arguments
hailo_lib_args = get_option('libargs')
tappas_workspace = meson.current_source_dir() + '/../../'
post_proc_install_dir = get_option('post_processes_install_dir')
if post_proc_install_dir == ''
# By default install for x86 workspace
post_proc_install_dir = tappas_workspace + '/apps/h8/gstreamer/libs/post_processes/'
endif
target = get_option('target')
# Project Subdirectories
if target in ['all','apps','libs']
cxxopts_inc_dir = get_option('libcxxopts')
# cxxopts Include Directories
cxxopts_inc = [include_directories(cxxopts_inc_dir, is_system: true)]
endif
if target in ['all','libs','unit_tests','plugins']
rapidjson_inc_dir = get_option('librapidjson')
# rapidjson Include Directories
rapidjson_inc = [include_directories(rapidjson_inc_dir, is_system: true)]
endif
libs_postprocesses_dep = declare_dependency(
include_directories: [include_directories('./libs/postprocesses')])
if target == 'all'
subdir('metadata')
subdir('tracking')
subdir('plugins')
subdir('libs')
subdir('apps')
subdir('tracers')
elif target == 'apps'
subdir('metadata')
subdir('tracking')
subdir(target)
elif target == 'plugins'
subdir('metadata')
subdir('tracking')
subdir(target)
elif target == 'libs'
subdir('tracking')
subdir(target)
elif target == 'tracers'
subdir('metadata')
subdir(target)
endif