added Windows host support
This commit is contained in:
committed by
Motiejus Jakštys
parent
8b7597f4a1
commit
4a6eef7945
@@ -1,6 +1,7 @@
|
||||
load("@bazel-zig-cc//toolchain/private:cc_toolchains.bzl", "declare_cc_toolchains")
|
||||
|
||||
declare_cc_toolchains(
|
||||
os = {os},
|
||||
absolute_path = {absolute_path},
|
||||
zig_include_root = {zig_include_root},
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
load(":defs.bzl", "DEFAULT_INCLUDE_DIRECTORIES", "ZIG_TOOL_PATH", "target_structs")
|
||||
load(":defs.bzl", "DEFAULT_INCLUDE_DIRECTORIES", "target_structs", "zig_tool_path")
|
||||
load("@bazel-zig-cc//toolchain:zig_toolchain.bzl", "zig_cc_toolchain_config")
|
||||
|
||||
DEFAULT_TOOL_PATHS = {
|
||||
@@ -11,7 +11,7 @@ DEFAULT_TOOL_PATHS = {
|
||||
"strip": "/usr/bin/false",
|
||||
}.items()
|
||||
|
||||
def declare_cc_toolchains(absolute_path, zig_include_root):
|
||||
def declare_cc_toolchains(os, absolute_path, zig_include_root):
|
||||
for target_config in target_structs():
|
||||
gotarget = target_config.gotarget
|
||||
zigtarget = target_config.zigtarget
|
||||
@@ -28,7 +28,7 @@ def declare_cc_toolchains(absolute_path, zig_include_root):
|
||||
if path[0] == "/":
|
||||
absolute_tool_paths[name] = path
|
||||
continue
|
||||
tool_path = ZIG_TOOL_PATH.format(zig_tool = path)
|
||||
tool_path = zig_tool_path(os).format(zig_tool = path)
|
||||
absolute_tool_paths[name] = "%s/%s" % (absolute_path, tool_path)
|
||||
|
||||
linkopts = target_config.linkopts
|
||||
|
||||
@@ -4,7 +4,7 @@ DEFAULT_INCLUDE_DIRECTORIES = [
|
||||
"libcxxabi/include",
|
||||
]
|
||||
|
||||
ZIG_TOOL_PATH = "tools/{zig_tool}"
|
||||
_ZIG_TOOL_PATH = "tools/{zig_tool}"
|
||||
|
||||
# Zig supports even older glibcs than defined below, but we have tested only
|
||||
# down to 2.17.
|
||||
@@ -30,6 +30,12 @@ _GLIBCS = [
|
||||
|
||||
LIBCS = ["musl"] + ["gnu.{}".format(glibc) for glibc in _GLIBCS]
|
||||
|
||||
def zig_tool_path(os):
|
||||
if os == "windows":
|
||||
return _ZIG_TOOL_PATH + ".bat"
|
||||
else:
|
||||
return _ZIG_TOOL_PATH
|
||||
|
||||
def target_structs():
|
||||
ret = []
|
||||
for zigcpu, gocpu in (("x86_64", "amd64"), ("aarch64", "arm64")):
|
||||
|
||||
Reference in New Issue
Block a user