-
-
Notifications
You must be signed in to change notification settings - Fork 334
/
meson.build
151 lines (129 loc) · 4.53 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
146
147
148
149
150
151
project ('aravis', 'c', 'cpp', version: '0.9.0', meson_version: '>=0.57.0')
gnome = import('gnome')
pkg = import ('pkgconfig')
aravis_version = meson.project_version ()
aravis_api_version = '0.10'
versions = aravis_version.split ('.')
aravis_major_version = versions[0].to_int ()
aravis_minor_version = versions[1].to_int ()
aravis_micro_version = versions[2].to_int ()
aravis_data_dir = get_option ('datadir') / 'aravis-@0@'.format (aravis_api_version)
cc = meson.get_compiler ('c')
cxx = meson.get_compiler ('cpp')
if cc.get_id()=='gcc' or cc.get_id()=='clang'
warning_c_args = [
'-Wduplicated-branches',
'-Wimplicit-fallthrough',
'-Wmisleading-indentation',
'-Wstrict-prototypes',
'-Wunused',
'-Wunused-variable',
'-Wdeclaration-after-statement',
'-Wformat=2',
'-Wimplicit-function-declaration',
'-Winit-self',
'-Wmissing-include-dirs',
'-Wmissing-prototypes',
'-Wpointer-arith',
'-Wformat-nonliteral',
'-Wenum-conversion',
'-Wmaybe-uninitialized'
]
add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
elif cc.get_id()=='msvc'
warning_c_args = [
'/wd4244', # Disable int-float implicit casting warnings
'/wd4090', # Disable const qualifiers warnings
'/utf-8'
]
add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
endif
if cc.get_id() == 'msvc'
cc_export_define = '__declspec(dllexport) extern'
elif cc.has_argument('-fvisibility=hidden')
add_project_arguments('-fvisibility=hidden', language: 'c')
cc_export_define = 'extern __attribute__ ((visibility ("default")))'
else
cc_export_define = 'extern'
endif
glib_dep = dependency ('glib-2.0', version: '>=2.58', required: true)
gobject_dep = dependency ('gobject-2.0', required: true)
gio_dep = dependency ('gio-2.0', required: true)
xml2_dep = dependency ('libxml-2.0', required: true)
libz_dep = dependency ('zlib', required: true)
usb_dep = dependency ('libusb-1.0', required: get_option ('usb'))
gmodule_dep = dependency ('gmodule-2.0', required: true)
gudev_dep = dependency ('gudev-1.0', required: get_option('v4l2'))
aravis_public_dependencies = [glib_dep, gobject_dep, gio_dep]
aravis_dependencies = [aravis_public_dependencies, xml2_dep, libz_dep, gmodule_dep]
if cc.get_id()!='msvc'
libm = cc.find_library ('m', required: true)
aravis_dependencies += libm
endif
if usb_dep.found()
aravis_dependencies += usb_dep
endif
if gudev_dep.found()
aravis_dependencies += gudev_dep
v4l2_enabled = true
else
v4l2_enabled = false
endif
if host_machine.system()=='windows'
aravis_dependencies += [
cc.find_library('ws2_32', required: true), # socket functions
cc.find_library('iphlpapi', required: true) # GetAdaptersAddresses
]
endif
packet_socket_option = get_option('packet-socket')
if host_machine.system()=='linux'
has_if_packet = cc.has_header ('linux' /'if_packet.h')
if packet_socket_option.enabled()
if not has_if_packet
error ('missing header for packet-socket support')
endif
packet_socket_enabled = true
else
packet_socket_enabled = has_if_packet and packet_socket_option.auto()
endif
else # not Linux
if packet_socket_option.enabled()
warning('packet-socket option ignored on non-Linux')
endif
packet_socket_enabled = false
endif
subdir ('src')
subdir ('tests')
viewer_enabled = false
viewer_option = get_option ('viewer')
viewer_deps = aravis_dependencies + [dependency ('gtk+-3.0', version: '>=3.12', required: viewer_option),
dependency ('gstreamer-base-1.0', required: viewer_option),
dependency ('gstreamer-app-1.0', required: viewer_option),
dependency ('gstreamer-video-1.0', required: viewer_option)]
subdir ('po', if_found: viewer_deps)
subdir ('viewer', if_found: viewer_deps)
gst_enabled = false
gst_option = get_option ('gst-plugin')
gst_deps = aravis_dependencies + [dependency ('gstreamer-base-1.0', required: gst_option),
dependency ('gstreamer-app-1.0', required: gst_option)]
subdir('gst', if_found: gst_deps)
doc_deps = dependency ('gi-docgen', version:'>= 2021.1', fallback: ['gi-docgen', 'dummy_dep'], required:get_option('documentation'))
subdir('docs', if_found: doc_deps)
meson.override_dependency ('aravis-' + aravis_api_version, aravis_library_dependencies)
summary (
{
'prefix': get_option('prefix'),
'bindir': get_option('bindir'),
'libdir': get_option('libdir'),
'datadir': get_option('datadir'),
},
section: 'Directories'
)
summary (
{
'Viewer': viewer_enabled,
'GStreamer plugin': gst_enabled,
'USB support': usb_dep.found(),
},
section: 'Options'
)