recommend registering toolchains via .bazelrc
This commit is contained in:
parent
424b1ca27d
commit
3325986971
4
.bazelrc
4
.bazelrc
@ -6,5 +6,9 @@ build --worker_sandboxing
|
|||||||
build --compilation_mode=opt
|
build --compilation_mode=opt
|
||||||
|
|
||||||
build --incompatible_enable_cc_toolchain_resolution
|
build --incompatible_enable_cc_toolchain_resolution
|
||||||
|
build --extra_toolchains @zig_sdk//:linux_amd64_gnu.2.19_toolchain
|
||||||
|
build --extra_toolchains @zig_sdk//:linux_arm64_gnu.2.28_toolchain
|
||||||
|
build --extra_toolchains @zig_sdk//:darwin_amd64_toolchain
|
||||||
|
build --extra_toolchains @zig_sdk//:darwin_arm64_toolchain
|
||||||
#build --incompatible_use_cc_configure_from_rules_cc
|
#build --incompatible_use_cc_configure_from_rules_cc
|
||||||
#build --incompatible_use_platforms_repo_for_constraints
|
#build --incompatible_use_platforms_repo_for_constraints
|
||||||
|
15
README.md
15
README.md
@ -25,23 +25,26 @@ http_archive(
|
|||||||
|
|
||||||
load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_toolchains")
|
load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_toolchains")
|
||||||
|
|
||||||
zig_register_toolchains(register = [
|
zig_register_toolchains()
|
||||||
"x86_64-linux-gnu.2.28",
|
|
||||||
"x86_64-macos-gnu",
|
|
||||||
])
|
|
||||||
```
|
```
|
||||||
|
|
||||||
And this to `.bazelrc`:
|
And this to `.bazelrc`:
|
||||||
|
|
||||||
```
|
```
|
||||||
build --incompatible_enable_cc_toolchain_resolution
|
build --incompatible_enable_cc_toolchain_resolution
|
||||||
|
build --extra_toolchains @zig_sdk//:linux_amd64_gnu.2.19_toolchain
|
||||||
|
build --extra_toolchains @zig_sdk//:linux_arm64_gnu.2.28_toolchain
|
||||||
|
build --extra_toolchains @zig_sdk//:darwin_amd64_toolchain
|
||||||
|
build --extra_toolchains @zig_sdk//:darwin_arm64_toolchain
|
||||||
```
|
```
|
||||||
|
|
||||||
The snippet above will download the zig toolchain and register it for the
|
The snippets above will download the zig toolchain and register it for the
|
||||||
following platforms:
|
following platforms:
|
||||||
|
|
||||||
- `x86_64-linux-gnu.2.28` for `["@platforms//os:linux", "@platforms//cpu:x86_64"]`.
|
- `x86_64-linux-gnu.2.19` for `["@platforms//os:linux", "@platforms//cpu:x86_64"]`.
|
||||||
|
- `x86_64-linux-gnu.2.28` for `["@platforms//os:linux", "@platforms//cpu:arm64"]`.
|
||||||
- `x86_64-macos-gnu` for `["@platforms//os:macos", "@platforms//cpu:x86_64"]`.
|
- `x86_64-macos-gnu` for `["@platforms//os:macos", "@platforms//cpu:x86_64"]`.
|
||||||
|
- `aarch64-macos-gnu` for `["@platforms//os:macos", "@platforms//cpu:arm64"]`.
|
||||||
|
|
||||||
Note that both Go and Bazel naming schemes are accepted. For convenience with
|
Note that both Go and Bazel naming schemes are accepted. For convenience with
|
||||||
Go, the following Go-style toolchain aliases are created:
|
Go, the following Go-style toolchain aliases are created:
|
||||||
|
@ -53,11 +53,4 @@ load(
|
|||||||
zig_register_toolchains = "register_toolchains",
|
zig_register_toolchains = "register_toolchains",
|
||||||
)
|
)
|
||||||
|
|
||||||
_REGISTER_TOOLCHAINS = [
|
zig_register_toolchains()
|
||||||
"linux_arm64_gnu.2.28",
|
|
||||||
"linux_amd64_gnu.2.19",
|
|
||||||
"darwin_amd64",
|
|
||||||
"darwin_arm64",
|
|
||||||
]
|
|
||||||
|
|
||||||
zig_register_toolchains(register = _REGISTER_TOOLCHAINS)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user