@@ -275,6 +275,37 @@ fn main() -> Result<(), Box<dyn Error>> {
275275 fs:: write ( & buildspec_win, "# PATCHED: no-op, deps provided by vcpkg\n " ) ?;
276276 }
277277
278+ // Patch windows/architecture.cmake.
279+ //
280+ // This file was designed for Visual Studio multi-generator workflows:
281+ // 1. It uses CMAKE_VS_PLATFORM_NAME (always empty with Ninja) to detect the
282+ // architecture – producing a FATAL_ERROR when the variable is unset.
283+ // 2. It kicks off companion x86 / ARM64 sub-builds via execute_process -A.
284+ // 3. When OBS_PARENT_ARCHITECTURE != CMAKE_VS_PLATFORM_NAME it falls into a
285+ // "child-build stub" else-branch that unconditionally adds win-capture /
286+ // virtualcam subdirectories and then returns – completely wrong for a
287+ // headless Ninja build.
288+ //
289+ // Replacing it with a minimal stub is the same strategy used for
290+ // compilerconfig.cmake and buildspec.cmake. All we need: set
291+ // OBS_PARENT_ARCHITECTURE so downstream cmake logic that queries it works.
292+ println ! ( "cargo:warning=Step: patch windows/architecture.cmake" ) ;
293+ let win_architecture = obs_src. join ( "cmake/windows/architecture.cmake" ) ;
294+ if win_architecture. exists ( ) {
295+ println ! ( "cargo:warning=Replacing windows/architecture.cmake with Ninja-compatible stub" ) ;
296+ fs:: write (
297+ & win_architecture,
298+ "# PATCHED: minimal Ninja-compatible stub (no VS multi-arch sub-builds)\n \
299+ include_guard(GLOBAL)\n \
300+ if(NOT DEFINED OBS_PARENT_ARCHITECTURE)\n \
301+ set(OBS_PARENT_ARCHITECTURE \" x64\" )\n \
302+ endif()\n \
303+ message(STATUS \" OBS_PARENT_ARCHITECTURE=${OBS_PARENT_ARCHITECTURE}\" )\n ",
304+ ) ?;
305+ } else {
306+ println ! ( "cargo:warning=windows/architecture.cmake not found, skipping" ) ;
307+ }
308+
278309 // Windows SDK version: prefer CMAKE_SYSTEM_VERSION env var (set by workflow)
279310 let sdk_ver = env:: var ( "CMAKE_SYSTEM_VERSION" )
280311 . unwrap_or_else ( |_| "10.0.20348.0" . to_string ( ) ) ;
0 commit comments