| load(":ndk_linux_arm64_toolchain_config.bzl", "ndk_cc_toolchain_config") |
| load(":clang_linux_amd64_toolchain_config.bzl", "provide_linux_amd64_toolchain_config") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| toolchain( |
| name = "linux_amd64_clang_toolchain", |
| # Where should we run this toolchain? |
| exec_compatible_with = [ |
| "@platforms//os:linux", |
| "@platforms//cpu:x86_64", |
| ], |
| # What can this toolchain build? |
| target_compatible_with = [ |
| "@platforms//os:linux", |
| "@platforms//cpu:x86_64", |
| # We want to be able to explicitly tell Bazel to use this toolchain, and not the |
| # default one on a user's machine or on the RBE worker. Thus we need an extra constraint |
| # that we can use to differentiate the "stock" C++ toolchain from our hermetic one and |
| # force that use by specifying the target platform. |
| "//bazel/platform:use_hermetic_toolchain", |
| ], |
| toolchain = ":linux_amd64_clang", |
| # https://github.com/bazelbuild/rules_cc/blob/8bb0eb5c5ccd96b91753bb112096bb6993d16d13/cc/BUILD#L32-L36 |
| toolchain_type = "@rules_cc//cc:toolchain_type", |
| ) |
| |
| toolchain( |
| name = "linux_amd64_ndk_arm64_toolchain", |
| exec_compatible_with = [ |
| "@platforms//os:linux", |
| "@platforms//cpu:x86_64", |
| ], |
| target_compatible_with = [ |
| "@platforms//os:android", |
| "@platforms//cpu:arm64", |
| ], |
| toolchain = ":linux_amd64_ndk_arm64", |
| toolchain_type = "@rules_cc//cc:toolchain_type", |
| ) |
| |
| toolchain( |
| name = "linux_amd64_ndk_arm32_toolchain", |
| exec_compatible_with = [ |
| "@platforms//os:linux", |
| "@platforms//cpu:x86_64", |
| ], |
| target_compatible_with = [ |
| "@platforms//os:android", |
| "@platforms//cpu:armv7", |
| ], |
| toolchain = ":linux_amd64_ndk_arm32", |
| toolchain_type = "@rules_cc//cc:toolchain_type", |
| ) |
| |
| filegroup(name = "not_implemented") |
| |
| ################################### |
| # clang on linux amd64 toolchain. # |
| ################################### |
| |
| provide_linux_amd64_toolchain_config( |
| name = "linux_amd64_toolchain_config", |
| ) |
| |
| filegroup( |
| name = "archive_linux_amd64_files", |
| srcs = [ |
| "linux_amd64_trampolines/ar.sh", |
| "@clang_linux_amd64//:archive_files", |
| ], |
| ) |
| |
| filegroup( |
| name = "compile_linux_amd64_files", |
| srcs = [ |
| "linux_amd64_trampolines/clang.sh", |
| "@clang_linux_amd64//:compile_files", |
| ], |
| ) |
| |
| filegroup( |
| name = "link_linux_amd64_files", |
| srcs = [ |
| # Bazel assumes it is talking to Clang when linking. |
| "linux_amd64_trampolines/clang.sh", |
| "@clang_linux_amd64//:link_files", |
| ], |
| ) |
| |
| cc_toolchain( |
| name = "linux_amd64_clang", |
| all_files = ":not_implemented", |
| ar_files = ":archive_linux_amd64_files", |
| compiler_files = ":compile_linux_amd64_files", |
| dwp_files = ":not_implemented", |
| linker_files = ":link_linux_amd64_files", |
| objcopy_files = ":not_implemented", |
| strip_files = ":not_implemented", |
| supports_param_files = False, |
| toolchain_config = ":linux_amd64_toolchain_config", |
| ) |
| |
| ############################ |
| # arm64-v8a C++ toolchain. # |
| ############################ |
| |
| # https://bazel.build/reference/be/c-cpp#cc_toolchain |
| cc_toolchain( |
| name = "linux_amd64_ndk_arm64", |
| all_files = ":not_implemented", |
| ar_files = ":ndk_arm64_v8a_toolchain_all_files", |
| compiler_files = ":ndk_arm64_v8a_toolchain_all_files", |
| dwp_files = ":not_implemented", |
| dynamic_runtime_lib = "@ndk_linux_amd64//:arm64_v8a_dynamic_runtime_libraries", |
| linker_files = ":ndk_arm64_v8a_toolchain_all_files", |
| objcopy_files = ":not_implemented", |
| static_runtime_lib = "@ndk_linux_amd64//:arm64_v8a_static_runtime_libraries", |
| strip_files = ":not_implemented", |
| supports_param_files = False, |
| toolchain_config = ":ndk_arm64_v8a_toolchain_config", |
| ) |
| |
| filegroup( |
| name = "ndk_arm64_v8a_toolchain_all_files", |
| srcs = glob(["android_trampolines/*.sh"]) + ["@ndk_linux_amd64//:arm64_v8a_all_files"], |
| ) |
| |
| ndk_cc_toolchain_config( |
| name = "ndk_arm64_v8a_toolchain_config", |
| cpu = "arm64-v8a", |
| ) |
| |
| ############################## |
| # armeabi-v7a C++ toolchain. # |
| ############################## |
| |
| # https://bazel.build/reference/be/c-cpp#cc_toolchain |
| cc_toolchain( |
| name = "linux_amd64_ndk_arm32", |
| all_files = ":not_implemented", |
| ar_files = ":ndk_armeabi_v7a_toolchain_all_files", |
| compiler_files = ":ndk_armeabi_v7a_toolchain_all_files", |
| dwp_files = ":not_implemented", |
| dynamic_runtime_lib = "@ndk_linux_amd64//:armeabi_v7a_dynamic_runtime_libraries", |
| linker_files = ":ndk_armeabi_v7a_toolchain_all_files", |
| objcopy_files = ":not_implemented", |
| static_runtime_lib = "@ndk_linux_amd64//:armeabi_v7a_static_runtime_libraries", |
| strip_files = ":not_implemented", |
| supports_param_files = False, |
| toolchain_config = ":ndk_armeabi_v7a_toolchain_config", |
| ) |
| |
| filegroup( |
| name = "ndk_armeabi_v7a_toolchain_all_files", |
| srcs = glob(["android_trampolines/*.sh"]) + ["@ndk_linux_amd64//:armeabi_v7a_all_files"], |
| ) |
| |
| ndk_cc_toolchain_config( |
| name = "ndk_armeabi_v7a_toolchain_config", |
| cpu = "armeabi-v7a", |
| ) |