Skip to content

Commit b2f7dd3

Browse files
committed
Add support for Windows target and host
1 parent ace6215 commit b2f7dd3

7 files changed

Lines changed: 494 additions & 81 deletions

File tree

platforms/BUILD.bazel

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,19 @@ platform(
9393
"@platforms//cpu:wasm64",
9494
],
9595
)
96+
97+
platform(
98+
name = "windows-x86_64",
99+
constraint_values = [
100+
"@platforms//os:windows",
101+
"@platforms//cpu:x86_64",
102+
],
103+
)
104+
105+
platform(
106+
name = "windows-aarch64",
107+
constraint_values = [
108+
"@platforms//os:windows",
109+
"@platforms//cpu:aarch64",
110+
],
111+
)

toolchain/BUILD.llvm_repo.tpl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ exports_files(glob(
3030
filegroup(
3131
name = "clang",
3232
srcs = [
33-
"bin/clang",
34-
"bin/clang++",
35-
"bin/clang-cpp",
33+
"bin/clang",
34+
"bin/clang++",
35+
"bin/clang-cpp",
36+
"bin/clang-cl",
37+
"bin/lld-link",
3638
],
3739
)
3840

@@ -42,6 +44,7 @@ filegroup(
4244
srcs = [
4345
"bin/ld.lld",
4446
"bin/ld64.lld",
47+
"bin/lld-link",
4548
] + glob(["bin/wasm-ld"], allow_empty = True),
4649
)
4750

@@ -185,6 +188,7 @@ filegroup(
185188
[
186189
"lib/libclang.so",
187190
"lib/libclang.dylib",
191+
"lib/libclang.lib",
188192
],
189193
allow_empty = True,
190194
),
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
# Copyright 2021 The Bazel Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
package(default_visibility = ["//visibility:public"])
16+
17+
# Some targets may need to directly depend on these files.
18+
exports_files(glob(
19+
[
20+
"bin/*",
21+
"lib/**",
22+
"include/**",
23+
"share/clang/*",
24+
],
25+
allow_empty = True,
26+
))
27+
28+
## LLVM toolchain files
29+
30+
ALL_DLLS = glob(["bin/*.dll"], allow_empty=True)
31+
32+
filegroup(
33+
name = "clang",
34+
srcs = [
35+
"bin/clang.exe",
36+
"bin/clang++.exe",
37+
"bin/clang-cpp.exe",
38+
"bin/clang-cl.exe",
39+
"bin/lld-link.exe",
40+
] + ALL_DLLS,
41+
)
42+
43+
filegroup(
44+
name = "ld",
45+
# Not all distributions contain wasm-ld.
46+
srcs = [
47+
"bin/ld.lld.exe",
48+
"bin/ld64.lld.exe",
49+
] + ALL_DLLS,
50+
)
51+
52+
filegroup(
53+
name = "include",
54+
srcs = glob(
55+
[
56+
"include/**/c++/**",
57+
"lib/clang/*/include/**",
58+
],
59+
),
60+
)
61+
62+
filegroup(
63+
name = "all_includes",
64+
srcs = glob(
65+
["include/**"],
66+
allow_empty = True,
67+
),
68+
)
69+
70+
# This filegroup should only have source directories, not individual files.
71+
# We rely on this assumption in system_module_map.bzl.
72+
filegroup(
73+
name = "cxx_builtin_include",
74+
srcs = [
75+
"include/c++",
76+
"lib/clang/{LLVM_VERSION}/include",
77+
],
78+
)
79+
80+
filegroup(
81+
name = "extra_config_site",
82+
srcs = glob(["include/*/c++/v1/__config_site"], allow_empty = True)
83+
)
84+
85+
filegroup(
86+
name = "bin",
87+
srcs = glob(["bin/**"]),
88+
)
89+
90+
filegroup(
91+
name = "lib",
92+
srcs = [
93+
# Include the .dylib files in the linker sandbox even though they will
94+
# not be available at runtime to allow sanitizers to work locally.
95+
# Any library linked from the toolchain to be released should be linked statically.
96+
"lib/clang/{LLVM_VERSION}/lib",
97+
],
98+
)
99+
100+
filegroup(
101+
name = "lib_legacy",
102+
srcs = glob([
103+
# Include the .dylib files in the linker sandbox even though they will
104+
# not be available at runtime to allow sanitizers to work locally.
105+
# Any library linked from the toolchain to be released should be linked statically.
106+
"lib/clang/{LLVM_VERSION}/lib/**",
107+
"lib/**/libc++*.a",
108+
"lib/**/libunwind.a",
109+
], allow_empty = True),
110+
)
111+
112+
filegroup(
113+
name = "ar",
114+
srcs = [
115+
"bin/llvm-ar.exe",
116+
] + ALL_DLLS,
117+
)
118+
119+
filegroup(
120+
name = "as",
121+
srcs = [
122+
"bin/clang.exe",
123+
"bin/llvm-as.exe",
124+
] + ALL_DLLS,
125+
)
126+
127+
filegroup(
128+
name = "nm",
129+
srcs = [
130+
"bin/llvm-nm.exe",
131+
] + ALL_DLLS,
132+
)
133+
134+
filegroup(
135+
name = "llvm-lib",
136+
srcs = [
137+
"bin/llvm-lib.exe",
138+
] + ALL_DLLS,
139+
)
140+
141+
filegroup(
142+
name = "objcopy",
143+
srcs = [
144+
"bin/llvm-objcopy.exe",
145+
] + ALL_DLLS,
146+
)
147+
148+
filegroup(
149+
name = "objdump",
150+
srcs = [
151+
"bin/llvm-objdump.exe",
152+
] + ALL_DLLS,
153+
)
154+
155+
filegroup(
156+
name = "profdata",
157+
srcs = [
158+
"bin/llvm-profdata.exe",
159+
] + ALL_DLLS,
160+
)
161+
162+
filegroup(
163+
name = "dwp",
164+
srcs = [
165+
"bin/llvm-dwp.exe",
166+
] + ALL_DLLS,
167+
)
168+
169+
filegroup(
170+
name = "ranlib",
171+
srcs = [
172+
"bin/llvm-ranlib.exe",
173+
] + ALL_DLLS,
174+
)
175+
176+
filegroup(
177+
name = "readelf",
178+
srcs = [
179+
"bin/llvm-readelf.exe",
180+
] + ALL_DLLS,
181+
)
182+
183+
filegroup(
184+
name = "strip",
185+
srcs = [
186+
"bin/llvm-strip.exe",
187+
] + ALL_DLLS,
188+
)
189+
190+
filegroup(
191+
name = "symbolizer",
192+
srcs = [
193+
"bin/llvm-symbolizer.exe",
194+
] + ALL_DLLS,
195+
)
196+
197+
filegroup(
198+
name = "clang-tidy",
199+
srcs = [
200+
"bin/clang-tidy.exe",
201+
] + ALL_DLLS,
202+
)
203+
204+
filegroup(
205+
name = "clang-format",
206+
srcs = [
207+
"bin/clang-format.exe",
208+
] + ALL_DLLS,
209+
)
210+
211+
filegroup(
212+
name = "git-clang-format",
213+
srcs = [
214+
"bin/git-clang-format.exe",
215+
] + ALL_DLLS,
216+
)
217+
218+
filegroup(
219+
name = "libclang",
220+
srcs = glob(
221+
[
222+
"lib/libclang.so",
223+
"lib/libclang.dylib",
224+
"lib/libclang.lib",
225+
],
226+
allow_empty = True,
227+
),
228+
)

0 commit comments

Comments
 (0)