# Reuse rules_cc's installed SDK setup with an explicitly declared LLVM repo. # Only the V8 repository has native_llvm; ordinary local_config_cc behaves # exactly as upstream, including the caller's BAZEL_LLVM/USE_CLANG_CL. # Preserve DUMPBIN when selecting clang-cl; the upstream MSVC template uses it. diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl --- a/cc/private/toolchain/windows_cc_configure.bzl +++ b/cc/private/toolchain/windows_cc_configure.bzl @@ -539,6 +539,12 @@ The path to the LLVM installation, or None if not found. """ + # Codex's opt-in V8 toolchain supplies a Bazel-fetched compiler. + # Ordinary cc_autoconf repositories have no such attribute. + llvm_label = getattr(repository_ctx.attr, "native_llvm", None) + if llvm_label: + return str(repository_ctx.path(llvm_label).dirname).replace("/", "\\") + # 1. Check if BAZEL_LLVM is already set by user. bazel_llvm = _get_path_env_var(repository_ctx, "BAZEL_LLVM") if bazel_llvm: @@ -602,7 +608,7 @@ def _use_clang_cl(repository_ctx): """Returns True if USE_CLANG_CL is set to 1.""" - return _get_env_var(repository_ctx, "USE_CLANG_CL", default = "0") == "1" + return getattr(repository_ctx.attr, "native_llvm", None) != None or _get_env_var(repository_ctx, "USE_CLANG_CL", default = "0") == "1" def _find_missing_llvm_tools(repository_ctx, llvm_path): """Check if any required tool is missing under given LLVM path.""" @@ -716,6 +722,7 @@ build_tools["CL"] = find_llvm_tool(repository_ctx, llvm_path, "clang-cl.exe") build_tools["ML"] = find_msvc_tool(repository_ctx, vc_path, "ml64.exe", "x64") + build_tools["DUMPBIN"] = find_msvc_tool(repository_ctx, vc_path, "dumpbin.exe", target_arch) build_tools["LINK"] = find_llvm_tool(repository_ctx, llvm_path, "lld-link.exe") if not build_tools["LINK"]: build_tools["LINK"] = find_msvc_tool(repository_ctx, vc_path, "link.exe", "x64")