diff options
author | David Robillard <d@drobilla.net> | 2023-05-27 12:54:07 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-27 12:55:10 -0400 |
commit | 580584e896abfa9324e58c0fad39476cb4cc077c (patch) | |
tree | 665a9860c15cb1f39ea64df60553de996911f141 | |
parent | 5424d37e388fbc68343d05acffaed29b7698dd9c (diff) | |
download | pugl-580584e896abfa9324e58c0fad39476cb4cc077c.tar.gz pugl-580584e896abfa9324e58c0fad39476cb4cc077c.tar.bz2 pugl-580584e896abfa9324e58c0fad39476cb4cc077c.zip |
X11: Add options for XCursor, XRandR, and XSync support
-rw-r--r-- | meson.build | 73 | ||||
-rw-r--r-- | meson_options.txt | 9 |
2 files changed, 67 insertions, 15 deletions
diff --git a/meson.build b/meson.build index 30a1651..13755f6 100644 --- a/meson.build +++ b/meson.build @@ -169,23 +169,27 @@ else # X11 x11_dep = cc.find_library('X11') core_args += '-D_POSIX_C_SOURCE=200809L' - xcursor_dep = cc.find_library('Xcursor', required: false) + xcursor_dep = cc.find_library('Xcursor', required: get_option('xcursor')) if xcursor_dep.found() core_args += ['-DUSE_XCURSOR=1'] endif - xrandr_dep = cc.find_library('Xrandr', required: false) + xrandr_dep = cc.find_library('Xrandr', required: get_option('xrandr')) if xrandr_dep.found() core_args += ['-DUSE_XRANDR=1'] endif - xext_dep = cc.find_library('Xext', required: false) + use_xsync = false + xext_dep = cc.find_library('Xext', required: get_option('xsync')) if xext_dep.found() xsync_fragment = '''#include <X11/Xlib.h> #include <X11/extensions/sync.h> int main(void) { XSyncQueryExtension(0, 0, 0); return 0; }''' if cc.compiles(xsync_fragment, name: 'Xsync') core_args += ['-DUSE_XSYNC=1'] + use_xsync = true + elif get_option('xsync') == 'enabled' + error('C header <X11/extensions/sync.h> not found') endif endif @@ -479,22 +483,61 @@ else endif if meson.version().version_compare('>=0.53.0') - summary('Platform', platform) + summary( + { + 'Platform': platform, + }, + section: 'Configuration', + ) + + if platform == 'x11' + summary( + { + 'Cursor support (XCursor)': xcursor_dep.found(), + 'Refresh rate support (XRandR)': xrandr_dep.found(), + 'Timer support (XSync)': use_xsync, + }, + bool_yn: true, + section: 'Configuration', + ) + endif - summary('Cairo', cairo_dep.found(), section: 'Backends', bool_yn: true) - summary('OpenGL', opengl_dep.found(), section: 'Backends', bool_yn: true) - summary('Stub', get_option('stub'), section: 'Backends', bool_yn: true) - summary('Vulkan', vulkan_dep.found(), section: 'Backends', bool_yn: true) + summary( + { + 'Cairo': cairo_dep.found(), + 'OpenGL': opengl_dep.found(), + 'Stub': get_option('stub'), + 'Vulkan': vulkan_dep.found(), + }, + bool_yn: true, + section: 'Backends', + ) - summary('Tests', not get_option('tests').disabled(), bool_yn: true) - summary('Examples', not get_option('examples').disabled(), bool_yn: true) - summary('Documentation', build_docs, bool_yn: true) + summary( + { + 'Tests': not get_option('tests').disabled(), + 'Examples': not get_option('examples').disabled(), + 'Documentation': build_docs, + }, + bool_yn: true, + section: 'Components', + ) - summary('Prefix', get_option('prefix'), section: 'Paths') - summary('Headers', get_option('prefix') / get_option('includedir'), section: 'Paths') - summary('Libraries', get_option('prefix') / get_option('libdir'), section: 'Paths') + summary( + { + 'Install prefix': get_option('prefix'), + 'Headers': get_option('prefix') / get_option('includedir'), + 'Libraries': get_option('prefix') / get_option('libdir'), + }, + section: 'Directories', + ) if not get_option('examples').disabled() - summary('Executables', get_option('prefix') / get_option('bindir'), section: 'Paths') + summary( + { + 'Executables': get_option('prefix') / get_option('bindir'), + }, + section: 'Directories', + ) endif endif diff --git a/meson_options.txt b/meson_options.txt index fb4ae7d..5165e07 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -27,3 +27,12 @@ option('tests', type: 'feature', value: 'auto', yield: true, option('vulkan', type: 'feature', value: 'auto', description: 'Enable support for the Vulkan graphics API') + +option('xcursor', type: 'feature', value: 'auto', + description: 'Support changing the cursor on X11') + +option('xrandr', type: 'feature', value: 'auto', + description: 'Support accessing the refresh rate on X11') + +option('xsync', type: 'feature', value: 'auto', + description: 'Support timers on X11') |