build: Remove the need to modify sources for new drivers

Instead of having to modify both fp_internal.h to list each driver
definition structure, and core.c to add those drivers to arrays we
can loop over, generate both of those using meson.
This commit is contained in:
Bastien Nocera
2018-05-24 12:16:18 +02:00
parent ff09456cf5
commit fc92f62136
5 changed files with 35 additions and 128 deletions

View File

@@ -128,7 +128,6 @@ foreach driver: drivers
if driver == 'elan'
drivers_sources += [ 'drivers/elan.c', 'drivers/elan.h' ]
endif
drivers_cflags += [ '-DENABLE_' + driver.to_upper() + '=1' ]
endforeach
if aeslib
@@ -146,6 +145,22 @@ if imaging_dep.found()
other_sources += [ 'pixman.c' ]
endif
libfprint_sources += configure_file(input: 'empty_file',
output: 'drivers_definitions.h',
capture: true,
command: [
'/bin/echo',
drivers_struct_list
])
libfprint_sources += configure_file(input: 'empty_file',
output: 'drivers_arrays.h',
capture: true,
command: [
'/bin/echo',
drivers_primitive_array + '\n\n' + drivers_img_array
])
deps = [ mathlib_dep, glib_dep, libusb_dep, nss_dep, imaging_dep ]
libfprint = library('fprint',
libfprint_sources + drivers_sources + nbis_sources + other_sources,