From 6c5bdac8b1279b9835d7e55b5c05283f43b3dcfb Mon Sep 17 00:00:00 2001 From: Ruben Leal Mirete Date: Mon, 9 Nov 2026 18:34:08 +0100 Subject: [PATCH] fix(cmake): skip the x86 AVX2 path under Emscripten Emscripten reports CMAKE_SYSTEM_PROCESSOR x86, so the AVX2 batch transform TU was compiled with -mavx2 -mfma, which wasm32 rejects. The sources' x86 paths already depend on real x86 compiler macros. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01ACJ9Nm11WsjN9i5GUmm43J --- CHANGELOG.md | 3 +++ CMakeLists.txt | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa0113..ada53be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +### Fixed +- **Emscripten builds.** Emscripten reports an x86 processor, so CMake added the AVX2 batch-transform source with `-mavx2 -mfma`, which wasm32 rejects. The x86 block is now skipped under Emscripten (the sources' x86 paths were already off there). Found building campello_renderer for WebGPU. + --- ## [0.6.0] - 2026-08-19 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5132874..0e6251f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,10 @@ target_include_directories(vector_math PUBLIC $ ) -if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)|(x86_64)") +# Emscripten reports an x86 processor, but WebAssembly has no AVX2/FMA (and +# the sources' x86 paths are off there: common.hpp only defines +# __VECTOR_MATH_ARCH_X86_X64 for real x86 targets). +if (NOT EMSCRIPTEN AND CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)|(x86_64)") # Runtime-dispatched AVX2 batch kernels. Compiled into their own TU so the # rest of the library can stay at the baseline ISA while still using AVX2 # when the CPU supports it.