From b44412fac6d022df2eb145b194ee3cd360cac53f Mon Sep 17 00:00:00 2001 From: Sophie Herold Date: Thu, 30 Nov 2023 21:27:52 +0100 Subject: [PATCH] meson: Make X11 support an optional feature Closes #255 Part-of: --- Cargo.toml | 3 ++- meson.build | 3 +++ meson_options.txt | 9 +++++++-- src/meson.build | 4 ++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f78a39a..385ddbc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ codegen-units = 1 [features] disable-glycin-sandbox = [] +x11 = ["ashpd/gtk4_x11"] [dependencies] anyhow = { version = "1.0.66", features = ["backtrace"] } @@ -30,7 +31,7 @@ url = "2.3.1" [dependencies.ashpd] version = "0.7.0" -features = ["gtk4"] +features = ["gtk4_wayland"] [dependencies.gtk] package = "gtk4" diff --git a/meson.build b/meson.build index 07f18a4..5497c15 100644 --- a/meson.build +++ b/meson.build @@ -14,6 +14,9 @@ dependency('gweather4', version: '>=4.0.0') # Required by glycin crate dependency('lcms2', version: '>=2.12.0') +# Optional dependencies +gtk4_x11 = dependency('gtk4-x11', required: get_option('x11')) + cargo = find_program('cargo', required: true) glib_compile_schemas = find_program('glib-compile-schemas', required: true) diff --git a/meson_options.txt b/meson_options.txt index 70fa964..6da020b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,11 +7,16 @@ option( 'development', 'ci', ], - value: 'release' + value: 'release', ) option( 'disable-glycin-sandbox', type: 'boolean', description: 'Disable sandboxing of image loaders in glycin. Only intended for development purposes.', - value: false + value: false, +) +option( + 'x11', + type: 'feature', + description: 'Enable X11 specific features.', ) diff --git a/src/meson.build b/src/meson.build index fa883b6..2e43e22 100644 --- a/src/meson.build +++ b/src/meson.build @@ -27,6 +27,10 @@ else message('Building in release mode') endif +if gtk4_x11.found() + cargo_options += [ '--features', 'x11' ] +endif + if get_option('disable-glycin-sandbox') cargo_options += [ '--features', 'disable-glycin-sandbox' ] endif