From 78c78432b92e2540285d7226d7f65b7eec0750eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 30 Aug 2024 04:16:48 +0200 Subject: [PATCH] build: Generalize spi drivers detection Don't be limited to elan only --- libfprint/meson.build | 2 +- meson.build | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/libfprint/meson.build b/libfprint/meson.build index b246720c..43289c7c 100644 --- a/libfprint/meson.build +++ b/libfprint/meson.build @@ -1,7 +1,7 @@ spi_sources = [] spi_headers = [] -if 'elanspi' in drivers +if enabled_spi_drivers.length() > 0 spi_headers = ['fpi-spi-transfer.h'] spi_sources = ['fpi-spi-transfer.c'] endif diff --git a/meson.build b/meson.build index e9a09c99..cd06ab54 100644 --- a/meson.build +++ b/meson.build @@ -97,6 +97,9 @@ cairo_dep = dependency('cairo', required: false) # introspection scanning and Gio-2.0.gir gobject_introspection = dependency('gobject-introspection-1.0', required: get_option('introspection')) +# SPI +have_spi = host_machine.system() == 'linux' + # Drivers drivers = get_option('drivers').split(',') virtual_drivers = [ @@ -137,9 +140,12 @@ default_drivers = [ 'focaltech_moc', ] -# SPI -if host_machine.system() == 'linux' - default_drivers += ['elanspi'] +spi_drivers = [ + 'elanspi' +] + +if have_spi + default_drivers += spi_drivers endif # FIXME: All the drivers should be fixed by adjusting the byte order. @@ -178,6 +184,17 @@ if drivers == [ 'default' ] drivers = default_drivers endif +enabled_spi_drivers = [] +foreach driver : spi_drivers + if driver in drivers + enabled_spi_drivers += driver + endif +endforeach + +if enabled_spi_drivers.length() > 0 and not have_spi + error('SPI drivers @0@ are not supported'.format(enabled_spi_drivers)) +endif + driver_helper_mapping = { 'aes1610' : [ 'aeslib' ], 'aes1660' : [ 'aeslib', 'aesx660' ],