prysm-pulse/tools/cross-toolchain/cc_toolchain.BUILD.bazel.tpl
prylabs-bulldozer[bot] e2a6f5a6ea
First cut at multi-arch cross compiling toolchain (#4945)
*  PRYSM-2849 first cut at multi-arch cross compiling toolchain.  currently supports arm64 and amd64 via docker cross compiler image
* picky linter
* some readme cleanup
* remove arm 8.2 revision for arm64 builds (cortex a72 is ARMv8.0-A)
remove arm32 toolchain from multiarch dockerfile
* remove extranous WORKSPACE entries
* add docker remote execution configs for amd64 and arm64
* add osx bazelrc configs
* working osx toolchain
* update readme
* cleanup for amd, arm and osx cross before beginning windows
* initial stab at mingw windows cross
* add docker target for windows_amd64 and update readme for cross-compiling
* little more cleanup for readability
* Check in generated RBE. Still tweaking config but linux amd64 -> linux amd64 on RBE works OK. Cross compile does not work properly in RBE yet.
* fix
* update image
* Making some progress
* delete artifacts
* Working build
* Add remote config
* remove some things I added to README
* Tidy
* Update readme
* remove 2 commented lines
* buildifer
* Merge pull request #1 from prysmaticlabs/cross-compile-with-suburbandad

Cross compile with suburbandad
* Merge branch 'master' into clang-cross-compile
* buildifier on generated stuff
* Merge branch 'master' into clang-cross-compile
* Merge branch 'master' into clang-cross-compile
* Merge branch 'master' into clang-cross-compile
2020-03-05 16:59:56 +00:00

149 lines
3.3 KiB
Smarty

package(default_visibility = ["//visibility:public"])
load(":cc_toolchain_config_osx.bzl", "osx_cc_toolchain_config")
load(":cc_toolchain_config_linux_arm64.bzl", "arm64_cc_toolchain_config")
load(":cc_toolchain_config_windows.bzl", "windows_cc_toolchain_config")
cc_toolchain_suite(
name = "multiarch_toolchain",
toolchains = {
"k8|osxcross": ":cc-clang-osx",
"k8|clang": "cc-clang-amd64",
"aarch64|clang": ":cc-clang-arm64",
"k8": "cc-clang-amd64",
"aarch64": ":cc-clang-arm64",
"k8|mingw-w64": ":cc-mingw-amd64",
},
)
cc_toolchain_suite(
name = "hostonly_toolchain",
toolchains = {
"k8": "cc-clang-amd64",
},
)
filegroup(
name = "empty",
srcs = [],
)
config_setting(
name = "osx_amd64",
constraint_values = [
"@platforms//os:osx",
"@platforms//cpu:x86_64",
],
)
config_setting(
name = "linux_arm64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
)
config_setting(
name = "linux_amd64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
)
config_setting(
name = "windows_amd64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
)
arm64_cc_toolchain_config(
name = "local-arm64",
target = "aarch64-linux-gnu",
)
arm64_cc_toolchain_config(
name = "local-amd64",
target = "x86_64-unknown-linux-gnu",
)
osx_cc_toolchain_config(
name = "local-osxcross",
target = "darwin_x86_64",
)
windows_cc_toolchain_config(
name = "local-windows",
target = "x86_64-w64",
)
cc_toolchain(
name = "cc-mingw-amd64",
all_files = ":empty",
ar_files = ":empty",
as_files = ":mingw_compiler_files",
compiler_files = ":mingw_compiler_files",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 0,
toolchain_config = ":local-windows",
)
cc_toolchain(
name = "cc-clang-arm64",
all_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
toolchain_config = ":local-arm64",
)
cc_toolchain(
name = "cc-clang-osx",
all_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
toolchain_config = ":local-osxcross",
)
cc_toolchain(
name = "cc-clang-amd64",
all_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
toolchain_config = ":local-amd64",
)
toolchain(
name = "cc-toolchain-multiarch",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
target_compatible_with = [],
toolchain = select({
":linux_arm64": ":cc-clang-arm64",
":linux_amd64": ":cc-clang-amd64",
":osx_amd64": ":cc-clang-osx",
":windows_amd64": ":cc-mingw-amd64",
}),
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)