Files
codex/third_party/voice/opus-toolchain.cmake
Benjamin Carlsson 0683368584 Supply Bazel-managed CMake and Ninja for the bundled Opus build (#43083)
## Why

The bundled Opus encoder uses CMake and should not depend on tools available on a build worker's `PATH`.

## What changed

- Add `rules_foreign_cc` and provide its pinned CMake and Ninja tools and data to the `opusic-sys` build script.
- Add a CMake toolchain file that selects the declared Ninja executable, resolves the archiver path, and sets the target system and processor from `TARGET`, while retaining Bazel's compiler, SDK, and linker inputs.

GitOrigin-RevId: 48580c506d088d8c76cce958589ff94da458bd79
2026-09-05 19:31:24 +00:00

15 lines
650 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}")
# Compiler, SDK and linker inputs remain supplied by Bazel's target toolchain.