Skip to content

Commit

Permalink
Make it possible to not specify clang binary in bindgen (#2746)
Browse files Browse the repository at this point in the history
Co-authored-by: Krasimir Georgiev <[email protected]>
  • Loading branch information
hlopko and krasimirgg authored Jul 17, 2024
1 parent db89d83 commit 147886f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bindgen/private/bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,17 @@ def _rust_bindgen_impl(ctx):

cc_toolchain, feature_configuration = find_cc_toolchain(ctx = ctx)

tools = depset([clang_bin], transitive = [cc_toolchain.all_files])
tools = depset(([clang_bin] if clang_bin else []), transitive = [cc_toolchain.all_files])

# libclang should only have 1 output file
libclang_dir = _get_libs_for_static_executable(libclang).to_list()[0].dirname

env = {
"CLANG_PATH": clang_bin.path,
"LIBCLANG_PATH": libclang_dir,
"RUST_BACKTRACE": "1",
}
if clang_bin:
env["CLANG_PATH"] = clang_bin.path

args = ctx.actions.args()

Expand Down

0 comments on commit 147886f

Please sign in to comment.