mirror of
https://github.com/openai/codex.git
synced 2026-10-28 18:58:46 +00:00
## Why The Bazel V8 source build supported Windows GNU but lacked an MSVC-targeting toolchain to produce `*-pc-windows-msvc` archives. ## What changed - Add opt-in archive targets for native Windows x64 and ARM64 hosts, selected by `//third_party/v8:rusty_v8_native_windows_archive_for_target`. - Fetch pinned LLVM and scope its `clang-cl` toolchain to V8 artifacts, using the installed Microsoft SDK. Bundle Chromium libc++ and compiler-rt builtins into the resulting `.lib`. - Adapt V8 dependencies, assembly, snapshot generation, and platform feature settings for MSVC, and derive test metadata from the selected engine features. - Document the native build workflow. Existing MSVC consumers continue using prebuilt artifacts; generated Rust bindings and publishing integration remain separate. GitOrigin-RevId: abd5049245aece90a116fc3bfeac2b158a76f6af
38 lines
2.0 KiB
Diff
38 lines
2.0 KiB
Diff
# 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")
|