mirror of
https://gitlab.gnome.org/GNOME/libgnome-volume-control.git
synced 2024-11-24 09:50:43 -05:00
Add support for building with meson
Allow the module to be included as a meson subproject() in addition to the existing autotools support. Based heavily on the meson support in https://git.gnome.org/browse/libgd. https://bugzilla.gnome.org/show_bug.cgi?id=783207
This commit is contained in:
parent
ce8e4880ce
commit
01e1fde6e5
3
config.h.meson
Normal file
3
config.h.meson
Normal file
@ -0,0 +1,3 @@
|
||||
#mesondefine GETTEXT_PACKAGE
|
||||
#mesondefine PACKAGE_VERSION
|
||||
#mesondefine HAVE_ALSA
|
147
meson.build
Normal file
147
meson.build
Normal file
@ -0,0 +1,147 @@
|
||||
project('gvc', 'c',
|
||||
meson_version: '>= 0.38.0',
|
||||
default_options: ['static=true']
|
||||
)
|
||||
|
||||
if not meson.is_subproject()
|
||||
error('This project is only intended to be used as a subproject!')
|
||||
endif
|
||||
|
||||
gnome = import('gnome')
|
||||
|
||||
pkglibdir = get_option('pkglibdir')
|
||||
pkgdatadir = get_option('pkgdatadir')
|
||||
|
||||
alsa = dependency('alsa', required: false)
|
||||
gio = dependency('gio-2.0')
|
||||
gobject = dependency('gobject-2.0')
|
||||
libpulse = dependency('libpulse', version: '>= 2.0')
|
||||
libpulse_glib = dependency('libpulse-mainloop-glib')
|
||||
|
||||
cdata = configuration_data()
|
||||
cdata.set_quoted('GETTEXT_PACKAGE', get_option('package-name'))
|
||||
cdata.set_quoted('PACKAGE_VERSION', get_option('package-version'))
|
||||
cdata.set10('HAVE_ALSA', alsa.found())
|
||||
|
||||
config = configure_file(
|
||||
input: 'config.h.meson',
|
||||
output: 'config.h',
|
||||
configuration: cdata
|
||||
)
|
||||
|
||||
libgvc_inc = include_directories('.')
|
||||
|
||||
libgvc_gir_sources = [
|
||||
'gvc-mixer-card.h',
|
||||
'gvc-mixer-card.c',
|
||||
'gvc-mixer-stream.h',
|
||||
'gvc-mixer-stream.c',
|
||||
'gvc-channel-map.h',
|
||||
'gvc-channel-map.c',
|
||||
'gvc-mixer-ui-device.h',
|
||||
'gvc-mixer-ui-device.c',
|
||||
'gvc-mixer-sink.h',
|
||||
'gvc-mixer-sink.c',
|
||||
'gvc-mixer-source.h',
|
||||
'gvc-mixer-source.c',
|
||||
'gvc-mixer-sink-input.h',
|
||||
'gvc-mixer-sink-input.c',
|
||||
'gvc-mixer-source-output.h',
|
||||
'gvc-mixer-source-output.c',
|
||||
'gvc-mixer-event-role.h',
|
||||
'gvc-mixer-event-role.c',
|
||||
'gvc-mixer-control.h',
|
||||
'gvc-mixer-control.c'
|
||||
]
|
||||
|
||||
libgvc_no_gir_sources = [
|
||||
'gvc-mixer-card-private.h',
|
||||
'gvc-mixer-stream-private.h',
|
||||
'gvc-channel-map-private.h',
|
||||
'gvc-mixer-control-private.h',
|
||||
'gvc-pulseaudio-fake.h'
|
||||
]
|
||||
|
||||
libgvc_deps = [
|
||||
alsa,
|
||||
gio,
|
||||
gobject,
|
||||
libpulse,
|
||||
libpulse_glib
|
||||
]
|
||||
|
||||
static = get_option('static')
|
||||
with_introspection = get_option('with-introspection')
|
||||
|
||||
if static and with_introspection
|
||||
error('Currently meson requires a shared library for building girs.')
|
||||
endif
|
||||
|
||||
c_args = ['-DG_LOG_DOMAIN="Gvc"']
|
||||
|
||||
if with_introspection
|
||||
c_args += '-DWITH_INTROSPECTION'
|
||||
endif
|
||||
|
||||
if static
|
||||
libgvc_static = static_library('gvc',
|
||||
sources: libgvc_gir_sources + libgvc_no_gir_sources,
|
||||
include_directories: libgvc_inc,
|
||||
dependencies: libgvc_deps,
|
||||
c_args: c_args
|
||||
)
|
||||
|
||||
libgvc = libgvc_static
|
||||
else
|
||||
if pkglibdir == ''
|
||||
error('Installing shared library, but pkglibdir is unset!')
|
||||
endif
|
||||
|
||||
libgvc_shared = shared_library('gvc',
|
||||
sources: libgvc_gir_sources + libgvc_no_gir_sources,
|
||||
include_directories: libgvc_inc,
|
||||
dependencies: libgvc_deps,
|
||||
c_args: c_args,
|
||||
install_rpath: pkgdatadir,
|
||||
install_dir: pkglibdir,
|
||||
install: true
|
||||
)
|
||||
|
||||
libgvc = libgvc_shared
|
||||
endif
|
||||
|
||||
if with_introspection
|
||||
if pkgdatadir == ''
|
||||
error('Installing introspection, but pkgdatadir is unset!')
|
||||
elif (pkglibdir == '')
|
||||
error('Installing introspection, but pkglibdir is unset!')
|
||||
endif
|
||||
|
||||
libgvc_gir = gnome.generate_gir(libgvc,
|
||||
sources: libgvc_gir_sources,
|
||||
nsversion: '1.0',
|
||||
namespace: 'Gvc',
|
||||
includes: ['Gio-2.0', 'GObject-2.0'],
|
||||
extra_args: ['-DWITH_INTROSPECTION', '--quiet'],
|
||||
install_dir_gir: pkgdatadir,
|
||||
install_dir_typelib: pkglibdir,
|
||||
install: true
|
||||
)
|
||||
endif
|
||||
|
||||
if alsa.found()
|
||||
executable('test-audio-device-selection',
|
||||
sources: 'test-audio-device-selection.c',
|
||||
link_with: libgvc,
|
||||
dependencies: libgvc_deps,
|
||||
c_args: c_args
|
||||
)
|
||||
endif
|
||||
|
||||
libgvc_dep = declare_dependency(
|
||||
link_with: libgvc,
|
||||
include_directories: libgvc_inc,
|
||||
dependencies: libgvc_deps,
|
||||
compile_args: c_args,
|
||||
sources: libgvc_gir_sources + libgvc_no_gir_sources
|
||||
)
|
35
meson_options.txt
Normal file
35
meson_options.txt
Normal file
@ -0,0 +1,35 @@
|
||||
option('package-name',
|
||||
type: 'string',
|
||||
value: '',
|
||||
description: 'The value for the GETTEXT_PACKAGE define.'
|
||||
)
|
||||
|
||||
option('package-version',
|
||||
type: 'string',
|
||||
value: '',
|
||||
description: 'The value for the PACKAGE_VERSION define.'
|
||||
)
|
||||
|
||||
option('pkglibdir',
|
||||
type: 'string',
|
||||
value: '',
|
||||
description: 'The private directory the shared library/typelib will be installed into.'
|
||||
)
|
||||
|
||||
option('pkgdatadir',
|
||||
type: 'string',
|
||||
value: '',
|
||||
description: 'The private directory the gir file will be installed into.'
|
||||
)
|
||||
|
||||
option('static',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Build as a static library.'
|
||||
)
|
||||
|
||||
option('with-introspection',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Build gobject-introspection support'
|
||||
)
|
Loading…
Reference in New Issue
Block a user