summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@collabora.com>2022-11-15 14:12:06 -0500
committerMarge Bot <emma+marge@anholt.net>2022-11-23 23:14:10 +0000
commitbdc240e13eb9f5d00af9f908ca0d822cfca12e5c (patch)
tree06b31402860e7acb6da96081f3d9c6a9a0907157 /meson.build
parent6cd392cbe20048463f4e0ce1935a8f23829076b5 (diff)
downloadmesa-bdc240e13eb9f5d00af9f908ca0d822cfca12e5c.tar.gz
meson: Don't depend on expat for !use_xmlconfig
If we don't use xmlconfig, expat becomes an optional dependency on Linux/BSD, which may be convenient for embedded systems that do not otherwise need expat. (expat is so ubiquitous that this probably doesn't matter a ton in practice, but fewer required Mesa deps is probably nice anyway.) Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Suggested-by: Dylan Baker <dylan.c.baker@intel.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19626>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build16
1 files changed, 12 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index da661006760..4f3f8cfa41c 100644
--- a/meson.build
+++ b/meson.build
@@ -1633,13 +1633,21 @@ if dep_thread.found()
pre_args += '-DHAVE_PTHREAD_SETAFFINITY'
endif
endif
+
+# We don't have expat on Android or Windows, which is a needed dep for xmlconfig
+supports_xmlconfig = not (with_platform_android or with_platform_windows)
+
+opt_xmlconfig = get_option('xmlconfig')
+if opt_xmlconfig.enabled() and not supports_xmlconfig
+ error('xmlconfig not available on Android or Windows')
+endif
+use_xmlconfig = supports_xmlconfig and not opt_xmlconfig.disabled()
+
if host_machine.system() == 'darwin'
dep_expat = meson.get_compiler('c').find_library('expat')
-elif host_machine.system() != 'windows'
- dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'],
- required: not with_platform_android)
else
- dep_expat = null_dep
+ dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'],
+ required: use_xmlconfig)
endif
# Predefined macros for windows
if host_machine.system() == 'windows'