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

Add support for LLVM toolchain #2014

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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 .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ build --host_cxxopt=-std=c++17
# this only works for Clang toolchain AFAIK
# https://github.com/bazelbuild/bazel/pull/11440
build --features=layering_check
# Set the default compiler to the `clang` binary on the `PATH`.
# TODO(fzakaria): Make this a toolchain or hermetic somehow
build --repo_env=CC=clang

# Make sure we don't pickup the default CPP toolchains
build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# Not needed after https://github.com/bazelbuild/bazel/issues/7260 is closed
build --incompatible_enable_cc_toolchain_resolution
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline at eof

11 changes: 11 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
bazel_dep(name = "toolchains_llvm", version = "0.10.3")
bazel_dep(name = "bazel_skylib", version = "1.3.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we need to change the bazel_skylib version here to 1.4.2

bazel_dep(name = "rules_python", version = "0.30.0")

Expand All @@ -17,3 +18,13 @@ python.toolchain(
is_default = True,
python_version = "3.10",
)

# Steps from https://github.com/bazel-contrib/toolchains_llvm/releases/tag/0.10.3
# Configure and register the toolchain.
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
llvm_version = "11.1.0",
)
use_repo(llvm, "llvm_toolchain")

register_toolchains("@llvm_toolchain//:all")
Loading
Loading