diff mbox

[libdrm,12/23] meson: introduce simpler way to handle driver options

Message ID 20180320174659.1510-13-eric.engestrom@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Engestrom March 20, 2018, 5:46 p.m. UTC
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 meson.build | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff mbox

Patch

diff --git a/meson.build b/meson.build
index 748a413862dcbe7252c3..c8b17c6cb988ed8f9330 100644
--- a/meson.build
+++ b/meson.build
@@ -69,6 +69,27 @@  endif
 config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', intel_atomics)
 config.set10('HAVE_LIB_ATOMIC_OPS', lib_atomics)
 
+foreach d : [
+]
+  driver = d[0]
+  require_atomics = d[1]
+  default = d[2]
+  _option = get_option(driver)
+
+  if _option == 'auto'
+    if with_atomics or not require_atomics
+      set_variable('with_' + driver, default)
+    else
+      set_variable('with_' + driver, false)
+    endif
+  else
+    if _option == 'true' and require_atomics and not with_atomics
+      error('libdrm_' + driver + ' requires atomics.')
+    endif
+    set_variable('with_' + driver, _option == 'true')
+  endif
+endforeach
+
 with_intel = false
 _intel = get_option('intel')
 if _intel == 'auto'