diff --git a/scripts/build-windows-docker.sh b/scripts/build-windows-docker.sh index e5e59bf..a208ea1 100755 --- a/scripts/build-windows-docker.sh +++ b/scripts/build-windows-docker.sh @@ -192,10 +192,31 @@ set -euo pipefail # the closing paren of the COMPILE_FLAGS setter. Idempotent across # runs — if the file already contains the sentinel line we skip. TOOLCHAIN_FILE=/home/builder/.cache/cargo-xwin/cmake/clang-cl/x86_64-pc-windows-msvc-toolchain.cmake -if ! grep -q "WZP_SSE_PATCH" "$TOOLCHAIN_FILE"; then - echo ">>> Patching cargo-xwin toolchain for SSE4.1 / SSSE3 intrinsics" - sed -i "s|/imsvc /home/builder/.cache/cargo-xwin/xwin/sdk/include/winrt)|/imsvc /home/builder/.cache/cargo-xwin/xwin/sdk/include/winrt\\n # WZP_SSE_PATCH — enable SSE4.1/SSSE3 so libopus (audiopus_sys) builds\\n /clang:-msse4.1\\n /clang:-mssse3\\n /clang:-msse3\\n /clang:-msse2)|" "$TOOLCHAIN_FILE" +echo ">>> Patching cargo-xwin toolchain for SSE4.1 / SSSE3 intrinsics" +if grep -q WZP_SSE_PATCH "$TOOLCHAIN_FILE"; then + echo " (already patched, skipping)" +else + # The cleanest way to add flags is to append a pure-CMake block to + # the end of the toolchain file. Both CMAKE_C_FLAGS and + # CMAKE_CXX_FLAGS were already FORCE-set earlier in the toolchain; + # we override them again with the same content plus our SSE flags. + # This runs AFTER the original set(... FORCE) and the CMAKE_ARGS + # from the cmake-rs invocation, so it wins. + cat >> "$TOOLCHAIN_FILE" <>> Toolchain tail after patch:" +tail -15 "$TOOLCHAIN_FILE" cd /build/source/desktop