meson: Only require expat when building wayland-scanner
authorMichael Weiss <dev.primeos@gmail.com>
Fri, 2 Apr 2021 17:26:57 +0000 (19:26 +0200)
committerMichael Weiss <dev.primeos@gmail.com>
Fri, 2 Apr 2021 18:55:15 +0000 (20:55 +0200)
This code is only required for building wayland-scanner so it should be
scoped accordingly. libxml-2.0 will only be required if both "scanner"
and "dtd_validation" are set to true.

Signed-off-by: Michael Weiss <dev.primeos@gmail.com>
meson.build
src/meson.build

index dd5774a..12b4641 100644 (file)
@@ -66,13 +66,6 @@ if get_option('libraries')
        endif
 endif
 
-scanner_deps = [ dependency('expat') ]
-
-if get_option('dtd_validation')
-       scanner_deps += dependency('libxml-2.0')
-       config_h.set('HAVE_LIBXML', 1)
-endif
-
 configure_file(
        output: 'config.h',
        configuration: config_h,
index d91c503..b6b248c 100644 (file)
@@ -26,6 +26,14 @@ wayland_util_dep = declare_dependency(
 if get_option('scanner')
        # wayland-scanner
 
+       scanner_deps = [ dependency('expat') ]
+       scanner_args = [ '-include', 'config.h' ]
+
+       if get_option('dtd_validation')
+               scanner_deps += dependency('libxml-2.0')
+               scanner_args += '-DHAVE_LIBXML=1'
+       endif
+
        configure_file(
                input: '../protocol/wayland.dtd',
                output: 'wayland.dtd.embed',
@@ -38,7 +46,7 @@ if get_option('scanner')
        wayland_scanner = executable(
                'wayland-scanner',
                wayland_scanner_sources,
-               c_args: [ '-include', 'config.h' ],
+               c_args: scanner_args,
                include_directories: wayland_scanner_includes,
                dependencies: [ scanner_deps, wayland_util_dep, ],
                install: true