# build/compiler/msvc.py from .base import Compiler from pathlib import Path from ..utils import run class MSVCCompiler(Compiler): def __init__(self, exe: str | None = None): super().__init__(exe or "cl") def compile(self, src: Path, out: Path, flags: list[str], extra_defines: list[str] | None = None, deps_out: Path | None = None) -> Path: # MSVC outputs object with /Fo cmd = [self.exe] + flags[:] if extra_defines: cmd += extra_defines cmd += ["/c", str(src), "/Fo" + str(out)] run(cmd) return out def link(self, objects: list[Path], output: Path, libs: list[str] | None = None): cmd = [self.exe] + [str(p) for p in objects] + ["/Fe" + str(output)] run(cmd)