Files
codex/third_party/voice/opus-toolchain.cmake
T
zbarsky-openai 1099fe0694 Use hermetic LLVM for Windows MSVC Bazel builds (#60507)
## Why

Windows MSVC builds relied on installed C++ toolchains, and V8 snapshot generation required native Windows execution. Cross-compiling V8 also needs a Windows snapshot generator to preserve Windows unwind metadata.

## What changed

- Use the registered hermetic LLVM toolchain and declared Microsoft SDK for Windows MSVC builds, with static CRT linkage and the toolchain's declared `lld-link` for Rust.
- Run Windows V8 snapshot generators natively or through `rules_wine` on Linux, preserving target CPU, OS, and sandbox settings. Keep separate archive and binding pairs for the workspace's ISO stdio ABI and the distributed MSVC stdio ABI.
- Update build dependencies and bindgen, scope V8's Chromium libc++ settings to its own targets, and adapt native voice dependencies for clang-cl and Windows ARM64.
- Build SQLite directly with Bazel and give `openssl-sys` an explicit build using Bazel's OpenSSL.
- Remove build-worker source-directory dependencies from Bazel resource lookup, schema output discovery, and snapshot paths; embed assets in debug builds as well.

GitOrigin-RevId: fd224d9d28d73a67baf90f6d73c6079d60f20351
2026-11-10 03:02:25 +00:00

21 lines
966 B
CMake

# CMake's generator must use the Ninja declared in the Bazel action.
set(CMAKE_MAKE_PROGRAM "$ENV{CODEX_VOICE_NINJA}" CACHE FILEPATH "" FORCE)
# Archiver paths from Bazel are relative to the execution root.
get_filename_component(CMAKE_AR "$ENV{AR}" ABSOLUTE
BASE_DIR "${CMAKE_CURRENT_LIST_DIR}/../..")
if("$ENV{TARGET}" MATCHES "apple-darwin$")
set(CMAKE_SYSTEM_NAME Darwin)
elseif("$ENV{TARGET}" MATCHES "windows")
set(CMAKE_SYSTEM_NAME Windows)
else()
set(CMAKE_SYSTEM_NAME Linux)
endif()
string(REGEX REPLACE "-.*" "" CMAKE_SYSTEM_PROCESSOR "$ENV{TARGET}")
if("$ENV{TARGET}" STREQUAL "aarch64-pc-windows-msvc")
# NEON is guaranteed on Windows ARM64. Opus's optional runtime probe emits
# ARM32 instructions through MSVC's __emit, which clang-cl does not support.
set(OPUS_PRESUME_NEON ON CACHE BOOL "" FORCE)
set(OPUS_MAY_HAVE_NEON OFF CACHE BOOL "" FORCE)
endif()
# Compiler, SDK and linker inputs remain supplied by Bazel's target toolchain.