Simple question: is there an ifdef variable defined if "-msimd128" is given to an emscripten build, akin to how __EMSCRIPTEN_PTHREAD__ is defined if -pthread is given?
I'm looking to build OpenCV in emscripten so one of our modules we typically run in mobile environments might be run in a browser. The current instructions for building OpenCV using emscripten state to use a very old version of emscripten (2.0 IIRC) so I am treating as next to useless. The code as it stands almost builds out of the box apart from some issues in the HAL layer. The 4.7.0 code out-of-the-box fails to build on complaints about some unknown simd operations. The solution to that is simple: you have to say:
#include <emscripten/version.h>
to be able to get at the __EMSCRIPTEN_major__ etc defines - these no longer come from default.
However, even with this there are errors along the lines that simd128 instructions are being added to a non-simd128 environment. I've currently worked around this by patching the code to use the generic C++ "not to be used in production" approach. That is hard-wired. I may flip this to return to the official version and then require the -msimd128 flag is given (I believe that is the requirement). However, I would prefer to do it properly so the same source works in either scenario. I would prefer just to add an ifdef to the source rather than modifying the cmake files - as that increases the delta.
Thus the question.
OK the answer is:
#ifdef __wasm_simd128__
or equivalent. Took me a while to spot that __wasm_unimplemented_simd128__
does
not actually work, although I assume it did at some point - I was going on what
the OpenCV code says.