build: Add meson build system files

This commit is contained in:
Bastien Nocera
2020-06-26 16:41:59 +02:00
parent 52e701aa8a
commit cf1ac31f55
5 changed files with 220 additions and 0 deletions

22
data/meson.build Normal file
View File

@@ -0,0 +1,22 @@
install_data(
'80-iio-sensor-proxy.rules',
install_dir: udev_rules_dir
)
data_conf = configuration_data()
data_conf.set('sbindir', sbindir)
data_conf.set('geoclue_user', get_option('geoclue-user'))
configure_file(
input: 'iio-sensor-proxy.service.in',
output: 'iio-sensor-proxy.service',
configuration: data_conf,
install_dir: systemd_system_unit_dir,
)
configure_file(
input: 'net.hadess.SensorProxy.conf.in',
output: 'net.hadess.SensorProxy.conf',
configuration: data_conf,
install_dir: dbusconfdir
)

47
docs/meson.build Normal file
View File

@@ -0,0 +1,47 @@
content_files = files()
version_conf = configuration_data()
version_conf.set('VERSION', meson.project_version())
content_files += configure_file(
input: 'version.xml.in',
output: 'version.xml',
configuration: version_conf,
)
content_files += gnome.gdbus_codegen(
meson.project_name(),
sources: meson.source_root() / 'src' / 'net.hadess.SensorProxy.xml',
interface_prefix: 'net.hadess',
namespace: 'SensorProxy',
docbook: 'docs',
build_by_default: true,
)
gnome.gtkdoc(
meson.project_name(),
main_xml: meson.project_name() + '-docs.xml',
content_files: content_files,
src_dir: [
meson.source_root() /'src',
meson.build_root() / 'src',
],
ignore_headers: ['drivers.h', 'iio-buffer-utils.h', 'orientation.h', 'uinput.h', 'accel-mount-matrix.h'],
scan_args: ['--rebuild-sections'],
)
man1_dir = join_paths(get_option('prefix'), get_option('mandir'), 'man1')
xsltproc = find_program('xsltproc', required : true)
xsltproc_command = [
xsltproc,
'--nonet',
'--stringparam', 'man.output.quietly', '1',
'--stringparam', 'funcsynopsis.style', 'ansi',
'--stringparam', 'man.th.extra1.suppress', '1',
'--stringparam', 'man.authors.section.enabled', '0',
'--stringparam', 'man.copyright.section.enabled', '0',
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
]

62
meson.build Normal file
View File

@@ -0,0 +1,62 @@
project('iio-sensor-proxy', [ 'c' ],
version: '2.5',
license: 'GPLv2+',
default_options: [
'buildtype=debugoptimized',
'warning_level=1',
'c_std=c99',
],
meson_version: '>= 0.54.0')
cc = meson.get_compiler('c')
common_cflags = cc.get_supported_arguments([
'-fgnu89-inline',
'-fvisibility=hidden',
'-std=gnu99',
'-Wall',
'-Wundef',
'-Wunused',
'-Wstrict-prototypes',
'-Werror-implicit-function-declaration',
'-Wno-pointer-sign',
'-Wshadow'
])
sbindir = get_option('sbindir')
bindir = get_option('bindir')
dbusconfdir = get_option('sysconfdir') / 'dbus-1' / 'system.d'
mathlib_dep = cc.find_library('m', required: false)
udev_rules_dir = get_option('udevrulesdir')
if udev_rules_dir == 'auto'
udev_dep = dependency('udev')
udev_rules_dir = udev_dep.get_pkgconfig_variable('udevdir') + '/rules.d'
endif
systemd_system_unit_dir = get_option('systemdsystemunitdir')
if systemd_system_unit_dir == 'auto'
systemd_dep = dependency('systemd')
systemd_system_unit_dir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
endif
if get_option('gtk-tests')
gtk_dep = dependency('gtk+-3.0', required: false)
endif
gio_dep = dependency('gio-2.0')
gudev_dep = dependency('gudev-1.0', version: '>= 232')
gnome = import('gnome')
add_global_arguments('-D_GNU_SOURCE=1', language: 'c')
subdir('src')
subdir('data')
if get_option('gtk_doc')
# Make like license available in the build root for docs
configure_file(
input: 'COPYING',
output: 'COPYING',
copy: true,
)
subdir('docs')
endif

20
meson_options.txt Normal file
View File

@@ -0,0 +1,20 @@
option('udevrulesdir',
description: 'udev rules directory',
type: 'string',
value: 'auto')
option('systemdsystemunitdir',
description: 'systemd unit directory',
type: 'string',
value: 'auto')
option('gtk-tests',
description: 'Whether to build GTK tests',
type: 'boolean',
value: false)
option('geoclue-user',
description: 'The USER (existing) as which geoclue service is running',
type: 'string',
value: 'geoclue')
option('gtk_doc',
type: 'boolean',
value: false,
description: 'Build docs')

69
src/meson.build Normal file
View File

@@ -0,0 +1,69 @@
deps = [ gio_dep, gudev_dep, mathlib_dep ]
resources = gnome.compile_resources(
'iio-sensor-proxy-resources', 'iio-sensor-proxy.gresource.xml',
c_name: 'iio_sensor_proxy',
source_dir: '.',
export: true
)
sources = [
'iio-sensor-proxy.c',
'drivers.c',
'orientation.c',
'drv-iio-buffer-accel.c',
'drv-iio-poll-accel.c',
'drv-input-accel.c',
'drv-fake-compass.c',
'drv-fake-light.c',
'drv-iio-poll-light.c',
'drv-hwmon-light.c',
'drv-iio-buffer-light.c',
'drv-iio-buffer-compass.c',
'drv-iio-poll-proximity.c',
'iio-buffer-utils.c',
'accel-mount-matrix.c',
'accel-scale.c',
'accel-attributes.c',
resources,
]
executable('iio-sensor-proxy',
sources,
dependencies: deps,
install: true,
install_dir: sbindir
)
executable('fake-input-accelerometer',
[ 'fake-input-accelerometer.c' ],
dependencies: deps,
install: false
)
executable('test-mount-matrix',
[ 'test-mount-matrix.c', 'accel-mount-matrix.c' ],
dependencies: deps,
install: false
)
executable('test-orientation',
[ 'test-orientation.c', 'orientation.c', 'accel-mount-matrix.c', 'accel-scale.c' ],
dependencies: deps,
install: false
)
if get_option('gtk-tests')
executable('test-orientation-gtk',
[ 'test-orientation-gtk.c', 'orientation.c', 'accel-scale.c' ],
dependencies: [ deps, gtk_dep ],
install: false
)
endif
executable('monitor-sensor',
[ 'monitor-sensor.c' ],
dependencies: gio_dep,
install: true,
install_dir: bindir
)