[pygobject] meson: Make the `pycairo` option a feature
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] meson: Make the `pycairo` option a feature
- Date: Wed, 3 Jun 2020 19:44:49 +0000 (UTC)
commit 505c4b22d58d1e0e9a4dae53f1b55a9a4a39d945
Author: Thibault Saunier <tsaunier igalia com>
Date: Wed Jun 3 15:24:52 2020 -0400
meson: Make the `pycairo` option a feature
So user have more control on whether to build it or not
gi/meson.build | 2 +-
meson.build | 5 ++++-
meson_options.txt | 2 +-
tests/meson.build | 4 ++--
4 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gi/meson.build b/gi/meson.build
index 4a049479..8edf8328 100644
--- a/gi/meson.build
+++ b/gi/meson.build
@@ -79,7 +79,7 @@ giext = python.extension_module('_gi', sources,
c_args: pyext_c_args + main_c_args
)
-if with_pycairo
+if cairo_dep.found()
gicairoext = python.extension_module('_gi_cairo', ['pygi-foreign-cairo.c'],
dependencies : [python_ext_dep, glib_dep, gi_dep, ffi_dep, pycairo_dep, cairo_dep, cairo_gobject_dep],
install: true,
diff --git a/meson.build b/meson.build
index 948a09f0..4826600c 100644
--- a/meson.build
+++ b/meson.build
@@ -43,7 +43,7 @@ with_pycairo = get_option('pycairo')
cc = meson.get_compiler('c')
-if with_pycairo
+if not with_pycairo.disabled()
cairo_dep = dependency('cairo', required: cc.get_id() != 'msvc')
cairo_gobject_dep = dependency('cairo-gobject', required: cc.get_id() != 'msvc')
@@ -59,7 +59,10 @@ if with_pycairo
version: pycairo_version_req,
fallback: ['pycairo', 'pycairo_dep'],
default_options: ['python=' + get_option('python')],
+ required: with_pycairo,
)
+else
+ pycairo_dep = dependency('', required: false)
endif
main_c_args = []
diff --git a/meson_options.txt b/meson_options.txt
index 5dd4cbcd..4fb5304c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,3 @@
option('python', type : 'string', value : 'python3')
-option('pycairo', type : 'boolean', value : true, description : 'build with pycairo integration')
+option('pycairo', type : 'feature', value : 'auto', description : 'build with pycairo integration')
option('tests', type : 'boolean', value : true, description : 'build unit tests')
diff --git a/tests/meson.build b/tests/meson.build
index dbb74d17..6a25688e 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -68,7 +68,7 @@ regress_headers += ['regressextra.h']
regress_deps = [glib_dep, gobject_dep, gio_dep, gmodule_dep]
regress_c_args = []
-if with_pycairo
+if cairo_dep.found()
regress_deps += [cairo_dep, cairo_gobject_dep]
else
regress_c_args += ['-D_GI_DISABLE_CAIRO']
@@ -121,7 +121,7 @@ if host_machine.system() == 'windows'
endif
python_paths = [join_paths(meson.current_build_dir(), '..')]
-if with_pycairo and pycairo_dep.type_name() == 'internal'
+if pycairo_dep.found() and pycairo_dep.type_name() == 'internal'
python_paths += [join_paths(meson.build_root(), 'subprojects', 'pycairo')]
endif
envdata.append('PYTHONPATH', python_paths)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]