Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

### Changed
- **WebAssembly builds use SIMD** (`-msimd128`), on by default: every browser with WebGPU supports it. The option `VECTOR_MATH_WASM_SIMD` turns it off. It applies to the library and is passed on to consumers (compile and link, so wasm-opt accepts the SIMD instructions).

---

## [0.6.1] - 2026-11-10
Expand Down
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ option(VECTOR_MATH_BUILD_BENCHMARK "Enable building benchmark" OFF)

option(VECTOR_MATH_ENABLE_AVX2 "Enable x86/x64 AVX2+FMA code generation for public headers and library targets" OFF)

# WebAssembly SIMD (-msimd128), on by default: every browser with WebGPU has
# it. Compiles this directory with it (the library and the third-party code it
# builds); the target passes it on to its consumers below.
option(VECTOR_MATH_WASM_SIMD "WebAssembly builds: use SIMD (-msimd128)" ON)
if(EMSCRIPTEN AND VECTOR_MATH_WASM_SIMD)
add_compile_options(-msimd128)
add_link_options(-msimd128)
endif()

include_directories(inc)

message(STATUS "Building ${PROJECT_NAME}...")
Expand All @@ -32,6 +41,12 @@ target_include_directories(vector_math PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

# Consumers compile and link with SIMD too (the link tells wasm-opt to accept it).
if(EMSCRIPTEN AND VECTOR_MATH_WASM_SIMD)
target_compile_options(vector_math INTERFACE -msimd128)
target_link_options(vector_math INTERFACE -msimd128)
endif()

# 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).
Expand Down
Loading