@@ -28,9 +28,13 @@ bazel_dep(name = "rules_rust", version = "0.54.1")
2828bazel_dep (name = "rules_foreign_cc" , version = "0.13.0" )
2929bazel_dep (name = "abseil-cpp" , version = "20240722.0" , repo_name = "com_google_absl" )
3030
31+ # TODO: Remove when protobuf is released with a version of rules_python that supports 8.x
32+ bazel_dep (name = "rules_python" , version = "1.0.0" )
33+
3134# As a workaround for https://github.com/bazelbuild/rules_foreign_cc/issues/1018.
3235rules_foreign_cc_tools = use_extension ("@rules_foreign_cc//foreign_cc:extensions.bzl" , "tools" )
3336use_repo (rules_foreign_cc_tools , ninja_mac = "ninja_1.12.1_mac" )
37+
3438register_toolchains (
3539 "//:ninja_mac_arm64_toolchain" ,
3640)
@@ -66,28 +70,29 @@ LLVM_VERSIONS = {
6670
6771llvm .toolchain (
6872 name = "llvm_toolchain" ,
69- llvm_versions = LLVM_VERSIONS ,
7073 cxx_standard = {"" : "c++17" },
74+ llvm_versions = LLVM_VERSIONS ,
7175)
7276llvm .extra_target_compatible_with (
7377 name = "llvm_toolchain" ,
7478 constraints = ["@//:cxx17" ],
7579)
7680use_repo (llvm , "llvm_toolchain" , "llvm_toolchain_llvm" )
81+
7782register_toolchains ("@llvm_toolchain//:all" )
7883
7984llvm .toolchain (
8085 name = "llvm_toolchain_cxx20" ,
81- llvm_versions = LLVM_VERSIONS ,
8286 cxx_standard = {"" : "c++20" },
87+ llvm_versions = LLVM_VERSIONS ,
8388)
8489llvm .extra_target_compatible_with (
8590 name = "llvm_toolchain_cxx20" ,
8691 constraints = ["//:cxx20" ],
8792)
8893use_repo (llvm , "llvm_toolchain_cxx20" )
89- register_toolchains ("@llvm_toolchain_cxx20//:all" )
9094
95+ register_toolchains ("@llvm_toolchain_cxx20//:all" )
9196
9297# Example toolchain with user provided URLs.
9398# TODO(siddharthab): Add test.
@@ -132,6 +137,7 @@ llvm.toolchain(
132137 absolute_paths = True ,
133138 llvm_versions = LLVM_VERSIONS ,
134139)
140+
135141# We can share the downloaded LLVM distribution with the first configuration.
136142llvm .toolchain_root (
137143 name = "llvm_toolchain_with_absolute_paths" ,
@@ -144,6 +150,7 @@ llvm.toolchain(
144150 name = "llvm_toolchain_with_system_llvm" ,
145151 llvm_versions = LLVM_VERSIONS ,
146152)
153+
147154# For this toolchain to work, the LLVM distribution archive would need to be unpacked here.
148155llvm .toolchain_root (
149156 name = "llvm_toolchain_with_system_llvm" ,
@@ -156,35 +163,38 @@ llvm.toolchain(
156163 name = "llvm_toolchain_with_sysroot" ,
157164 llvm_versions = LLVM_VERSIONS ,
158165)
166+
159167# We can share the downloaded LLVM distribution with the first configuration.
160168llvm .toolchain_root (
161169 name = "llvm_toolchain_with_sysroot" ,
162170 label = "@llvm_toolchain_llvm//:BUILD" ,
163171)
164172llvm .sysroot (
165173 name = "llvm_toolchain_with_sysroot" ,
166- targets = ["linux-x86_64" ],
167174 label = "@org_chromium_sysroot_linux_x64//:sysroot" ,
175+ targets = ["linux-x86_64" ],
168176)
169177use_repo (llvm , "llvm_toolchain_with_sysroot" )
170-
171178llvm .toolchain (
172179 name = "llvm_toolchain_linux_exec" ,
180+ exec_arch = "amd64" ,
181+ # Option 2:
182+ # distribution = "clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz",
183+ exec_os = "linux" ,
173184 llvm_version = "17.0.6" ,
174185 # Option 1:
175186 sha256 = {"" : "884ee67d647d77e58740c1e645649e29ae9e8a6fe87c1376be0f3a30f3cc9ab3" },
176187 strip_prefix = {"" : "clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04" },
177188 urls = {"" : ["https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz" ]},
178- # Option 2:
179- # distribution = "clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz",
180- exec_os = "linux" ,
181- exec_arch = "amd64" ,
182189)
183190use_repo (llvm , "llvm_toolchain_linux_exec" )
184191
185192# Toolchain example for WebAssembly.
186193llvm .toolchain (
187194 name = "llvm_toolchain_wasm" ,
195+ libclang_rt = {
196+ "@libclang_rt_wasm32//:libclang_rt.builtins-wasm32.a" : "wasm32-unknown-unknown/libclang_rt.builtins.a" ,
197+ },
188198 # WebAssembly tests use a separate (newer) version of LLVM to exercise
189199 # support for experimental features such as wasm64.
190200 llvm_versions = {
@@ -195,9 +205,6 @@ llvm.toolchain(
195205 "wasm32" : "libc" ,
196206 "wasm64" : "none" ,
197207 },
198- libclang_rt = {
199- "@libclang_rt_wasm32//:libclang_rt.builtins-wasm32.a" : "wasm32-unknown-unknown/libclang_rt.builtins.a" ,
200- },
201208)
202209llvm .sysroot (
203210 name = "llvm_toolchain_wasm" ,
@@ -209,17 +216,20 @@ llvm.sysroot(
209216 label = "@wasi_sdk_sysroots//empty" ,
210217 targets = ["wasm64" ],
211218)
212-
213219use_repo (llvm , "llvm_toolchain_wasm" )
220+
214221register_toolchains ("@llvm_toolchain_wasm//:all" )
215222
216223wasi_sdk_sysroots = use_repo_rule ("//wasm:wasi_sdk.bzl" , "wasi_sdk_sysroots" )
224+
217225wasi_sdk_sysroots (name = "wasi_sdk_sysroots" )
218226
219227libclang_rt_wasm32 = use_repo_rule ("//wasm:wasi_sdk.bzl" , "libclang_rt_wasm32" )
228+
220229libclang_rt_wasm32 (name = "libclang_rt_wasm32" )
221230
222231http_archive = use_repo_rule ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
232+
223233# This sysroot is used by github.com/vsco/bazel-toolchains.
224234http_archive (
225235 name = "org_chromium_sysroot_linux_x64" ,
0 commit comments