Merge pull request #25718 from savuor:rv/hwasan_flag

Android SDK build script: HWAsan support added #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
- [ ] 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
pull/25602/head
Rostislav Vasilikhin 6 months ago committed by GitHub
parent bdf986ee51
commit 3ea7ed9ebf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      platforms/android/build_sdk.py

@ -158,6 +158,7 @@ class Builder:
self.debug = True if config.debug else False
self.debug_info = True if config.debug_info else False
self.no_samples_build = True if config.no_samples_build else False
self.hwasan = True if config.hwasan else False
self.opencl = True if config.opencl else False
self.no_kotlin = True if config.no_kotlin else False
self.shared = True if config.shared else False
@ -265,6 +266,12 @@ class Builder:
if no_media_ndk:
cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF"
if self.hwasan and "arm64" in abi.name:
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
cmake_vars.update(abi.cmake_vars)
if len(self.disable) > 0:
@ -380,6 +387,7 @@ if __name__ == "__main__":
parser.add_argument('--no_kotlin', action="store_true", help="Disable Kotlin extensions")
parser.add_argument('--shared', action="store_true", help="Build shared libraries")
parser.add_argument('--no_media_ndk', action="store_true", help="Do not link Media NDK (required for video I/O support)")
parser.add_argument('--hwasan', action="store_true", help="Enable Hardware Address Sanitizer on ARM64")
parser.add_argument('--disable', metavar='FEATURE', default=[], action='append', help='OpenCV features to disable (add WITH_*=OFF). To disable multiple, specify this flag again, e.g. "--disable TBB --disable OPENMP"')
args = parser.parse_args()

Loading…
Cancel
Save