Files
FFmpeg/compat
Kacper Michajłow 6a557f2d34 compat/windows: add mscl, a cl.exe wrapper producing make dependency files
cl.exe cannot write GNU style dependency files directly. It has
-showIncludes, which does make it print the dependencies, but they go to
stdout, intermixed with the compiler's other output. This wrapper mscl
converts the include records from the compiler's stdout into a .d file,
written next to the object file as a byproduct of compilation. All other
output is forwarded unchanged, with stderr kept on its original stream,
and the compiler exit status is passed through. The source file name
that cl.exe echoes on every compilation is dropped on the way, so the
build output loses that noise as well.

Dependency paths are rewritten relative to the current directory, making
the .d files independent of how the environment maps Windows drives
(MSYS, Cygwin and WSL all differ). Paths on another drive or share stay
absolute. Spaces, '#' and '$' are escaped the same way gcc escapes them,
and every header gets a -MP style dummy rule so that a header vanishing
with a toolchain update marks the objects out of date instead of failing
the build through stale .d files.

VSLANG is forced to English so the include records keep their known form
in every locale. Under WSL the variable is also listed in WSLENV, as
that is the only way it reaches the Windows side.

The wrapper is a native program because process creation is very
expensive on Windows, a shell implementation adds several extra
processes per compilation, which measurably slows down the whole build.
The same source also builds on POSIX hosts, for driving cl-like cross
compilers. When such a compiler reports Windows paths, as cl.exe does
under WSL interop, each distinct drive or share root is translated once
with wslpath or cygpath and reused for every path below it, so a
compilation costs at most one or two extra processes. clang-cl and
msvc-wine already report host paths and need none.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-09-14 02:25:40 +00:00
..
…
2026-09-12 23:52:20 +00:00
2025-08-03 13:48:47 +02:00
2025-08-14 00:08:10 +00:00
…