Skip to content

Commit 9ceea6a

Browse files
committed
platform
1 parent f8bc231 commit 9ceea6a

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ build:linux --cxxopt='-std=c++14'
5252
build --per_file_copt="external/.*zlib.*/.*.c@-Wno-deprecated-non-prototype"
5353

5454
build:windows --copt=-Wno-builtin-macro-redefined --host_copt=-Wno-builtin-macro-redefined
55+
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:windows

BUILD

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,12 @@ filegroup(
1515
"//tools:for_bazel_tests",
1616
],
1717
)
18+
19+
platform(
20+
name = "windows",
21+
constraint_values = [
22+
"@platforms//cpu:x86_64",
23+
"@platforms//os:windows",
24+
"@bazel_tools//tools/cpp:clang-cl",
25+
],
26+
)

MODULE.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ single_version_override(
7272
patch_strip = 1,
7373
patches = ["//:rules_cc.patch"],
7474
)
75+
76+
cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension")
77+
use_repo(cc_configure, "local_config_cc")

swift/toolchains/swift_toolchain.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,11 @@ def _swift_toolchain_impl(ctx):
429429
target_triples.parse(ctx.var.get("CC_TARGET_TRIPLE") or target_system_name),
430430
)
431431

432-
# if "clang" not in cc_toolchain.compiler:
433-
# fail("Swift requires the configured CC toolchain to be LLVM (clang). " +
434-
# "Either use the locally installed LLVM by setting `CC=clang` in your environment " +
435-
# "before invoking Bazel, or configure a Bazel LLVM CC toolchain." +
436-
# "The current CC toolchain uses: {}".format(cc_toolchain.compiler))
432+
if "clang" not in cc_toolchain.compiler:
433+
fail("Swift requires the configured CC toolchain to be LLVM (clang). " +
434+
"Either use the locally installed LLVM by setting `CC=clang` in your environment " +
435+
"before invoking Bazel, or configure a Bazel LLVM CC toolchain." +
436+
"The current CC toolchain uses: {}".format(cc_toolchain.compiler))
437437

438438
if ctx.attr.os == "windows":
439439
swift_linkopts_cc_info = _swift_windows_linkopts_cc_info(

0 commit comments

Comments
 (0)