From 766f3f5fc41729ca8f050f042f940f27b93b4dfd Mon Sep 17 00:00:00 2001 From: Rostislav Vasilikhin Date: Tue, 18 Jun 2024 17:15:41 +0200 Subject: [PATCH] Merge pull request #25746 from savuor:rv/hwasan_flag_release Android SDK build script: HWAsan flags added for release mode #25746 A quick fix for #25718 ### 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 --- platforms/android/build_sdk.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platforms/android/build_sdk.py b/platforms/android/build_sdk.py index 7ba3fb8e0d..83f40904d5 100755 --- a/platforms/android/build_sdk.py +++ b/platforms/android/build_sdk.py @@ -267,10 +267,14 @@ class Builder: cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF" if self.hwasan and "arm64" in abi.name: + cmake_vars['OPENCV_ENABLE_MEMORY_SANITIZER'] = "ON" hwasan_flags = "-fno-omit-frame-pointer -fsanitize=hwaddress" - cmake_vars['CMAKE_CXX_FLAGS_DEBUG'] = hwasan_flags - cmake_vars['CMAKE_C_FLAGS_DEBUG'] = hwasan_flags - cmake_vars['CMAKE_LINKER_FLAGS_DEBUG'] = hwasan_flags + for s in ['OPENCV_EXTRA_C_FLAGS', 'OPENCV_EXTRA_CXX_FLAGS', 'OPENCV_EXTRA_EXE_LINKER_FLAGS', + 'OPENCV_EXTRA_SHARED_LINKER_FLAGS', 'OPENCV_EXTRA_MODULE_LINKER_FLAGS']: + if s in cmake_vars.keys(): + cmake_vars[s] = cmake_vars[s] + ' ' + hwasan_flags + else: + cmake_vars[s] = hwasan_flags cmake_vars.update(abi.cmake_vars)