Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass in correct include directories to bindgen #192

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions bindgen/bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def _rust_bindgen_impl(ctx):

# libclang should only have 1 output file
libclang_dir = libclang.cc.libs.to_list()[0].dirname
include_directories = depset(
[f.dirname for f in cc_lib.cc.transitive_headers],
)
include_directories = cc_lib.cc.include_directories
quote_include_directories = cc_lib.cc.quote_include_directories
system_include_directories = cc_lib.cc.system_include_directories

# Vanilla usage of bindgen produces formatted output, here we do the same if we have `rustfmt` in our toolchain.
if rustfmt_bin:
Expand All @@ -85,6 +85,8 @@ def _rust_bindgen_impl(ctx):
args.add("--output", unformatted_output.path)
args.add("--")
args.add_all(include_directories, before_each = "-I")
args.add_all(quote_include_directories, before_each = "-iquote")
args.add_all(system_include_directories, before_each = "-isystem")
args.add_all(clang_args)
ctx.actions.run(
executable = bindgen_bin,
Expand Down