mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Add Meson option that allows selecting GFileMonitor's backend implementation
The option defaults to 'auto' which keeps the current selection behavior, but also allows user to override the choice. Also make the chosen backend is reported to the code via CPP defines.
This commit is contained in:
parent
3936eaaa39
commit
c7e2ae30f0
@ -789,19 +789,41 @@ gioenumtypes_c = custom_target('gioenumtypes_c',
|
||||
|
||||
gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h, glib_enumtypes_h, gio_visibility_h])
|
||||
|
||||
file_monitor_backend = get_option('file_monitor_backend')
|
||||
if file_monitor_backend == 'auto'
|
||||
if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
|
||||
file_monitor_backend = 'inotify'
|
||||
elif have_func_kqueue and have_func_kevent
|
||||
file_monitor_backend = 'kqueue'
|
||||
elif host_system == 'windows'
|
||||
file_monitor_backend = 'win32'
|
||||
endif
|
||||
endif
|
||||
|
||||
# inotify
|
||||
if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
|
||||
if file_monitor_backend == 'inotify'
|
||||
glib_conf.set('FILE_MONITOR_BACKEND_INOTIFY', 1)
|
||||
subdir('inotify')
|
||||
internal_deps += [ inotify_lib ]
|
||||
endif
|
||||
|
||||
# libinotify-kqueue
|
||||
# uses the same code as inotify, but changes some functions behavior via #ifdef's
|
||||
if file_monitor_backend == 'libinotify-kqueue'
|
||||
glib_conf.set('FILE_MONITOR_BACKEND_LIBINOTIFY_KQUEUE', 1)
|
||||
subdir('inotify')
|
||||
internal_deps += [ inotify_lib ]
|
||||
endif
|
||||
|
||||
# kevent
|
||||
if have_func_kqueue and have_func_kevent
|
||||
if file_monitor_backend == 'kqueue'
|
||||
glib_conf.set('FILE_MONITOR_BACKEND_KQUEUE', 1)
|
||||
subdir('kqueue')
|
||||
internal_deps += [ kqueue_lib ]
|
||||
endif
|
||||
|
||||
if host_system == 'windows'
|
||||
if file_monitor_backend == 'win32'
|
||||
glib_conf.set('FILE_MONITOR_BACKEND_WIN32', 1)
|
||||
subdir('win32')
|
||||
internal_deps += [ giowin32_lib ]
|
||||
endif
|
||||
|
@ -2738,4 +2738,5 @@ summary({
|
||||
'libelf' : get_option('libelf'),
|
||||
'multiarch' : get_option('multiarch'),
|
||||
'introspection' : enable_gir,
|
||||
'file_monitor_backend' : get_option('file_monitor_backend'),
|
||||
}, section: 'Options')
|
||||
|
@ -149,3 +149,9 @@ option('introspection',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable generating introspection data (requires gobject-introspection)')
|
||||
|
||||
option('file_monitor_backend',
|
||||
type : 'combo',
|
||||
choices : ['auto', 'inotify', 'kqueue', 'libinotify-kqueue', 'win32'],
|
||||
value : 'auto',
|
||||
description : 'The name of the system API to use as a GFileMonitor backend')
|
||||
|
Loading…
Reference in New Issue
Block a user