• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 the V8 project authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5load("@bazel_skylib//lib:selects.bzl", "selects")
6load(
7    ":v8-target-cpu.bzl",
8    "v8_configure_target_cpu",
9    "v8_target_cpu",
10)
11
12package(
13    default_visibility = [
14        "//visibility:public",
15    ],
16)
17
18config_setting(
19    name = "is_fastbuild",
20    values = {
21        "compilation_mode": "fastbuild",
22    },
23)
24
25config_setting(
26    name = "is_debug",
27    values = {
28        "compilation_mode": "dbg",
29    },
30)
31
32config_setting(
33    name = "platform_cpu_x64",
34    constraint_values = ["@platforms//cpu:x86_64"],
35)
36
37config_setting(
38    name = "platform_cpu_ia32",
39    constraint_values = ["@platforms//cpu:x86_32"],
40)
41
42config_setting(
43    name = "platform_cpu_arm64",
44    constraint_values = ["@platforms//cpu:aarch64"],
45)
46
47config_setting(
48    name = "platform_cpu_arm",
49    constraint_values = ["@platforms//cpu:arm"],
50)
51
52config_setting(
53    name = "platform_cpu_s390x",
54    constraint_values = ["@platforms//cpu:s390x"],
55)
56
57config_setting(
58    name = "platform_cpu_riscv64",
59    constraint_values = ["@platforms//cpu:riscv64"],
60)
61
62config_setting(
63    name = "platform_cpu_ppc64le",
64    constraint_values = ["@platforms//cpu:ppc"],
65)
66
67v8_target_cpu(
68    name = "v8_target_cpu",
69    build_setting_default = "none",
70)
71
72config_setting(
73    name = "v8_host_target_is_none",
74    flag_values = {
75        ":v8_target_cpu": "none",
76    },
77)
78
79v8_configure_target_cpu(
80    name = "x64",
81    matching_configs = [":platform_cpu_x64"],
82)
83
84v8_configure_target_cpu(
85    name = "ia32",
86    matching_configs = [":platform_cpu_ia32"],
87)
88
89v8_configure_target_cpu(
90    name = "arm64",
91    matching_configs = [":platform_cpu_arm64"],
92)
93
94v8_configure_target_cpu(
95    name = "arm",
96    matching_configs = [":platform_cpu_arm"],
97)
98
99v8_configure_target_cpu(
100    name = "s390x",
101    matching_configs = [":platform_cpu_s390x"],
102)
103
104v8_configure_target_cpu(
105    name = "riscv64",
106    matching_configs = [":platform_cpu_riscv64"],
107)
108
109v8_configure_target_cpu(
110    name = "ppc64le",
111    matching_configs = [":platform_cpu_ppc64le"],
112)
113
114selects.config_setting_group(
115    name = "v8_target_is_32_bits",
116    match_any = [
117        ":v8_target_ia32",
118        ":v8_target_arm",
119    ],
120)
121
122# Running arm64 simulator on x64 host.
123selects.config_setting_group(
124    name = "v8_arm64_simulator",
125    match_all = [
126        ":v8_target_arm64",
127        ":is_x64",
128    ],
129)
130
131config_setting(
132    name = "is_linux",
133    constraint_values = ["@platforms//os:linux"],
134)
135
136config_setting(
137    name = "is_android",
138    constraint_values = ["@platforms//os:android"],
139)
140
141config_setting(
142    name = "is_macos",
143    constraint_values = ["@platforms//os:macos"],
144)
145
146config_setting(
147    name = "is_windows",
148    constraint_values = ["@platforms//os:windows"],
149)
150
151selects.config_setting_group(
152    name = "is_64bit",
153    match_any = [
154        ":v8_target_arm64",
155        ":is_x64",
156        ":is_arm64",
157        ":is_s390x",
158        ":is_riscv64",
159        ":is_ppc64le",
160    ],
161)
162
163selects.config_setting_group(
164    name = "is_windows_64bit",
165    match_all = [
166        ":is_64bit",
167        ":is_windows",
168    ],
169)
170
171selects.config_setting_group(
172    name = "is_posix",
173    match_any = [
174        ":is_linux",
175        ":is_android",
176        ":is_macos",
177    ],
178)
179
180selects.config_setting_group(
181    name = "is_not_android",
182    match_any = [
183        ":is_windows",
184        ":is_linux",
185        ":is_macos",
186    ]
187)
188
189selects.config_setting_group(
190    name = "is_non_android_posix",
191    match_any = [
192        ":is_linux",
193        ":is_macos",
194    ],
195)
196
197selects.config_setting_group(
198    name = "is_posix_x64",
199    match_all = [
200        ":is_posix",
201        ":is_x64",
202    ],
203)
204
205selects.config_setting_group(
206    name = "is_non_android_posix_x64",
207    match_all = [
208        ":is_non_android_posix",
209        ":is_x64",
210    ],
211)
212
213selects.config_setting_group(
214    name = "is_inline_asm_x64",
215    match_all = [
216        ":is_posix",
217        ":is_x64",
218    ],
219)
220
221selects.config_setting_group(
222    name = "is_inline_asm_ia32",
223    match_all = [
224        ":is_posix",
225        ":is_ia32",
226    ],
227)
228
229selects.config_setting_group(
230    name = "is_inline_asm_arm64",
231    match_all = [
232        ":is_posix",
233        ":is_arm64",
234    ],
235)
236
237selects.config_setting_group(
238    name = "is_inline_asm_arm",
239    match_all = [
240        ":is_posix",
241        ":is_arm",
242    ],
243)
244
245selects.config_setting_group(
246    name = "is_inline_asm_s390x",
247    match_all = [
248        ":is_posix",
249        ":is_s390x",
250    ],
251)
252
253selects.config_setting_group(
254    name = "is_inline_asm_riscv64",
255    match_all = [
256        ":is_posix",
257        ":is_riscv64",
258    ],
259)
260
261selects.config_setting_group(
262    name = "is_inline_asm_ppc64le",
263    match_all = [
264        ":is_posix",
265        ":is_ppc64le",
266    ],
267)
268
269selects.config_setting_group(
270    name = "is_msvc_asm_x64",
271    match_all = [
272        ":is_windows",
273        ":is_x64",
274    ],
275)
276
277selects.config_setting_group(
278    name = "is_msvc_asm_ia32",
279    match_all = [
280        ":is_windows",
281        ":is_ia32",
282    ],
283)
284
285selects.config_setting_group(
286    name = "is_msvc_asm_arm64",
287    match_all = [
288        ":is_windows",
289        ":is_arm64",
290    ],
291)
292
293config_setting(
294    name = "is_compiler_default",
295    flag_values = {
296        "@bazel_tools//tools/cpp:compiler": "compiler",
297    },
298)
299
300selects.config_setting_group(
301    name = "is_compiler_default_on_linux",
302    match_all = [
303        ":is_compiler_default",
304        ":is_linux",
305    ],
306)
307
308selects.config_setting_group(
309    name = "is_compiler_default_on_macos",
310    match_all = [
311        ":is_compiler_default",
312        ":is_macos",
313    ],
314)
315
316config_setting(
317    name = "is_compiler_clang",
318    flag_values = {
319        "@bazel_tools//tools/cpp:compiler": "clang",
320    },
321)
322
323selects.config_setting_group(
324    name = "is_clang",
325    match_any = [
326        ":is_compiler_default_on_macos",
327        ":is_compiler_clang",
328    ],
329)
330
331selects.config_setting_group(
332    name = "is_clang_s390x",
333    match_all = [
334        ":is_clang",
335        ":is_s390x",
336    ],
337)
338
339config_setting(
340    name = "is_compiler_gcc",
341    flag_values = {
342        "@bazel_tools//tools/cpp:compiler": "gcc",
343    },
344)
345
346selects.config_setting_group(
347    name = "is_gcc",
348    match_any = [
349        ":is_compiler_default_on_linux",
350        ":is_compiler_gcc",
351    ],
352)
353
354selects.config_setting_group(
355    name = "is_gcc_fastbuild",
356    match_all = [
357        ":is_gcc",
358        ":is_fastbuild",
359    ],
360)
361