The previous 'patch the toolchain file' approach (234a798,48d2bd4) did write the SSE flags into the COMPILE_FLAGS list correctly in the baked image, but the CMakeCache.txt from the libopus configure ended up without them in CMAKE_C_FLAGS, so cmake's final compile commands didn't see them either. Most plausible explanation: cmake-rs passes `-DCMAKE_C_FLAGS=…` on the command line, and its assembly of that string happens outside the toolchain's FORCE set path, so the toolchain patch never propagated. Switch to a different lever: cargo-xwin already ships a tiny `override.cmake` loaded via CMAKE_USER_MAKE_RULES_OVERRIDE. That file is the right place to manipulate the compile-command `CMAKE_C_COMPILE_OBJECT` / `CMAKE_CXX_COMPILE_OBJECT` templates — it runs after cmake has initialised its compile rules but before any source is compiled. Append two string(REPLACE '<FLAGS>' '<FLAGS> /clang:-msse4.1 /clang:-mssse3 /clang:-msse3 /clang:-msse2') lines to that file so every C and C++ compile command generated by cmake gets the SSE feature flags inline, no matter what the project's CMAKE_C_FLAGS is set to. This is the CMake equivalent of a compiler wrapper and works regardless of how cmake-rs / cargo-xwin / libopus juggle their respective flag variables.
6.3 KiB
6.3 KiB