diff --git a/.bazelrc b/.bazelrc index 3dbbc9c..cf6770c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -6,5 +6,9 @@ build --worker_sandboxing build --compilation_mode=opt 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_platforms_repo_for_constraints diff --git a/README.md b/README.md index 148f7c9..c6d8cec 100644 --- a/README.md +++ b/README.md @@ -25,23 +25,26 @@ http_archive( load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_toolchains") -zig_register_toolchains(register = [ - "x86_64-linux-gnu.2.28", - "x86_64-macos-gnu", -]) +zig_register_toolchains() ``` And this to `.bazelrc`: ``` 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: -- `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"]`. +- `aarch64-macos-gnu` for `["@platforms//os:macos", "@platforms//cpu:arm64"]`. Note that both Go and Bazel naming schemes are accepted. For convenience with Go, the following Go-style toolchain aliases are created: diff --git a/WORKSPACE b/WORKSPACE index 02ad586..3fbf91a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -53,11 +53,4 @@ load( zig_register_toolchains = "register_toolchains", ) -_REGISTER_TOOLCHAINS = [ - "linux_arm64_gnu.2.28", - "linux_amd64_gnu.2.19", - "darwin_amd64", - "darwin_arm64", -] - -zig_register_toolchains(register = _REGISTER_TOOLCHAINS) +zig_register_toolchains()