# HG changeset patch # User Sebastien Jodogne # Date 1684508417 -7200 # Node ID 5956d7357098a727267048ef0ef187abbdf3098b # Parent 22a83fb9dd2396dbd5fb4d9e158116c1022da9ec macro ORTHANC_HAS_WASM_SIMD has to be manually defined diff -r 22a83fb9dd23 -r 5956d7357098 Applications/Samples/WebAssembly/CMakeLists.txt --- a/Applications/Samples/WebAssembly/CMakeLists.txt Wed May 17 17:30:52 2023 +0200 +++ b/Applications/Samples/WebAssembly/CMakeLists.txt Fri May 19 17:00:17 2023 +0200 @@ -52,6 +52,7 @@ set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") add_definitions( -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 + -DORTHANC_HAS_WASM_SIMD=0 -DORTHANC_WEBGL2_HEAP_COMPAT=0 ) diff -r 22a83fb9dd23 -r 5956d7357098 Applications/StoneWebViewer/WebAssembly/CMakeLists.txt --- a/Applications/StoneWebViewer/WebAssembly/CMakeLists.txt Wed May 17 17:30:52 2023 +0200 +++ b/Applications/StoneWebViewer/WebAssembly/CMakeLists.txt Fri May 19 17:00:17 2023 +0200 @@ -44,6 +44,7 @@ set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") add_definitions( -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 + -DORTHANC_HAS_WASM_SIMD=0 -DORTHANC_WEBGL2_HEAP_COMPAT=0 ) diff -r 22a83fb9dd23 -r 5956d7357098 Applications/StoneWebViewer/WebAssembly/StoneModule/CMakeLists.txt --- a/Applications/StoneWebViewer/WebAssembly/StoneModule/CMakeLists.txt Wed May 17 17:30:52 2023 +0200 +++ b/Applications/StoneWebViewer/WebAssembly/StoneModule/CMakeLists.txt Fri May 19 17:00:17 2023 +0200 @@ -54,6 +54,7 @@ set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") add_definitions( -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 + -DORTHANC_HAS_WASM_SIMD=0 -DORTHANC_WEBGL2_HEAP_COMPAT=0 ) diff -r 22a83fb9dd23 -r 5956d7357098 OrthancStone/Resources/WebAssemblySharedLibrary/CMakeLists.txt --- a/OrthancStone/Resources/WebAssemblySharedLibrary/CMakeLists.txt Wed May 17 17:30:52 2023 +0200 +++ b/OrthancStone/Resources/WebAssemblySharedLibrary/CMakeLists.txt Fri May 19 17:00:17 2023 +0200 @@ -54,6 +54,7 @@ set(WASM_LINKER_FLAGS "${WASM_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") add_definitions( -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 + -DORTHANC_HAS_WASM_SIMD=0 -DORTHANC_WEBGL2_HEAP_COMPAT=0 ) diff -r 22a83fb9dd23 -r 5956d7357098 OrthancStone/Resources/WebAssemblyUnitTests/CMakeLists.txt --- a/OrthancStone/Resources/WebAssemblyUnitTests/CMakeLists.txt Wed May 17 17:30:52 2023 +0200 +++ b/OrthancStone/Resources/WebAssemblyUnitTests/CMakeLists.txt Fri May 19 17:00:17 2023 +0200 @@ -47,6 +47,7 @@ add_definitions( -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -DORTHANC_BUILD_UNIT_TESTS=1 + -DORTHANC_HAS_WASM_SIMD=0 -DORTHANC_WEBGL2_HEAP_COMPAT=0 ) diff -r 22a83fb9dd23 -r 5956d7357098 OrthancStone/Sources/Toolbox/SimdIncludes.h --- a/OrthancStone/Sources/Toolbox/SimdIncludes.h Wed May 17 17:30:52 2023 +0200 +++ b/OrthancStone/Sources/Toolbox/SimdIncludes.h Fri May 19 17:00:17 2023 +0200 @@ -41,10 +41,19 @@ # define ORTHANC_HAS_WASM_SIMD 0 # define ORTHANC_MEMORY_ALIGNMENT 16 #elif defined(__EMSCRIPTEN__) +# if !defined(ORTHANC_HAS_WASM_SIMD) +# error ORTHANC_HAS_WASM_SIMD must be defined to use this file +# endif # define ORTHANC_HAS_AVX2 0 # define ORTHANC_HAS_SSE2 0 -# define ORTHANC_HAS_WASM_SIMD 1 -# define ORTHANC_MEMORY_ALIGNMENT 16 +# if ORTHANC_HAS_WASM_SIMD == 1 +// Setting macro "ORTHANC_HAS_WASM_SIMD" to "1" means that +// "-msimd128" has been provided to Emscripten (there doesn't seem +// to exist a predefined macro to automatically check this) +# define ORTHANC_MEMORY_ALIGNMENT 16 +# else +# define ORTHANC_MEMORY_ALIGNMENT 8 +# endif #elif defined(_MSC_VER) # if _M_IX86_FP >= 2 // https://stackoverflow.com/a/18563988 # define ORTHANC_HAS_AVX2 0