1- load("@rules_cpp//cpp:rules.bzl", "declare_clang_toolchains")
2- load("@rules_cpp//cpp/private:tool.bzl", "tool")
1+ load("@rules_cpp//cpp:rules.bzl",
2+ "declare_clang_toolchains",
3+ "compiler",
4+ "standard_library",
5+ "binutils",
6+ "linker",
7+ )
38
49filegroup(
5- name = "clang-files ",
10+ name = "openmp ",
611 srcs = glob([
7- "bin/clang*",
8- "lib/clang/**/*",
9- "lib/*LTO*",
12+ "lib/*omp*",
1013 ]),
1114 visibility = ["//visibility:public"],
1215)
1316
1417filegroup(
15- name = "binutils ",
18+ name = "clang-files ",
1619 srcs = glob([
17- "bin/llvm-objcopy*",
18- "bin/llvm-dwp*",
19- "bin/llvm-cov*",
20- "bin/llvm-strip*",
21- "bin/llvm-nm*",
22- "bin/llvm-ar*",
23- "bin/llvm-strings*",
20+ "bin/clang*",
21+ "lib/clang/**/*",
22+ "lib/*LTO*",
23+ "lib/libclang*",
24+ "lib/libLLVM*",
2425 ]),
25- visibility = ["//visibility:public"],
2626)
2727
28- tool(
29- name = "strip",
30- executable = "bin/llvm-strip",
31- )
32-
33- tool(
34- name = "ar",
35- executable = "bin/llvm-ar",
28+ compiler(
29+ name = "clang",
30+ kind = "clang",
31+ binary = "bin/clang",
32+ deps = [":clang-files", ":openmp"]
3633)
3734
38- filegroup(
39- name = "openmp",
40- srcs = glob([
41- "lib/*omp*",
35+ binutils(
36+ name = "binutils",
37+ ar = "bin/llvm-ar",
38+ assembler = "bin/clang",
39+ objcopy = "bin/llvm-objcopy",
40+ strip = "bin/llvm-strip",
41+ dwp = "bin/llvm-dwp",
42+ deps = glob([
43+ "bin/llvm-*",
4244 ]),
4345 visibility = ["//visibility:public"],
4446)
@@ -52,54 +54,40 @@ filegroup(
5254 visibility = ["//visibility:public"],
5355)
5456
55- tool (
57+ linker (
5658 name = "lld",
57- executable = "bin/lld",
59+ kind = "lld",
60+ binary = "bin/ld.lld",
61+ deps = [":lld-files"],
5862 visibility = ["//visibility:public"],
59- data = [":lld-files"]
6063)
6164
62- filegroup (
65+ standard_library (
6366 name = "libc++",
64- srcs = glob([
67+ kind = "libc++",
68+ headers = glob([
6569 "include/c++/**/*",
6670 "include/x86_64-unknown-linux-gnu/**/*",
67- "lib/*c++*",
6871 ]),
69- visibility = ["//visibility:public"],
70- )
71-
72- filegroup(
73- name = "static_libc++",
74- srcs = glob([
72+ shared_libraries = glob([
73+ "lib/**/*c++*.so",
74+ "lib/**/*c++*.dylib",
75+ ]),
76+ static_libraries = glob([
7577 "lib/**/libc++.a",
7678 "lib/**/libc++abi.a",
7779 "lib/**/libunwind.a",
7880 ]),
79- visibility = ["//visibility:public"],
80- )
81-
82- tool(
83- name = "clang",
84- executable = "bin/clang",
85- data = [
86- ":clang-files",
87- ":binutils",
88- ":openmp",
89- ":lld",
90- ":libc++",
91- ":static_libc++",
92- ],
93- visibility = ["//visibility:public"],
81+ includes = [
82+ "include/c++/v1",
83+ "include/x86_64-unknown-linux-gnu/c++/v1",
84+ ]
9485)
9586
9687declare_clang_toolchains(
9788 name = "toolchain",
9889 compiler = ":clang",
9990 linker = ":lld",
10091 stdlib = ":libc++",
101- static_stdlib = ":static_libc++",
10292 binutils = ":binutils",
103- strip = ":strip",
104- archiver = ":ar",
10593)
0 commit comments