xref: /aosp_15_r20/external/skia/toolchain/download_toolchains.bzl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1"""
2This file exports the various toolchains for the hosts that we support building Skia on.
3
4Supported:
5 - Linux amd64
6 - Mac (one toolchain for both M1 and Intel CPUs)
7
8Planned:
9 - Windows amd64
10
11"""
12
13load(":download_ios_toolchain.bzl", "download_ios_toolchain")
14load(":download_linux_amd64_toolchain.bzl", "download_linux_amd64_toolchain")
15load(":download_mac_toolchain.bzl", "download_mac_toolchain")
16load(":download_ndk_linux_amd64_toolchain.bzl", "download_ndk_linux_amd64_toolchain")
17load(":download_windows_amd64_toolchain.bzl", "download_windows_amd64_toolchain")
18
19# This key in this dictionary (and thus the name passed into the rule) controls what the subfolder
20# will be called in the external directory. It must match what we use in the appropriate
21# toolchain_config.bzl file or it will not be able to locate the sysroot to build with.
22name_toolchain = {
23    "clang_linux_amd64": download_linux_amd64_toolchain,
24    "clang_mac": download_mac_toolchain,
25    "clang_windows_amd64": download_windows_amd64_toolchain,
26    "ndk_linux_amd64": download_ndk_linux_amd64_toolchain,
27    "clang_ios": download_ios_toolchain,
28}
29
30def download_toolchains_for_skia(*args):
31    """
32    Point Bazel to the correct rules for downloading the different toolchains.
33
34    Args:
35        *args: multiple toolchains, see top of file for
36               list of supported toolchains.
37    """
38
39    for toolchain_name in args:
40        if toolchain_name not in name_toolchain:
41            fail("unrecognized toolchain name " + toolchain_name)
42        download_toolchain = name_toolchain[toolchain_name]
43        download_toolchain(name = toolchain_name)
44