From 69b70ee41751c5337350c17782b43341861be4b5 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 7 May 2020 14:59:57 -0700 Subject: [PATCH] meson: Add a pkgconfig for libg810-led This makes it much easier to link against libg810-led than manually specifying compiler options, especially since in some cases you need to pass extra cppflags. --- meson.build | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 662a5d9..7159640 100644 --- a/meson.build +++ b/meson.build @@ -20,12 +20,12 @@ project( default_options : ['cpp_std=gnu++11'], ) +extra_cpp_args = [] if get_option('usb') == 'hidapi' dep_usb = dependency('hidapi-hidraw') - add_project_arguments('-Dhidapi', language : 'cpp') + extra_cpp_args = ['-Dhidapi'] else dep_usb = dependency('libusb-1.0') - add_project_arguments('-Dlibusb', language : 'cpp') endif add_project_arguments( @@ -40,11 +40,19 @@ libg810_led = library( [ 'src/classes/Keyboard.cpp', ], + cpp_args : extra_cpp_args, version : meson.project_version(), dependencies : [dep_usb], install : true, ) +pkg = import('pkgconfig') +pkg.generate( + libg810_led, + extra_cflags : extra_cpp_args, + description : 'library to control various logitech keyboard backlights', +) + g810_ld = executable( meson.project_name(), [