From 9a4c48a5666c75e0ccb47ecd0d9d8790c4a9a76c Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 6 Apr 2022 17:42:12 +0000 Subject: [PATCH] Add k8 toolchain --- toolchain/BUILD | 9 +++++++++ toolchain/cc_toolchain_config.bzl | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/toolchain/BUILD b/toolchain/BUILD index ad0f295d2e..b171c227b9 100644 --- a/toolchain/BUILD +++ b/toolchain/BUILD @@ -14,6 +14,7 @@ TOOLCHAINS = { "linux-x86_64": "cc-compiler-linux-x86_64", "win32": "cc-compiler-windows-x86_32", "win64": "cc-compiler-windows-x86_64", + "k8": "cc-compiler-k8", } cc_toolchain_suite( @@ -39,6 +40,14 @@ cc_toolchain_suite( for cpu, toolchain in TOOLCHAINS.items() ] +cc_toolchain_config( + name = "k8-config", + linker_path = "/usr/bin/ld", + sysroot = "/opt/manylinux/2014/x86_64", + target_cpu = "x86_64", + target_full_name = "x86_64-linux-gnu", +) + cc_toolchain_config( name = "linux-aarch_64-config", sysroot = "/opt/manylinux/2014/aarch64", diff --git a/toolchain/cc_toolchain_config.bzl b/toolchain/cc_toolchain_config.bzl index 2d3c9b66b4..afe66a8f4d 100644 --- a/toolchain/cc_toolchain_config.bzl +++ b/toolchain/cc_toolchain_config.bzl @@ -157,6 +157,21 @@ def _impl(ctx): ], ) + features = [linker_flags, compiler_flags, sysroot_flags] + + if "mingw" in ctx.attr.target_full_name: + features.append( + feature( + name = "targets_windows", + enabled = True, + #implies = ["copy_dynamic_libraries_to_binary"], + ) + ) + else: + features.append( + feature(name = "supports_pic", enabled = True) + ) + return cc_common.create_cc_toolchain_config_info( abi_libc_version = ctx.attr.abi_version, abi_version = ctx.attr.abi_version, @@ -169,7 +184,7 @@ def _impl(ctx): "/usr/local/include", "/usr/local/lib/clang", ], - features = [linker_flags, compiler_flags, sysroot_flags], + features = features, host_system_name = "local", target_cpu = ctx.attr.target_cpu, target_libc = ctx.attr.target_cpu,