build: fix dirmonitor backend selection (#1790)

When a backend was specified using meson, the relative source files weren't being added.
This commit is contained in:
Guldoman 2024-05-17 17:19:39 +02:00 committed by GitHub
parent 7fdb35ac46
commit 7d876f81ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 11 deletions

View File

@ -16,41 +16,45 @@ lite_sources += 'api/dirmonitor.c'
if get_option('dirmonitor_backend') == '' if get_option('dirmonitor_backend') == ''
if cc.has_function('inotify_init', prefix : '#include<sys/inotify.h>') if cc.has_function('inotify_init', prefix : '#include<sys/inotify.h>')
dirmonitor_backend = 'inotify' dirmonitor_backend = 'inotify'
lite_sources += 'api/dirmonitor/inotify.c'
elif host_machine.system() == 'darwin' and cc.check_header('CoreServices/CoreServices.h') elif host_machine.system() == 'darwin' and cc.check_header('CoreServices/CoreServices.h')
dirmonitor_backend = 'fsevents' dirmonitor_backend = 'fsevents'
lite_sources += 'api/dirmonitor/fsevents.c'
elif cc.has_function('kqueue', prefix : '#include<sys/event.h>') elif cc.has_function('kqueue', prefix : '#include<sys/event.h>')
dirmonitor_backend = 'kqueue' dirmonitor_backend = 'kqueue'
lite_sources += 'api/dirmonitor/kqueue.c'
elif cc.has_function('create_inode_watcher', prefix : '#include<fcntl.h>') elif cc.has_function('create_inode_watcher', prefix : '#include<fcntl.h>')
dirmonitor_backend = 'inodewatcher' dirmonitor_backend = 'inodewatcher'
add_languages('cpp')
lite_sources += 'api/dirmonitor/inodewatcher.cpp'
elif dependency('libkqueue', required : false).found() elif dependency('libkqueue', required : false).found()
dirmonitor_backend = 'kqueue' dirmonitor_backend = 'kqueue'
lite_sources += 'api/dirmonitor/kqueue.c'
elif host_machine.system() == 'windows' elif host_machine.system() == 'windows'
dirmonitor_backend = 'win32' dirmonitor_backend = 'win32'
lite_sources += 'api/dirmonitor/win32.c'
else else
dirmonitor_backend = 'dummy' dirmonitor_backend = 'dummy'
lite_sources += 'api/dirmonitor/dummy.c'
warning('no suitable backend found, defaulting to dummy backend') warning('no suitable backend found, defaulting to dummy backend')
endif endif
else else
dirmonitor_backend = get_option('dirmonitor_backend') dirmonitor_backend = get_option('dirmonitor_backend')
endif endif
message('dirmonitor_backend: @0@'.format(dirmonitor_backend)) if dirmonitor_backend == 'inotify'
lite_sources += 'api/dirmonitor/inotify.c'
if dirmonitor_backend == 'kqueue' elif dirmonitor_backend == 'fsevents'
lite_sources += 'api/dirmonitor/fsevents.c'
elif dirmonitor_backend == 'kqueue'
lite_sources += 'api/dirmonitor/kqueue.c'
libkqueue_dep = dependency('libkqueue', required : false) libkqueue_dep = dependency('libkqueue', required : false)
if libkqueue_dep.found() if libkqueue_dep.found()
lite_deps += libkqueue_dep lite_deps += libkqueue_dep
endif endif
elif dirmonitor_backend == 'inodewatcher'
add_languages('cpp')
lite_sources += 'api/dirmonitor/inodewatcher.cpp'
elif dirmonitor_backend == 'win32'
lite_sources += 'api/dirmonitor/win32.c'
else
lite_sources += 'api/dirmonitor/dummy.c'
endif endif
message('dirmonitor_backend: @0@'.format(dirmonitor_backend))
lite_rc = [] lite_rc = []
if host_machine.system() == 'windows' if host_machine.system() == 'windows'
windows = import('windows') windows = import('windows')