-
Notifications
You must be signed in to change notification settings - Fork 2
/
cc_toolchain_config_android_arm64.bzl
91 lines (89 loc) · 2.82 KB
/
cc_toolchain_config_android_arm64.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
load("@android_ndk//:android_ndk.bzl", "ANDROID_NDK_HOME")
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"feature",
"flag_group",
"flag_set",
"tool_path",
)
def _impl_android_arm64(ctx):
# TODO: make hermetic
tool_paths = [
tool_path(
name = "gcc",
path = ANDROID_NDK_HOME + "/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang",
),
tool_path(
name = "ld",
path = ANDROID_NDK_HOME + "/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld.gold",
),
tool_path(
name = "ar",
path = ANDROID_NDK_HOME + "/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar",
),
tool_path(
name = "cpp",
path = ANDROID_NDK_HOME + "/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang++",
),
tool_path(
name = "gcov",
path = "/bin/false",
),
tool_path(
name = "nm",
path = "/bin/false",
),
tool_path(
name = "objdump",
path = "/bin/false",
),
tool_path(
name = "strip",
path = "/bin/false",
),
]
features = [
feature(
name = "default_linker_flags",
enabled = True,
flag_sets = [
flag_set(
actions = [
ACTION_NAMES.cpp_link_executable,
ACTION_NAMES.cpp_link_dynamic_library,
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
],
flag_groups = ([
flag_group(
flags = [
"-lstdc++",
],
),
]),
),
],
),
]
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
cxx_builtin_include_directories = [
ANDROID_NDK_HOME + "/toolchains/llvm/prebuilt/linux-x86_64/include",
ANDROID_NDK_HOME + "/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include"
],
features = features,
toolchain_identifier = "local",
host_system_name = "local",
target_system_name = "android",
target_cpu = "@platforms//cpu:aarch64",
target_libc = "unknown",
compiler = "android_arm64",
abi_version = "unknown",
abi_libc_version = "unknown",
tool_paths = tool_paths,
)
cc_toolchain_config_android_arm64 = rule(
implementation = _impl_android_arm64,
attrs = {},
provides = [CcToolchainConfigInfo],
)