The cmake crate strips -O*/O* from CFLAGS and, with no explicit generator on MSVC, overwrites CMAKE_C_FLAGS_RELEASE — so the previous CFLAGS=/O2 attempt could never work (verified: /DNDEBUG survived, /O2 stripped). With CMAKE_GENERATOR=Ninja the override branch is skipped and CMake's default Release flags (/O2 /Ob2 /DNDEBUG) reach ggml.
15 lines
835 B
TOML
15 lines
835 B
TOML
# Fix: whisper.cpp (whisper-rs-sys) is configured by the cmake crate, which on
|
|
# MSVC *without an explicit generator* overwrites CMAKE_C_FLAGS_RELEASE with
|
|
# unoptimized flags (it also strips any -O*/O* flag from CFLAGS, so env
|
|
# optimization flags can't survive). Result: ggml's CPU kernels compiled at
|
|
# /Od — CPU-only transcription ran ~40x slower than real time (bench finding
|
|
# W1, docs/benchmarks/2026-07-parakeet-vs-whisper.md). With a generator set,
|
|
# cmake-rs skips that override (`if generator.is_none() && msvc` in
|
|
# cmake-0.1.58) and CMake's default Release flags (/O2 /Ob2 /DNDEBUG) apply.
|
|
# Ninja ships with VS Build Tools; builds already require vcvars64 (which puts
|
|
# it on PATH). NDEBUG kept explicitly so C deps never build with asserts on.
|
|
[env]
|
|
CMAKE_GENERATOR = "Ninja"
|
|
CFLAGS = "/DNDEBUG"
|
|
CXXFLAGS = "/DNDEBUG"
|