summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2020-12-16 09:18:24 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2020-12-16 10:22:03 +0200
commite7224eb5355654db439b14362d19063acd7aec27 (patch)
treef9f49fc7eda7d05231d53c52f54f727c3b4c6826
parentf2ed55fda6f520f60f92f2cf9becdc52616f4460 (diff)
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 <tomi.valkeinen@ti.com>
-rw-r--r--meson.build3
-rw-r--r--meson_options.txt3
-rw-r--r--py/pykms/meson.build9
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',