meson: Key whether to build batch decoder on expat

Instead of on Android. Which allows an end user to turn off expat
without breaking or disabling Intel support. I've additionally
refactored to separate expat and xmlconfig a bit more in the root
meson.build

This does make expat a hard dependency for building Intel tools, despite
the fact that only aubinator actually requires it. This simplifies the
build for the common case, and in the event that someone wants to build
the Intel tools and doesn't have libexpat, they can fall back to the
meson wrap for expat instead.

fixes: 75276deebc
closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8791

Reviewed-by: Mark Janes <markjanes@swizzler.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23605>
This commit is contained in:
Dylan Baker
2023-06-12 10:53:58 -07:00
committed by Marge Bot
parent b717a43826
commit ce07aabab1
3 changed files with 27 additions and 8 deletions

View File

@@ -1497,18 +1497,28 @@ if dep_thread.found()
endif endif
endif endif
# We don't have expat on Android or Windows, which is a needed dep for xmlconfig with_expat = get_option('expat') \
opt_xmlconfig = get_option('xmlconfig') \ .disable_auto_if(with_platform_android or with_platform_windows)
.require(not (with_platform_android or with_platform_windows),
error_message : 'xmlconfig not available on Android or Windows')
if host_machine.system() == 'darwin' if host_machine.system() == 'darwin'
dep_expat = meson.get_compiler('c').find_library('expat', required : opt_xmlconfig) dep_expat = meson.get_compiler('c').find_library('expat', required : with_expat)
else else
dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'], dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'],
required : opt_xmlconfig) required : with_expat)
endif endif
use_xmlconfig = dep_expat.found()
# TODO: with Meson 1.1.0 this can be replaced with with_expat.enable_if(with_intel_tools)
if with_intel_tools and not dep_expat.found()
error('Intel tools require expat')
endif
# We don't require expat on Android or Windows
use_xmlconfig = get_option('xmlconfig') \
.require(not (with_platform_android or with_platform_windows),
error_message : 'xmlconfig not available on Android or Windows') \
.require(dep_expat.found(),
error_message : 'requires expat') \
.allowed()
# Predefined macros for windows # Predefined macros for windows
if host_machine.system() == 'windows' if host_machine.system() == 'windows'

View File

@@ -58,6 +58,14 @@ option(
'separated list. Default: dri-drivers-path.' 'separated list. Default: dri-drivers-path.'
) )
option(
'expat',
type : 'feature',
value : 'auto',
description : 'Controls the use of expat. ' +
'Cannot be disabled if xmlconfig is enabled.'
)
option( option(
'gallium-drivers', 'gallium-drivers',
type : 'array', type : 'array',
@@ -649,6 +657,7 @@ option(
'the default driconf file is hardcoded into Mesa. ' + 'the default driconf file is hardcoded into Mesa. ' +
'Requires expat.' 'Requires expat.'
) )
option ( option (
'intel-xe-kmd', 'intel-xe-kmd',
type : 'feature', type : 'feature',

View File

@@ -58,7 +58,7 @@ files_batch_decoder = files(
) )
batch_decoder_dependencies = [] batch_decoder_dependencies = []
if with_platform_android if not dep_expat.found()
files_libintel_common += 'intel_batch_decoder_stub.c' files_libintel_common += 'intel_batch_decoder_stub.c'
else else
batch_decoder_dependencies += dep_expat batch_decoder_dependencies += dep_expat