From cefde84a769ec7c1a34689c6be5ae41654ad2be3 Mon Sep 17 00:00:00 2001 From: george Date: Tue, 8 Oct 2024 22:36:10 -0700 Subject: [PATCH] Merge pull request #25909 from gblikas:patch-1 Update intrin_wasm.hpp #25909 See https://github.com/microsoft/vcpkg/issues/33443 for some build context when using ```vcpkg install opencv4:wasm32-emscripten``` `__EMSCRIPTEN_major__`, `__EMSCRIPTEN_minor__` and `__EMSCRIPTEN_tiny__` in `emsdk` >= 3.1.4 are in a header, as opposed to command line. We could potentially be more aggressive with how I'm checking this property; let me know if I should make the change. It should also be suggested that `-msimd128` is auto-included in the associated portfile for opencv, but that's a separate issue. Someone let me know if I should also make that change as well. Special thanks to https://github.com/youar for supporting this work; please inform if applying a copyright-header is appropriate attribution. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake --- .../core/include/opencv2/core/hal/intrin_wasm.hpp | 11 ++++++++++- modules/js/perf/package.json | 12 ++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/core/include/opencv2/core/hal/intrin_wasm.hpp b/modules/core/include/opencv2/core/hal/intrin_wasm.hpp index f5e5f05beb..e5c89c94b6 100644 --- a/modules/core/include/opencv2/core/hal/intrin_wasm.hpp +++ b/modules/core/include/opencv2/core/hal/intrin_wasm.hpp @@ -8,9 +8,18 @@ #include #include #include -#include #include "opencv2/core/saturate.hpp" + +// Emscripten v2.0.13 (latest officially supported, as of 07/30/2024): +// __EMSCRIPTEN_major__, __EMSCRIPTEN_minor__ and __EMSCRIPTEN_tiny__ are defined via commandline in +// https://github.com/emscripten-core/emscripten/blob/1690a5802cd1241adc9714fb7fa2f633d38860dc/tools/shared.py#L506-L515 +// +// See https://github.com/opencv/opencv/pull/25909 +#ifndef __EMSCRIPTEN_major__ +#include +#endif + #define CV_SIMD128 1 #define CV_SIMD128_64F 0 // Now all implementation of f64 use fallback, so disable it. #define CV_SIMD128_FP16 0 diff --git a/modules/js/perf/package.json b/modules/js/perf/package.json index 04607ddffe..06094794cf 100644 --- a/modules/js/perf/package.json +++ b/modules/js/perf/package.json @@ -2,18 +2,18 @@ "name": "opencv_js_perf", "description": "Perfermance tests for opencv js bindings", "version": "1.0.0", - "dependencies" : { - "benchmark" : "latest" + "dependencies": { + "benchmark": "latest" }, "repository": { - "type": "git", - "url": "https://github.com/opencv/opencv.git" + "type": "git", + "url": "https://github.com/opencv/opencv.git" }, "keywords": [], "author": "", "license": "Apache 2.0 License", "bugs": { - "url": "https://github.com/opencv/opencv/issues" + "url": "https://github.com/opencv/opencv/issues" }, "homepage": "https://github.com/opencv/opencv" - } \ No newline at end of file +}