From d5546bdceaa2f3040d16a33fcbd824ba94b8cfde Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 22 Sep 2023 13:40:35 -0700 Subject: rust: apply global, project, and environment C args to bindgen This means that arguments set via `add_global_arguments`, `add_project_arguments` and by either the `-Dc_args` or `CFLAGS` are applied to bindgen as well. This can be important when, among other things, #defines are set via these mechanisms. Fixes: #12065 --- mesonbuild/modules/rust.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mesonbuild') diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py index b6dd731..382a72d 100644 --- a/mesonbuild/modules/rust.py +++ b/mesonbuild/modules/rust.py @@ -236,6 +236,12 @@ class RustModule(ExtensionModule): elif isinstance(s, CustomTarget): depends.append(s) + clang_args.extend(state.global_args.get('c', [])) + clang_args.extend(state.project_args.get('c', [])) + cargs = state.get_option('args', state.subproject, lang='c') + assert isinstance(cargs, list), 'for mypy' + clang_args.extend(cargs) + if self._bindgen_bin is None: self._bindgen_bin = state.find_program('bindgen') -- cgit v1.1