From e7224eb5355654db439b14362d19063acd7aec27 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 16 Dec 2020 09:18:24 +0200 Subject: meson: add option to use system pybind11 or subproject Add 'system-pybind11' option. enabled = use pybind11 from the system disabled = use pybind11 from meson subproject auto = use pybind11 from the system, or, if not available, subproject Signed-off-by: Tomi Valkeinen --- meson.build | 3 --- meson_options.txt | 3 +++ py/pykms/meson.build | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 8db870c..f76f8b7 100644 --- a/meson.build +++ b/meson.build @@ -33,9 +33,6 @@ add_global_link_arguments(link_arguments, language : 'cpp') libfmt_dep = dependency('fmt') -pybind11_includes = include_directories('ext/pybind11/include') -pybind11_dep = declare_dependency(include_directories : pybind11_includes) - libdrmomap_dep = dependency('libdrm_omap', required : get_option('omap')) subdir('kms++') diff --git a/meson_options.txt b/meson_options.txt index 754db32..da6dc93 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -10,5 +10,8 @@ option('utils', type : 'boolean', value : true, option('pykms', type : 'feature', value : 'auto', description : 'Build python bindings') +option('system-pybind11', type : 'feature', value : 'auto', + description : 'Use pybind11 from the system or from meson subproject') + option('kmscube', type : 'boolean', value : false, description : 'Build kmscube test application') diff --git a/py/pykms/meson.build b/py/pykms/meson.build index 518040b..b29cd9f 100644 --- a/py/pykms/meson.build +++ b/py/pykms/meson.build @@ -4,6 +4,15 @@ if py3_dep.found() == false subdir_done() endif +if get_option('system-pybind11').enabled() + pybind11_dep = dependency('pybind11') +elif get_option('system-pybind11').disabled() + pybind11_proj = subproject('pybind11') + pybind11_dep = pybind11_proj.get_variable('pybind11_dep') +else + pybind11_dep = dependency('pybind11', fallback : ['pybind11', 'pybind11_dep']) +endif + pykms_sources = files([ 'pykmsbase.cpp', 'pykms.cpp', -- cgit v1.2.3