Allowlist more clang flags in bindgen (#2902)

Especially `--target` is very usable for cross-compilation use cases.
This commit is contained in:
Marcel Hlopko 2024-10-01 10:57:35 +02:00 committed by GitHub
parent 144d34fdaa
commit 966678bf17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -267,7 +267,21 @@ def _rust_bindgen_impl(ctx):
# Ideally we could depend on a more specific toolchain, requesting one which is specifically clang via some constraint.
# Unfortunately, we can't currently rely on this, so instead we filter only to flags we know clang supports.
# We can add extra flags here as needed.
flags_known_to_clang = ("-I", "-iquote", "-isystem", "--sysroot", "--gcc-toolchain")
flags_known_to_clang = (
"-I",
"-iquote",
"-isystem",
"--sysroot",
"--gcc-toolchain",
"--target",
"-W",
"--system-header-prefix",
"--no-system-header-prefix",
"-Xclang",
"-D",
"-no-canonical-prefixes",
"-nostd",
)
open_arg = False
for arg in compile_flags:
if open_arg: