# Copyright Materialize, Inc. and contributors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License in the LICENSE file at the # root of this repository, or online at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Registering toolchains. We should only be _manually_ registering esoteric toolchains, more common toolchains like C or Rust should be handled by a higher level rule set, e.g. [`toolchains_llvm`](https://github.com/bazel-contrib/toolchains_llvm) or [`rules_rust`](https://github.com/bazelbuild/rules_rust) respectively. Note: These registrations live here, and not in the `WORKSPACE` file or a `.bzl` file because of Bazel limitations. See: """ load("@rules_rust_bindgen//:defs.bzl", "rust_bindgen_toolchain") # Rust Bindgen Toolchains # # [`bindgen`](https://github.com/rust-lang/rust-bindgen) automatically generates Rust FFI # bindings to C libraries using `clang`. `rules_rust` provides the `bindgen` CLI tool # and we need to provide the necessary parts of a `clang` toolchain. # Darwin aarch64 rust_bindgen_toolchain( name = "bindgen_toolchain_darwin__aarch64", bindgen = "@rules_rust_bindgen//3rdparty:bindgen", clang = "@rust_bindgen__darwin_aarch64//:clang", libclang = "@rust_bindgen__darwin_aarch64//:libclang", libstdcxx = "@rust_bindgen__darwin_aarch64//:libc++", ) toolchain( name = "rust_bindgen_toolchain__darwin_aarch64", exec_compatible_with = [ "@platforms//os:macos", ], toolchain = "bindgen_toolchain_darwin__aarch64", toolchain_type = "@rules_rust_bindgen//:toolchain_type", visibility = ["//visibility:public"], ) # Darwin x86_64 rust_bindgen_toolchain( name = "bindgen_toolchain_darwin__x86_64", bindgen = "@rules_rust_bindgen//3rdparty:bindgen", clang = "@rust_bindgen__darwin_x86_64//:clang", libclang = "@rust_bindgen__darwin_x86_64//:libclang", libstdcxx = "@rust_bindgen__darwin_x86_64//:libc++", ) toolchain( name = "rust_bindgen_toolchain__darwin_x86_64", exec_compatible_with = [ "@platforms//os:macos", "@platforms//cpu:x86_64", ], toolchain = "bindgen_toolchain_darwin__x86_64", toolchain_type = "@rules_rust_bindgen//:toolchain_type", visibility = ["//visibility:public"], ) # Linux aarch64 rust_bindgen_toolchain( name = "bindgen_toolchain_linux__aarch64", bindgen = "@rules_rust_bindgen//3rdparty:bindgen", clang = "@rust_bindgen__linux_aarch64//:clang", libclang = "@rust_bindgen__linux_aarch64//:libclang", libstdcxx = "@rust_bindgen__linux_aarch64//:libc++", ) toolchain( name = "rust_bindgen_toolchain__linux_aarch64", exec_compatible_with = [ "@platforms//os:linux", "@platforms//cpu:aarch64", ], toolchain = "bindgen_toolchain_linux__aarch64", toolchain_type = "@rules_rust_bindgen//:toolchain_type", visibility = ["//visibility:public"], ) # Linux x86_64 rust_bindgen_toolchain( name = "bindgen_toolchain_linux__x86_64", bindgen = "@rules_rust_bindgen//3rdparty:bindgen", clang = "@rust_bindgen__linux_x86_64//:clang", libclang = "@rust_bindgen__linux_x86_64//:libclang", libstdcxx = "@rust_bindgen__linux_x86_64//:libc++", ) toolchain( name = "rust_bindgen_toolchain__linux_x86_64", exec_compatible_with = [ "@platforms//os:linux", "@platforms//cpu:x86_64", ], toolchain = "bindgen_toolchain_linux__x86_64", toolchain_type = "@rules_rust_bindgen//:toolchain_type", visibility = ["//visibility:public"], )