aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-09-22 13:40:35 -0700
committerDylan Baker <dylan@pnwbakers.com>2023-09-25 13:05:04 -0700
commitd5546bdceaa2f3040d16a33fcbd824ba94b8cfde (patch)
tree89578b4aaa9869e6a7b02de8955554445c175ecf /mesonbuild
parentc1ac252f4ffecc381abe24e13584e1c48516e0eb (diff)
downloadmeson-d5546bdceaa2f3040d16a33fcbd824ba94b8cfde.zip
meson-d5546bdceaa2f3040d16a33fcbd824ba94b8cfde.tar.gz
meson-d5546bdceaa2f3040d16a33fcbd824ba94b8cfde.tar.bz2
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
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/modules/rust.py6
1 files changed, 6 insertions, 0 deletions
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')