add aarch64
This commit is contained in:
parent
4e48d6f1af
commit
31316fd30c
|
@ -4,6 +4,7 @@ load(":zig_toolchain.bzl", "zig_cc_toolchain_config")
|
||||||
DEFAULT_TOOL_PATHS = {
|
DEFAULT_TOOL_PATHS = {
|
||||||
"ar": "ar",
|
"ar": "ar",
|
||||||
"gcc": "c++", # https://github.com/bazelbuild/bazel/issues/4644
|
"gcc": "c++", # https://github.com/bazelbuild/bazel/issues/4644
|
||||||
|
|
||||||
"cpp": "/usr/bin/false",
|
"cpp": "/usr/bin/false",
|
||||||
"gcov": "/usr/bin/false",
|
"gcov": "/usr/bin/false",
|
||||||
"nm": "/usr/bin/false",
|
"nm": "/usr/bin/false",
|
||||||
|
@ -18,14 +19,14 @@ DEFAULT_INCLUDE_DIRECTORIES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
# https://github.com/ziglang/zig/blob/0cfa39304b18c6a04689bd789f5dc4d035ec43b0/src/main.zig#L2962-L2966
|
# https://github.com/ziglang/zig/blob/0cfa39304b18c6a04689bd789f5dc4d035ec43b0/src/main.zig#L2962-L2966
|
||||||
TARGET_CONFIGS = [
|
TARGET_CONFIGS_LISTOFLISTS = [[
|
||||||
struct(
|
struct(
|
||||||
target = "x86_64-macos-gnu",
|
target="{}-macos-gnu".format(cpu),
|
||||||
includes=[
|
includes=[
|
||||||
"libunwind/include",
|
"libunwind/include",
|
||||||
"libc/include/any-macos-any",
|
"libc/include/any-macos-any",
|
||||||
"libc/include/x86_64-macos-any",
|
"libc/include/{}-macos-any".format(cpu),
|
||||||
"libc/include/x86_64-macos-gnu",
|
"libc/include/{}-macos-gnu".format(cpu),
|
||||||
],
|
],
|
||||||
# linkopts=["-lc++", "-lc++abi"],
|
# linkopts=["-lc++", "-lc++abi"],
|
||||||
linkopts=[],
|
linkopts=[],
|
||||||
|
@ -33,63 +34,66 @@ TARGET_CONFIGS = [
|
||||||
bazel_target_cpu="darwin",
|
bazel_target_cpu="darwin",
|
||||||
constraint_values=[
|
constraint_values=[
|
||||||
"@platforms//os:macos",
|
"@platforms//os:macos",
|
||||||
"@platforms//cpu:x86_64",
|
"@platforms//cpu:{}".format(cpu),
|
||||||
],
|
],
|
||||||
tool_paths={"ld": "ld64.lld"},
|
tool_paths={"ld": "ld64.lld"},
|
||||||
),
|
),
|
||||||
] + [
|
|
||||||
struct(
|
struct(
|
||||||
target = "x86_64-linux-gnu",
|
target="{}-linux-gnu".format(cpu),
|
||||||
target_suffix = ".2.19",
|
target_suffix = ".2.19",
|
||||||
includes=[
|
includes=[
|
||||||
"libunwind/include",
|
"libunwind/include",
|
||||||
"libc/include/generic-glibc",
|
"libc/include/generic-glibc",
|
||||||
"libc/include/any-linux-any",
|
"libc/include/any-linux-any",
|
||||||
"libc/include/x86_64-linux-gnu",
|
"libc/include/{}-linux-gnu".format(cpu),
|
||||||
"libc/include/x86_64-linux-any",
|
"libc/include/{}-linux-any".format(cpu),
|
||||||
],
|
],
|
||||||
linkopts=["-lc++", "-lc++abi"],
|
linkopts=["-lc++", "-lc++abi"],
|
||||||
copts=[],
|
copts=[],
|
||||||
bazel_target_cpu="k8",
|
bazel_target_cpu="k8",
|
||||||
constraint_values=[
|
constraint_values=[
|
||||||
"@platforms//os:linux",
|
"@platforms//os:linux",
|
||||||
"@platforms//cpu:x86_64",
|
"@platforms//cpu:{}".format(cpu),
|
||||||
],
|
],
|
||||||
tool_paths={"ld": "ld.lld"},
|
tool_paths={"ld": "ld.lld"},
|
||||||
),
|
),
|
||||||
struct(
|
struct(
|
||||||
target = "x86_64-linux-musl",
|
target="{}-linux-musl".format(cpu),
|
||||||
includes=[
|
includes=[
|
||||||
"libc/include/generic-musl",
|
"libc/include/generic-musl",
|
||||||
"libc/include/any-linux-any",
|
"libc/include/any-linux-any",
|
||||||
"libc/include/x86_64-linux-musl",
|
"libc/include/{}-linux-musl".format(cpu),
|
||||||
"libc/include/x86_64-linux-any",
|
"libc/include/{}-linux-any".format(cpu),
|
||||||
],
|
],
|
||||||
linkopts=[],
|
linkopts=[],
|
||||||
copts=["-D_LIBCPP_HAS_MUSL_LIBC", "-D_LIBCPP_HAS_THREAD_API_PTHREAD"],
|
copts=["-D_LIBCPP_HAS_MUSL_LIBC", "-D_LIBCPP_HAS_THREAD_API_PTHREAD"],
|
||||||
bazel_target_cpu="k8",
|
bazel_target_cpu="k8",
|
||||||
constraint_values=[
|
constraint_values=[
|
||||||
"@platforms//os:linux",
|
"@platforms//os:linux",
|
||||||
"@platforms//cpu:x86_64",
|
"@platforms//cpu:{}".format(cpu),
|
||||||
":musl",
|
":musl",
|
||||||
],
|
],
|
||||||
tool_paths={"ld": "ld.lld"},
|
tool_paths={"ld": "ld.lld"},
|
||||||
),
|
),
|
||||||
]
|
] for cpu in ("x86_64", "aarch64")]
|
||||||
|
|
||||||
|
TARGET_CONFIGS = [val for sublist in TARGET_CONFIGS_LISTOFLISTS for val in sublist]
|
||||||
|
|
||||||
def toolchain_repositories():
|
def toolchain_repositories():
|
||||||
zig_repository(
|
zig_repository(
|
||||||
name = "zig_sdk",
|
name = "zig_sdk",
|
||||||
|
|
||||||
version = "0.8.0",
|
version = "0.8.0",
|
||||||
url_format = "https://ziglang.org/download/{version}/zig-{host_platform}-{version}.tar.xz",
|
url_format = "https://ziglang.org/download/{version}/zig-{host_platform}-{version}.tar.xz",
|
||||||
host_platform_sha256 = {
|
host_platform_sha256 = {
|
||||||
"linux-x86_64": "502625d3da3ae595c5f44a809a87714320b7a40e6dff4a895b5fa7df3391d01e",
|
"linux-x86_64": "502625d3da3ae595c5f44a809a87714320b7a40e6dff4a895b5fa7df3391d01e",
|
||||||
"macos-x86_64": "279f9360b5cb23103f0395dc4d3d0d30626e699b1b4be55e98fd985b62bc6fbe",
|
"macos-x86_64": "279f9360b5cb23103f0395dc4d3d0d30626e699b1b4be55e98fd985b62bc6fbe",
|
||||||
},
|
},
|
||||||
|
|
||||||
host_platform_include_root = {
|
host_platform_include_root = {
|
||||||
"macos-x86_64": "lib/zig/",
|
"macos-x86_64": "lib/zig/",
|
||||||
"linux-x86_64": "lib/",
|
"linux-x86_64": "lib/",
|
||||||
},
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def register_all_toolchains():
|
def register_all_toolchains():
|
||||||
|
@ -228,7 +232,7 @@ def zig_build_macro(absolute_path, zig_include_root):
|
||||||
zig_cc_toolchain_config(
|
zig_cc_toolchain_config(
|
||||||
name = target + "_cc_toolchain_config",
|
name = target + "_cc_toolchain_config",
|
||||||
target = target,
|
target = target,
|
||||||
target_suffix = getattr(target_config, "target_suffix", ""),
|
target_suffix = getattr(target_config, 'target_suffix', ''),
|
||||||
tool_paths = absolute_tool_paths,
|
tool_paths = absolute_tool_paths,
|
||||||
cxx_builtin_include_directories = cxx_builtin_include_directories,
|
cxx_builtin_include_directories = cxx_builtin_include_directories,
|
||||||
copts = target_config.copts,
|
copts = target_config.copts,
|
||||||
|
@ -260,7 +264,7 @@ def zig_build_macro(absolute_path, zig_include_root):
|
||||||
toolchains = {
|
toolchains = {
|
||||||
target_config.bazel_target_cpu: ":%s_cc_toolchain" % target,
|
target_config.bazel_target_cpu: ":%s_cc_toolchain" % target,
|
||||||
},
|
},
|
||||||
tags = ["manual"],
|
tags = ["manual"]
|
||||||
)
|
)
|
||||||
|
|
||||||
native.toolchain(
|
native.toolchain(
|
||||||
|
|
Loading…
Reference in New Issue