Skip to content

Commit

Permalink
move clang-cl selection back to .bazelrc. this allows linux/others to…
Browse files Browse the repository at this point in the history
… compile
  • Loading branch information
malkia committed Apr 27, 2024
1 parent 1699f85 commit aac1425
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
16 changes: 11 additions & 5 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ common --skip_incompatible_explicit_targets
common --enable_platform_specific_config
common --enable_runfiles

# Put `clang-cl` specific options here, they are still used in conjuction with `windows` ones
build:clang-cl --per_file_copt="external/protobuf~/.*@-Wno-invalid-offsetof"
build:clang-cl --host_per_file_copt="external/protobuf~/.*@-Wno-invalid-offsetof"

build --build_tag_filters=-jaeger,-opentracing,-opentracing_shim
test --test_tag_filters=-jaeger,-opentracing,-opentracing_shim

Expand All @@ -27,7 +23,6 @@ build --experimental_cc_implementation_deps

build:windows --copt="/Brepro" --copt="/guard:cf" --copt="/guard:ehcont" --copt="/Z7" --copt="/JMC-" --copt="/sdl"
build:windows --host_copt="/Brepro" --host_copt="/guard:cf" --host_copt="/guard:ehcont" --host_copt="/Z7" --host_copt="/JMC-" --host_copt="/sdl"
build:windows --config=clang-cl
build:windows --linkopt="/Brepro" --linkopt="/guard:cf" --linkopt="/guard:ehcont" --linkopt="/DEBUG:FULL" --linkopt="/CETCOMPAT" --linkopt="/SWAPRUN:NET,CD" --linkopt="/OPT:REF,ICF" --linkopt="/RELEASE" --linkopt="/DEBUGTYPE:CV,PDATA,FIXUP"
build:windows --host_linkopt="/Brepro" --host_linkopt="/guard:cf" --host_linkopt="/guard:ehcont" --host_linkopt="shell32.lib"
# Requires Visual Studio 2019 Build Tools installed in default location with the latest compiler (14.29.30133) for x64
Expand Down Expand Up @@ -99,3 +94,14 @@ build --@curl//:use_mbedtls=true
# build --@curl//:http_only=true

mod --lockfile_mode=update

# Select clang-cl to be the default compiler on Windows
build:windows --config=clang-cl

# See MODULE.bazel where we've disabled the platform/toolchain setup, but made it back here
build:clang-cl --host_platform=//:x64_windows-clang-cl
build:clang-cl --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:clang-cl --per_file_copt="external/protobuf~/.*@-Wno-invalid-offsetof"
build:clang-cl --host_per_file_copt="external/protobuf~/.*@-Wno-invalid-offsetof"
build:clang-cl --per_file_copt="external/c-ares~/.*@-Wno-macro-redefined"
build:clang-cl --host_per_file_copt="external/c-ares~/.*@-Wno-macro-redefined"
18 changes: 9 additions & 9 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ use_repo(
)

cc_configure = use_extension("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_configure_extension")
use_repo(cc_configure, "local_config_cc", "local_config_cc_toolchains")
use_repo(cc_configure, "local_config_cc")

register_execution_platforms(
"@//:x64_windows-clang-cl",
"@local_config_platform//:host",
)
# check .bazelrc for --host_platform (this also sets --platforms)
#register_execution_platforms(
# "@//:x64_windows-clang-cl",
#)

register_toolchains(
"@local_config_cc//:cc-toolchain-x64_windows-clang-cl",
"@local_config_cc_toolchains//:all",
)
# check .bazelrc for --extra_toolchains
#register_toolchains(
# "@local_config_cc//:cc-toolchain-x64_windows-clang-cl",
#)
15 changes: 4 additions & 11 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aac1425

Please sign in to comment.