diff --git a/meson.build b/meson.build index 728fa74626ea8..51aeed8e65145 100644 --- a/meson.build +++ b/meson.build @@ -1497,18 +1497,28 @@ if dep_thread.found() endif endif -# We don't have expat on Android or Windows, which is a needed dep for xmlconfig -opt_xmlconfig = get_option('xmlconfig') \ - .require(not (with_platform_android or with_platform_windows), - error_message : 'xmlconfig not available on Android or Windows') +with_expat = get_option('expat') \ + .disable_auto_if(with_platform_android or with_platform_windows) 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 dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'], - required : opt_xmlconfig) + required : with_expat) 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 if host_machine.system() == 'windows' diff --git a/meson_options.txt b/meson_options.txt index 5984dc6d768ac..34a55ad709127 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -58,6 +58,14 @@ option( '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( 'gallium-drivers', type : 'array', @@ -649,6 +657,7 @@ option( 'the default driconf file is hardcoded into Mesa. ' + 'Requires expat.' ) + option ( 'intel-xe-kmd', type : 'feature', diff --git a/src/intel/common/meson.build b/src/intel/common/meson.build index 0537de3614ac9..ad295ee188a89 100644 --- a/src/intel/common/meson.build +++ b/src/intel/common/meson.build @@ -58,7 +58,7 @@ files_batch_decoder = files( ) batch_decoder_dependencies = [] -if with_platform_android +if not dep_expat.found() files_libintel_common += 'intel_batch_decoder_stub.c' else batch_decoder_dependencies += dep_expat