diff --git a/.bazelrc b/.bazelrc index 16443cb6a6..7f589db289 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 @@ -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 @@ -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" diff --git a/MODULE.bazel b/MODULE.bazel index a4670c4eb9..6be1635554 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -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", +#) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index a22e8bfe91..8b1cfd88e9 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 6, - "moduleFileHash": "a5c12618329127104446e1a1814083b02ce37df545effce8d07a378e47e898d2", + "moduleFileHash": "4033da2e9111fd10a0dad37327701d06cd2d86933b08516bcc9f5520e05aca49", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -21,14 +21,8 @@ "version": "1.15.0-dll.0", "key": "", "repoName": "io_opentelemetry_cpp", - "executionPlatformsToRegister": [ - "@//:x64_windows-clang-cl", - "@local_config_platform//:host" - ], - "toolchainsToRegister": [ - "@local_config_cc//:cc-toolchain-x64_windows-clang-cl", - "@local_config_cc_toolchains//:all" - ], + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], "extensionUsages": [ { "extensionBzlFile": "@io_opentelemetry_cpp//bazel:repository.bzl", @@ -63,8 +57,7 @@ "column": 29 }, "imports": { - "local_config_cc": "local_config_cc", - "local_config_cc_toolchains": "local_config_cc_toolchains" + "local_config_cc": "local_config_cc" }, "devImports": [], "tags": [],